MIKMIDIResponder
Objective-C
@protocol MIKMIDIResponder <NSObject>
Swift
protocol MIKMIDIResponder : NSObjectProtocol
The MIKMIDIResponder protocol defines methods to be implemented by any object that wishes to receive MIDI messages/commands.
Any class in an application can implement this protocol. To actually receive MIDI messages, a responder object must be registered by calling -[NS/UIApplication registerMIDIResponder]. Additionally, it is the client application’s responsibility to pass incoming MIDI messages to the application instance by calling -[NS/UIApplication handleMIDICommand:]
-
Returns an NSString used to uniquely identify this MIDI responder. Need not be human readable, but it should be unique in the application.
This identifier can be used to find a given responder at runtime. It is also used by MIKMIDI’s MIDI mapping system to uniquely identify mapped responders.
See
-[MIK_APPLICATION_CLASS(MIKMIDI) MIDIResponderWithIdentifier:]Declaration
Objective-C
- (nonnull NSString *)MIDIIdentifier;
Swift
func midiIdentifier() -> String
Return Value
An NSString containing a unique identifier for the receiver.
-
This method is called to determine if the receiver wants to handle the passed in MIDI command. If this method returns YES, -handleMIDICommand: is then called.
Declaration
Objective-C
- (BOOL)respondsToMIDICommand:(nonnull MIKMIDICommand *)command;
Swift
func responds(to command: MIKMIDICommand) -> Bool
Parameters
command
The MIDI command to be handled.
Return Value
YES if the receiver wishes to handle command, NO to ignore.
-
The primary method used for MIDI message/command handling. Implmenent the real
This method is only called if the preceeding call to -respondsToMIDICommand: returns YES.
Declaration
Objective-C
- (void)handleMIDICommand:(nonnull MIKMIDICommand *)command;
Swift
func handle(_ command: MIKMIDICommand)
Parameters
command
The MIDI command to be handled.
-
An array of subresponders, which must also conform to MIKMIDIResponder. Responders returned by this method will be eligible to receive MIDI commands without needing to be explicitly registered with the application, as long as the receiver (or a parent responder) is registered.
Should return a flat (non-recursive) array of subresponders. Return empty array, or don’t implement if you don’t want subresponders to be included in any case where the receiver would be considered for receiving MIDI
Declaration
Objective-C
- (nullable NSArray<id<MIKMIDIResponder>> *)subresponders;
Swift
optional func subresponders() -> [MIKMIDIResponder]?
Return Value
An NSArray containing the receivers subresponders. Each object in the array must also conform to MIKMIDIResponder.