Inherits from NSObject
Declared in MIKMIDIEndpointSynthesizer.h

Overview

MIKMIDIEndpointSynthesizer provides a very simple way to synthesize MIDI commands coming from a source endpoint (e.g. from a connected MIDI piano keyboard) to produce sound output.

To use it, simply create a synthesizer instance with the source you’d like it to play. It will continue playing incoming MIDI until it is deallocated.

Tasks

Properties

componentDescription

@property (nonatomic, readonly) AudioComponentDescription componentDescription
Discussion

The component description of the underlying Audio Unit instrument.

Declared In

MIKMIDIEndpointSynthesizer.h

endpoint

@property (nonatomic, strong, readonly) MIKMIDIEndpoint *endpoint
Discussion

The endpoint from which the receiver is receiving MIDI messages. This may be either an external MIKMIDISourceEndpoint, e.g. to synthesize MIDI events coming from an external MIDI keyboard, or it may be an MIKMIDIClientDestinationEndpoint, most commonly to synthesize MIDI coming from an MIKMIDIPlayer.

Declared In

MIKMIDIEndpointSynthesizer.h

graph

@property (nonatomic) AUGraph graph
Discussion

The AUGraph for the instrument.

Note: You should only use the setter for this property from an MIKMIDIEndpointSynthesizer subclass.

See Also

Declared In

MIKMIDIEndpointSynthesizer.h

instrument

@property (nonatomic) AudioUnit instrument
Discussion

The Audio Unit instrument that ultimately receives all of the MIDI messages sent to this endpoint synthesizer.

Note: You should only use the setter for this property from an MIKMIDIEndpointSynthesizer subclass.

See Also

Declared In

MIKMIDIEndpointSynthesizer.h

Class Methods

playerWithMIDISource:

+ (instancetype)playerWithMIDISource:(MIKMIDISourceEndpoint *)source
Discussion

Creates and initializes an MIKMIDIEndpointSynthesizer instance using Apple’s DLS synth as the underlying instrument.

Parameters

source

An MIKMIDISourceEndpoint instance from which MIDI note events will be received.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

playerWithMIDISource:componentDescription:

+ (instancetype)playerWithMIDISource:(MIKMIDISourceEndpoint *)source componentDescription:(AudioComponentDescription)componentDescription
Discussion

Creates and initializes an MIKMIDIEndpointSynthesizer instance.

Parameters

source

An MIKMIDISourceEndpoint instance from which MIDI note events will be received.

componentDescription

an AudioComponentDescription describing the Audio Unit instrument you would like the synthesizer to use.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

synthesizerWithClientDestinationEndpoint:

+ (instancetype)synthesizerWithClientDestinationEndpoint:(MIKMIDIClientDestinationEndpoint *)destination
Discussion

Creates and initializes an MIKMIDIEndpointSynthesizer instance using Apple’s DLS synth as the underlying instrument.

Parameters

destination

An MIKMIDIClientDestinationEndpoint instance from which MIDI note events will be received.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

synthesizerWithClientDestinationEndpoint:componentDescription:

+ (instancetype)synthesizerWithClientDestinationEndpoint:(MIKMIDIClientDestinationEndpoint *)destination componentDescription:(AudioComponentDescription)componentDescription
Discussion

Creates and initializes an MIKMIDIEndpointSynthesizer instance.

Parameters

destination

An MIKMIDIClientDestinationEndpoint instance from which MIDI note events will be received.

componentDescription

an AudioComponentDescription describing the Audio Unit instrument you would like the synthesizer to use.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

Instance Methods

handleMIDIMessages:

- (void)handleMIDIMessages:(NSArray *)messages
Discussion

Plays MIDI messages through the synthesizer.

This method can be used to synthesize arbitrary MIDI events. It is especially useful for MIKMIDIEndpointSynthesizers that are not connected to a MIDI endpoint.

Parameters

messages

An NSArray of MIKMIDICommand (subclass) instances.

Declared In

MIKMIDIEndpointSynthesizer.h

initWithClientDestinationEndpoint:

- (instancetype)initWithClientDestinationEndpoint:(MIKMIDIClientDestinationEndpoint *)destination
Discussion

Initializes an MIKMIDIEndpointSynthesizer instance using Apple’s DLS synth as the underlying instrument.

Parameters

destination

An MIKMIDIClientDestinationEndpoint instance from which MIDI note events will be received.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

initWithClientDestinationEndpoint:componentDescription:

- (instancetype)initWithClientDestinationEndpoint:(MIKMIDIClientDestinationEndpoint *)destination componentDescription:(AudioComponentDescription)componentDescription
Discussion

Initializes an MIKMIDIEndpointSynthesizer instance.

Parameters

destination

An MIKMIDIClientDestinationEndpoint instance from which MIDI note events will be received.

componentDescription

an AudioComponentDescription describing the Audio Unit instrument you would like the synthesizer to use.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

initWithMIDISource:

- (instancetype)initWithMIDISource:(MIKMIDISourceEndpoint *)source
Discussion

Initializes an MIKMIDIEndpointSynthesizer instance using Apple’s DLS synth as the underlying instrument.

Parameters

source

An MIKMIDISourceEndpoint instance from which MIDI note events will be received.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

initWithMIDISource:componentDescription:

- (instancetype)initWithMIDISource:(MIKMIDISourceEndpoint *)source componentDescription:(AudioComponentDescription)componentDescription
Discussion

Initializes an MIKMIDIEndpointSynthesizer instance.

Parameters

source

An MIKMIDISourceEndpoint instance from which MIDI note events will be received.

componentDescription

an AudioComponentDescription describing the Audio Unit instrument you would like the synthesizer to use.

Return Value

An initialized MIKMIDIEndpointSynthesizer or nil if an error occurs.

Declared In

MIKMIDIEndpointSynthesizer.h

selectInstrument:

- (BOOL)selectInstrument:(MIKMIDIEndpointSynthesizerInstrument *)instrument
Discussion

Changes the instrument/voice used by the synthesizer.

Parameters

instrument

An MIKMIDIEndpointSynthesizerInstrument instance.

Return Value

YES if the instrument was successfully changed, NO if the change failed.

Declared In

MIKMIDIEndpointSynthesizer.h

setupAUGraph

- (BOOL)setupAUGraph
Discussion

Sets up the AUGraph for the instrument. Do not call this method, as it is called automatically during initialization.

The method is provided to give subclasses a chance to override the AUGraph behavior for the instrument. If you do override it, you will need to create an AudioUnit instrument and set it to the instrument property. Also, if you intend to use the graph property, you will be responsible for setting that as well. DisposeAUGraph() is called on the previous graph when setting the graph property, and in dealloc.

Return Value

YES is setting up the graph was succesful, and initialization should continue, NO if setting up the graph failed and initialization should return nil.

Declared In

MIKMIDIEndpointSynthesizer.h