PYMIDIManager

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

Class Description

The PYMIDIManager is a singleton object that keeps track of the state of MIDI system and allows you to query that state, as well as providing some useful utility methods.

The sharedInstance class method is used to initialize and return the single shared PYMIDIManager instance for your application.

The PYMIDIManager sends a PYMIDISetupChanged notification whenever endpoints are added or removed, or attributes of them are changed.

Currently available sources and destinations can be queried using the realSources and realDestinations methods.


Method Types

Creating and initializing a PYMIDIManager
+ sharedInstance
Getting real destinations
- realDestinations
- realDestinationsOnlineOrInUse
- realDestinationWithDescriptor:
Getting real sources
- realSources
- realSourcesOnlineOrInUse
- realSourceWithDescriptor:
Note names
- nameOfNote:

Class Methods

sharedInstance

+ (PYMIDIManager*)sharedInstance

Returns the shared PYMIDIManager instance for the application. You should always use this method to retrieve a PYMIDIManager instance and should never instantiate your own.



Instance Methods

nameOfNote:

- (NSString*)nameOfNote:(Byte)note

Returns a string representing the given MIDI note number in human readable form, from "C-1" through to "G9", with middle C being "C4".


realDestinations

- (NSArray*)realDestinations

Returns an NSArray of PYMIDIRealDestination objects representing all available MIDI destinations.

Note that any device which goes offline will stay in this list in case the device ever comes back online.

Endpoints are returned sorted alphabetically by display name.

See Also: - realSources


realDestinationsOnlineOrInUse

- (NSArray*)realDestinationsOnlineOrInUse

This is similar to the realDestinations method, but returns only endpoints that are currently either online (as per the endpoint's isOnline method) or in use (as per the endpoint's isInUse method).

See Also: - realDestinations, - realSourcesOnlineOrInUse


realDestinationWithDescriptor:

- (PYMIDIEndpoint*)realDestinationWithDescriptor:(PYMIDIEndpointDescriptor*)descriptor

This method searches for and returns a real destination endpoint matching the given descriptor.

If no real endpoint on the system matches the descriptor, a new offline endpoint is created and returned. This endpoint will go online if the corresponding device is later connected.


realSources

- (NSArray*)realSources

Returns an NSArray of PYMIDIRealSource objects representing all available MIDI sources.

Note that any device which goes offline will stay in this list in case the device ever comes back online.

Endpoints are returned sorted alphabetically by display name.

See Also: - realDestinations


realSourcesOnlineOrInUse

- (NSArray*)realSourcesOnlineOrInUse

This is similar to the realSources method, but returns only endpoints that are currently either online (as per the endpoint's isOnline method) or in use (as per the endpoint's isInUse method).

See Also: - realSources, - realDestinationsOnlineOrInUse


realSourceWithDescriptor:

- (PYMIDIEndpoint*)realSourceWithDescriptor:(PYMIDIEndpointDescriptor*)descriptor

This method searches for and returns a real source endpoint matching the given descriptor.

If no real endpoint on the system matches the descriptor, a new offline endpoint is created and returned. This endpoint will go online if the corresponding device is later connected.



Notifications

PYMIDISetupChanged

The PYMIDISetupChanged notification is sent by the PYMIDIManager whenever a change occurs in the MIDI system. This includes plugging or unplugging of devices, creation or destruction of virtual endpoints and endpoint property changes.

MIDI system changes that you make yourself through the PYMIDI interfaces will not cause this notification to be sent, although changes made using CoreMIDI calls will.