• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Questions about multiple DLS synth instantiations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about multiple DLS synth instantiations


  • Subject: Re: Questions about multiple DLS synth instantiations
  • From: Robert Grant <email@hidden>
  • Date: Thu, 4 Dec 2003 22:23:54 -0500

Hi Michael,

Well what you're trying to do is perfectly fine and should work, so you've probably got something messed up somewhere :-) (The bit in PROBLEM 1 about setting it equal to the first is kind of confusing).

A brief scan through your code snippets (and imagining no blunders in the missing code) doesn't show any immediate errors, but your AUGraphUpdates are unnecessary as you don't need to worry about those until at least you've initialized the graph and probably not until you've got the graph running.

You're sure you're MIDI note routing code is sending MIDI to the right synth?

Also you're not using the PrepareInstrument before sending the program change. I can't remember if this is important or not - I used to think it was but then I remember reading something recently that said it's just a performance tweak and the instrument will be prepared (if it's not already) when the program change is received.

Are you checking the return codes of all those AU calls? I'm sure you are but just checking...

Rest assured that the two DLS Synth instances you've created are completely independent and the only way they can appear confused is through your own coding mistakes :-)

Put in a CAShow at the end of your graph creation code to make sure everything's wired up as you expect it.

Not much help, but perhaps some encouragement to keep looking?

Robert.

On Dec 4, 2003, at 9:59 PM, Michael Norris wrote:

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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Questions about multiple DLS synth instantiations
      • From: Michael Norris <email@hidden>
References: 
 >Questions about multiple DLS synth instantiations (From: Michael Norris <email@hidden>)

  • Prev by Date: Re: Questions about multiple DLS synth instantiations
  • Next by Date: Easy question about digital audio
  • Previous by thread: Re: Questions about multiple DLS synth instantiations
  • Next by thread: Re: Questions about multiple DLS synth instantiations
  • Index(es):
    • Date
    • Thread