From AudioUnitProperties.h:
/*!
@enum Apple AUMIDISynth Property IDs
@abstract The collection of property IDs for the Apple
Midi Synth audio unit.
@discussion The AUMIDISynth audio unit lets a client create
fully GM-compatible Midi Synth.
@constant kAUMIDISynthProperty_EnablePreload
@discussion Scope: Global
Value Type: UInt32
Access: Write
Setting this property to 1 puts the
MIDISynth in a mode where it will attempt to load
instruments from the bank or file when
it receives a program change message. This
is used internally by the
MusicSequence. It should only be used prior to MIDI playback,
and must be set back to 0 before
attempting to start playback.
*/
CF_ENUM(AudioUnitPropertyID) {
kAUMIDISynthProperty_EnablePreload = 4119
};
This is needed on the device because we do not have the spare memory to load
every instrument from a bank in advance. Set this property to 1, send your
program changes (looks like you will need to send a message for ALL of them if
you are randomly choosing one later), then set the property to 0, then start
playback.
-DS
> On Jan 9, 2016, at 8:00 PM, Archagon <[email protected]> wrote:
>
> Hello,
>
> I can't figure out how to make the AUMIDISynth MusicDevice
> (kAudioUnitType_MusicDevice, kAudioUnitSubType_MIDISynth) change its
> instrument on iOS. In the simulator, sending the following message...
>
> UInt32 command = 0xC0 | 0;
> UInt32 instrument = arc4random_uniform(100);
> MusicDeviceMIDIEvent(self.samplerUnit, command, instrument, 0, 0);
>
> ...works fine. On device, however, the synth just goes mute after
> receiving the message. (The first instrument in the soundfont —
> usually piano — does load correctly, however.) Is this a bug? If so,
> is there any way to work around it?
>
> Here's a simple test case based on the LoadPreset demo:
> https://github.com/archagon/ios-midisynth-program-change-bug-demo
> You can tap the middle button to change to a random instrument.
>
> Thank you,
> -Alexei
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/coreaudio-api/douglas_scott%40apple.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]