Setting properties of an AudioUnit in an AUGraph
I am trying to use AUGraph in order to play several sounds mixed together. The sounds are retrieved from a file and stored in memory. According to some sample codes found on the web I made an output node, a mixer node and some generator nodes to provide the input.
The mixer node is connected to the output node and the generator nodes are connected to the mixer node.
For the generator I use as a subtype RemoteIO.
Then I thought (please confirm) that I should tell somehow where the input nodes get their data from, so I tried to define a callback for these input nodes doing the following:
AudioStreamBasicDescription* temp = ... //I tried to print it, the structure contains information from the sound I am trying to play, as expected; err = AudioUnitSetProperty(*generatorUnitTemp, //no error when getting this variable from AUGraphNodeInfo kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, temp, sizeof(AudioStreamBasicDescription));
generatorUnitTemp is a pointer to the AudioUnit associated to one of my generator node.
When I run this code, I get -50 as an error code. The strange thing is that this code doesn't seem to be referenced in the possible error codes outputted by this function.
Any one has an idea of what this code means and if I did something wrong?
Currently when I try to start the graph, neglecting this error, nothing happen, the callback is not run. (No crash either though)
Also, trying to understand my problem I discovered the CAShow function. Here is what it prints with my graph as parameter:
AudioUnitGraph 0x8E2001:
Member Nodes:
node 1: 'auou' 'genr' 'appl', instance 0xe07600 O I
node 2: 'aumx' 'mcmx' 'appl', instance 0xe48be0 O I
node 3: 'augn' 'rioc' 'appl', instance 0x0
Connections:
node 2 bus 0 => node 1 bus 0
node 3 bus 0 => node 2 bus 0
CurrentState:
mLastUpdateError=0, eventsToProcess=F, isRunning=F
I don't understand what does the reference after "instance" means? is it normal that it is set to 0 for the input node (node 3)?
Thanks
Alexandre
Macbook, Mac OS X (10.5.6)