A couple of questions about hosting aumu-type audio units
A couple of questions about hosting aumu-type audio units
- Subject: A couple of questions about hosting aumu-type audio units
- From: Sean Lamont <email@hidden>
- Date: Thu, 01 Sep 2011 10:35:38 -0700
Hi there. I've been trying to do some programmatic control of some virtual synthesizers via the audio units framework, and I'm having a couple of questions.
1)
Using auval, I've been able to pull the type / manufacturer/etc codes and successfully instantiate the synthesis audio unit. I've also been able to Use the MusicTrack / MusicPlayer structure to successfully play a music sequence from the virtual synth. However, I have not been able to use MusicDeviceStartNote / MusicDeviceStopNote to play notes in the virtual synth. They do, however, successfully work when using the DLS music device.
This works: (Stolen from AUViewTest I think...) with both the AU synth and DLS synth:
MusicSequenceSetAUGraph(sequence, mGraph);
MusicTrackSetDestNode(track, mSynthNode);
NewMusicPlayer(&player);
MusicPlayerSetSequence(player, sequence);
MusicPlayerStart(player);
This only works with the DLS synth:
MusicDeviceGroupID groupID = 1;
Float32 instrument = 10;
UInt32 offset = 0;
NoteInstanceID nid;
OSStatus result;
MusicDeviceNoteParams noteParams;
noteParams.mVelocity = 127;
noteParams.mPitch = 60.0f;
noteParams.argCount = 2; // pitch, velocity, and whatever is in mControls (ie, nothing)
OSStatus status = MusicDeviceStartNote(mSynth, kMusicNoteEvent_Unused, groupID, &nid,
offset,¬eParams);
sleep(2);
OSStatus status2 = MusicDeviceStopNote(mSynth, groupID, nid, 0);
2)
Second question, and I can't get this to work for either the DLS synth or the hosted synth: How do you execute a program change? There seem to be a bunch of people asking this question in the archive, but not a lot of answers. I've tried:
MusicDeviceMIDIEvent(mSynth, (UInt32)(0xc0), 2, (UInt32)2, (UInt32)0);
This doesn't work. Also Have tried:
result = AudioUnitSetParameter(mSynth, 0xc0, kAudioUnitScope_Global, groupID,
instrument, offset);
Also doesn't work. Is there a definitive way to change the patch, either on the DLS synth or (especially) the plugin? Perhaps I'm mis-reading the API and/or the midi spec.
Thanks.
-Sean
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden