Questions about multiple DLS synth instantiations
Questions about multiple DLS synth instantiations
- Subject: Questions about multiple DLS synth instantiations
- From: Michael Norris <email@hidden>
- Date: Fri, 5 Dec 2003 15:59:20 +1300
Hi there
I'm trying to work through a couple of problems with an AUGraph that
contains two separate separate instantiations of the DLS Synthesizer in
it.
The AUGraph schematic is:
DLS_Synth1 DLS_Synth2
| |
| |
| |
\ /
-----------------
MIXER
-----------------
|
|
|
-----------
OUTPUT
-----------
PROBLEM 1: When I send program changes to the second AUNode (using
MusicDeviceMIDIEvent), it doesn't affect the sound output (it remains
the default piano sound, PC #0). When I remove the code that creates
the second node and set it equal to the first, the program changes work
correctly.
PROBLEM 2: The reason I want two nodes is because I need to use a
SoundFont on my hard-drive on one AUNode and Apple's built-in DLS
Sounds on the other (for their drumkit sounds). I ought to be able to
create a MusicSequence with two tracks, one track going to the
SoundFont node, the other going to the DLS node. Unfortunately it seems
that loading in a SoundFont on one node also effects the other. Any
thoughts on how to avoid this, or do you think it's a programming
error?
If anyone's been able to successfully construct an AUGraph with
multiple, independent synths in it, I'd appreciate a look at some code
snippets, particularly if you've been able to load SoundFonts onto
different synth instantiations.
For the time being, here's a summary of the (non-working) code:
// set up the AUGraph
NewAUGraph(&gAUGraph)
// create a mixer node to mix the two synths together (I've left out
the component description for brevity's sake)
AUGraphNewNode (gAUGraph, &description, 0, NULL, &mixerNode);
// create the output node and connect the mixer to the output (minus
the component desc)
AUGraphNewNode (gAUGraph, &description, 0, NULL, &outputNode);
AUGraphConnectNodeInput (gAUGraph, mixerNode, 0, outputNode, 0);
AUGraphUpdate (gAUGraph, NULL);
// now create the two DLS synths (minus the component descs, but
they're identical)
AUGraphNewNode (gAUGraph, &description, 0, NULL, &soundFontNode);
AUGraphConnectNodeInput (gAUGraph, soundFontNode, 0, mixerNode, 0);
AUGraphUpdate (gAUGraph, NULL);
AUGraphNewNode (gAUGraph, &description, 0, NULL, &DLSNode);
AUGraphConnectNodeInput (gAUGraph, DLSNode, 0, mixerNode, 1);
AUGraphUpdate (gAUGraph, NULL);
// PROBLEM 1: Now tell the "soundFontNode" AUNode to point to a
SoundFont file on the hard-drive
// Unfortunately, this also seems to affect the "DLSNode" AUNode as
well.
if (loadSoundFont) {
AUGraphGetNodeInfo (gAUGraph, soundFontNode, NULL, NULL, NULL,
&synthUnit);
AudioUnitSetProperty (synthUnit,
kMusicDeviceProperty_SoundBankFSSpec,
kAudioUnitScope_Global,
0,
&fsSpec,
sizeof (fsSpec));
}
// update & start graph
AUGraphOpen(gAUGraph);
AUGraphInitialize(gAUGraph);
AUGraphStart(gAUGraph)
// PROBLEM 2: try and apply a program change to the second AUNode: but
this doesn't work! Remains as the default piano sound...
if (sendProgramChange) {
AUGraphGetNodeInfo (gAUGraph, DLSNode, NULL, NULL, NULL,
&synthUnit);
MusicDeviceMIDIEvent (synthUnit, 0xC0 | channel, programChange, 0,
0);
}
// sound font loads OK, but all MIDI that goes to the DLSNode gets
rendered in the SoundFont, rather than the DLS sounds
------------------------------------
Michael Norris
Composer/Programmer
27b Salamanca Rd
Kelburn
Wellington
------------------------------------
Ph: +64 4 499 4282 / 021 211 0138
Web:
http://mnorris.wellington.net.nz
Stroma:
http://stroma.wellington.net.nz
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.