Inherits from NSObject
Declared in MIKMIDIMappingGenerator.h

Overview

MIKMIDIMappingGenerator is used to map incoming commands from a MIDI device to MIDI responders in an application. It is intended to be used as the basis for a MIDI learning interface, where the application steps through controls/features and for each control, the user simply activates the hardware MIDI control (button, knob, etc.) to map it to that application function.

MIKMIDIMappingGenerator is able to interpret messages coming from a device to determine characteristics of the control sending the messages. This information is stored in the generated mapping for later use in correctly responding to incomding messages from each control. For example, some buttons on MIDI devices send a single message when pressed down, while other button send a message on press, and another on release. MIKMIDIMappingGenerator can determine the behavior for a button during mapping, so that an application knows to expect two messages from the mapped button during later use.

Tasks

Properties

delegate

@property (nonatomic, MIKMIDIMappingGeneratorWeakProperty) id<MIKMIDIMappingGeneratorDelegate> delegate
Discussion

The delegate for the mapping generator. Can be used to customize certain mapping behavior. Optional.

The delegate must implement the MIKMIDIMappingGeneratorDelegate protocol.

Declared In

MIKMIDIMappingGenerator.h

device

@property (nonatomic, strong) MIKMIDIDevice *device
Discussion

The device for which a mapping is being generated. Must not be nil.

Declared In

MIKMIDIMappingGenerator.h

mapping

@property (nonatomic, strong) MIKMIDIMapping *mapping
Discussion

The mapping being generated. Assign before mapping starts to modify existing mapping.

Declared In

MIKMIDIMappingGenerator.h

Class Methods

mappingGeneratorWithDevice:error:

+ (instancetype)mappingGeneratorWithDevice:(MIKMIDIDevice *)device error:(NSError **)error
Discussion

Convenience method for creating a mapping generator for a MIKMIDIDevice. The mapping generator will connect to the device’s source endpoint(s) in order to receive MIDI messages from it.

Parameters

device

The MIDI device for which a mapping is to be generated.

error

If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Return Value

An initialized MIKMIDIMappingGenerator instance, or nil if an error occurred.

Declared In

MIKMIDIMappingGenerator.h

Instance Methods

cancelCurrentCommandLearning

- (void)cancelCurrentCommandLearning

Declared In

MIKMIDIMappingGenerator.h

initWithDevice:error:

- (instancetype)initWithDevice:(MIKMIDIDevice *)device error:(NSError **)error
Discussion

Creates and initializes a mapping generator for a MIKMIDIDevice. The mapping generator will connect to the device’s source endpoint(s) in order to receive MIDI messages from it.

Parameters

device

The MIDI device for which a mapping is to be generated.

error

If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Return Value

An initialized MIKMIDIMappingGenerator instance, or nil if an error occurred.

Declared In

MIKMIDIMappingGenerator.h

learnMappingForControl:withCommandIdentifier:requiringNumberOfMessages:orTimeoutInterval:completionBlock:

- (void)learnMappingForControl:(id<MIKMIDIMappableResponder>)control withCommandIdentifier:(NSString *)commandID requiringNumberOfMessages:(NSUInteger)numMessages orTimeoutInterval:(NSTimeInterval)timeout completionBlock:(MIKMIDIMappingGeneratorMappingCompletionBlock)completionBlock
Discussion

Begins mapping a given MIDIResponder. This method returns immediately.

Parameters

control

The MIDI Responder object to map. Must conform to the MIKMIDIMappableResponder protocol.

commandID

The command identifier to be mapped. Must be one of the identifiers returned by the responder’s -commandIdentifiers method.

numMessages

The minimum number of messages to receive before immediately mapping the control. Pass 0 for the default.

timeout

Time to wait (in seconds) after the last received message before attempting to generate a mapping, or start over. Pass 0 for the default.

completionBlock

Block called when mapping is successfully completed. Call cancelCurrentCommandLearning to cancel a failed mapping.

Declared In

MIKMIDIMappingGenerator.h