MIKMIDIMappableResponder

Objective-C

@protocol MIKMIDIMappableResponder <MIKMIDIResponder>

Swift

protocol MIKMIDIMappableResponder : MIKMIDIResponder

This protocol defines methods that that must be implemented by MIDI responder objects to be mapped using MIKMIDIMappingGenerator, and to whom MIDI messages will selectively be routed using a MIDI mapping during normal operation.

  • The list of identifiers for all commands supported by the receiver.

    A MIDI responder may want to handle incoming MIDI message from more than one control. For example, a view displaying a list of songs may want to support commands for browsing up and down the list with buttons, or with a knob, as well as a button to load the selected song. These commands would be for example, KnobBrowse, BrowseUp, BrowseDown, and Load. This way, multiple physical controls can be mapped to different functions of the same MIDI responder.

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)commandIdentifiers;

    Swift

    func commandIdentifiers() -> [String]

    Return Value

    An NSArray containing NSString identifers for all MIDI mappable commands supported by the receiver.

  • The MIDI responder types the receiver will allow to be mapped to the command specified by commandID.

    In the example given for -commandIdentifers, the “KnobBrowse” might be mappable to any physical knob, while BrowseUp, BrowseDown, and Load are mappable to buttons. The responder would return MIKMIDIResponderTypeKnob for @“KnobBrowse” while returning MIKMIDIResponderTypeButton for the other commands.

    See

    MIKMIDIResponderType

    Declaration

    Objective-C

    - (MIKMIDIResponderType)MIDIResponderTypeForCommandIdentifier:
        (nonnull NSString *)commandID;

    Swift

    func midiResponderType(forCommandIdentifier commandID: String) -> MIKMIDIResponderType

    Parameters

    commandID

    A command identifier string.

    Return Value

    A MIKMIDIResponderType bitfield specifing one or more responder type(s).

  • Whether the physical control mapped to the commandID in the receiver should be illuminated, or not.

    Many hardware MIDI devices, e.g. DJ controllers, have buttons that can light up to show state for the associated function. For example, the play button could be illuminated when the software is playing. This method allows mapped MIDI responder objects to communicate the desired state of the physical control mapped to them.

    Currently MIKMIDI doesn’t provide automatic support for actually updating physical LED status. This must be implemented in application code. For most devices, this can be accomplished by sending a MIDI message to the device. The MIDI message should identical to the message that the relevant control sends when pressed, with a non-zero value to illumniate the control, or zero to turn illumination off.

    Declaration

    Objective-C

    - (BOOL)illuminationStateForCommandIdentifier:(nonnull NSString *)commandID;

    Swift

    optional func illuminationState(forCommandIdentifier commandID: String) -> Bool

    Parameters

    commandID

    The commandID for which the associated illumination state is desired.

    Return Value

    YES if the associated control should be illuminated, NO otherwise.