PYMIDIEndpoint

Inherits from:
NSObject
Conforms to:
NSCoding
NSObject (NSObject)
Declared in:
PYMIDI/PYMIDIEndpoint.h

Class Description

This is an abstract class which provides a common interface for the concrete classes PYMIDIRealSource, PYMIDIRealDestination, PYMIDIVirtualSource, and PYMIDIVirtualDestination.

Methods are provided for querying and setting the status of the endpoint as well as sending and receiving MIDI data.

Method Types

Querying and setting endpoint properties
- displayName
- compareByDisplayName:
- name
- setName:
- uniqueID
- setUniqueID:
- midiEndpointRef
- isIACBus
Endpoint status
- isOnline
- isOffline
- isInUse
- isOnlineOrInUse
Sending MIDI data
- addSender
- processMIDIPacketList:sender:
- removeSender:
Receiving MIDI data
- addReceiver
- removeReceiver:
Archiving endpoints
- descriptor

Instance Methods

addReceiver:

- (void)addReceiver:(id)receiver

Adds the given object as a receiver for MIDI data from this endpoint. The receiver is expected to have a method of the form:

- (void)processMIDIPacketList:(MIDIPacketList*)myPacketList sender:(id)sender

This method should only be called on endpoints that supply MIDI data, i.e. real sources and virtual destinations.

Note that eceivers added with this method are not retained by the endpoint.

See Also: - removeReceiver:, - isInUse


addSender:

- (void)addSender:(id)sender

Adds the given object as a sender of MIDI data to this endpoint. The sender can then call the processMIDIPacketList:sender: method of the endpoint to transmit data.

This method should only be called on endpoints that send MIDI data, i.e. real destinations and virtual sources.

Note that senders added with this method are not retained by the endpoint.

See Also: - processMIDIPacketList:sender:, - removeSender:, - isInUse


compareByDisplayName:

- (NSComparisonResult)compareByDisplayName:(PYMIDIEndpoint*)endpoint

Compares this endpoint's display name with that of the passed in endpoint and returns the appropriate result.

See Also: - displayName


descriptor

- (PYMIDIEndpointDescriptor*)descriptor

Returns a PYMIDIEndpointDescriptor that uniquely identifies this endpoint.


displayName

- (NSString*)displayName

Returns the name of the endpoint as it should be displayed to the user. In particular, this recognises external devices configured in Audio MIDI Setup and displays their names as appropriate.

The string "(offline)" will be appended to the display name of an endpoint with a device that is currently disconnected.

See Also: - name, - setName:, - compareByDisplayName:


isInUse

- (BOOL)isInUse

Returns YES if there are any senders or receivers registered on this endpoint.

See Also: - addReceiver:, - addSender:, - removeReceiver:, - removeSender:


isIACBus

- (BOOL)isIACBus

Returns YES if the endpoint is part of an IAC Bus.


isInUse

- (BOOL)isInUse

Returns YES if the endpoint is being used by your app; that is, if their are any registered senders or receivers on this endpoint.


isOffline

- (BOOL)isOffline

Returns YES if the device with which this endpoint is associated is currently not connected.

This is equivalent to ![endpoint isOnline].

See Also: - isOnline


isOnline

- (BOOL)isOnline

Returns YES if the device with which this endpoint is associated is currently connected.

See Also: - isOffline


isOnlineOrInUse

- (BOOL)isOnlineOrInUse

Returns YES if the endpoint is online or is in use. This is equivalent to [endpoint isOnline] || [endpoint isInUse].

See Also: - isOnline, - isInUse


midiEndpointRef

- (MIDIEndpointRef)midiEndpointRef

Returns the underlying CoreMIDI MIDIEndpointRef for this endpoint if there is one, nil otherwise.


name

- (NSString*)name

Returns the name of the endpoint, which usually consists of the name of the MIDI device followed by a port description.

For a name to display to the user, use the displayName method.

Note that this is not the same as the kMIDIPropertyName of the underlying CoreMIDI endpoint, but is a more useful value by which to reference the endpoint.

See Also: - displayName, - setName:


processMIDIPacketList:sender:

- (void)processMIDIPacketList:(const MIDIPacketList*)packetList sender:(id)sender

Attempts to send the given MIDI data via this endpoint.

Note that you should call addSender: to register yourself as a sender before calling this method.

See Also: - addSender:


removeReceiver:

- (void)removeReceiver:(id)receiver

Removes the given receiver from the endpoint.

See Also: - addReceiver:


removeSender:

- (void)removeSender:(id)sender

Removes the given sender from the endpoint.

See Also: - processMIDIPacketList:sender:, - addSender:


setName:

- (BOOL)setName:(NSString*)name

Sets the name of the given endpoint. This should only be used on virtual endpoints.

See Also: - name


setUniqueID:

- (BOOL)setUniqueID:(SInt32)uniqueID

Sets the CoreMIDI unique ID of the endpoint. Strictly speaking this shouldn't be possible, but older versions of OS X allow it.

See Also: - uniqueID


uniqueID

- (SInt32)uniqueID

Returns the CoreMIDI unique ID of this endpoint.

See Also: - setUniqueID: