Re: AURenderCallback inputs...
Re: AURenderCallback inputs...
- Subject: Re: AURenderCallback inputs...
- From: William Stewart <email@hidden>
- Date: Mon, 15 Aug 2005 12:48:16 -0700
On 14/08/2005, at 12:01 PM, Amir Aharon wrote:
Thanks Bill,
However I still cann't make the render callback to work.
Here is what I did( hope you have the patience)
ComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_HALOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
ComponentDescription effectDesc;
effectDesc.componentType = kAudioUnitType_Effect;
effectDesc.componentSubType = kAudioUnitSubType_Delay;
effectDesc.componentManufacturer = kAudioUnitManufacturer_Apple;
effectDesc.componentFlags = 0;
effectDesc.componentFlagsMask = 0;
err = NewAUGraph(&mGraph);
err = AUGraphNewNode(mGraph, &desc, 0, NULL, &mIONode);
err = AUGraphNewNode(mGraph, &effectDesc, 0, NULL, &mEffectNode);
err = AUGraphConnectNodeInput( mGraph, mIONode, 1, mEffectNode,
0); ***
*** (The above line needs to be removed)
err = AUGraphConnectNodeInput( mGraph, mEffectNode, 0, mIONode, 0);
err = AUGraphOpen(mGraph);
OK, at this point you have the following:
mIONode (1) -> (0) mEffectNode (0) -> (0) mIONode
err = AUGraphGetNodeInfo(mGraph, mIONode, NULL, NULL, NULL, &mHALUnit
);
err = AUGraphGetNodeInfo(mGraph, mEffectNode, NULL, NULL, NULL,
&mEffectUnit );
enableIO = 1;
err = AudioUnitSetProperty(mHALUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input, 1, &enableIO,sizeof(enableIO));
enableIO = 1;
err = AudioUnitSetProperty(mHALUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output, 0, &enableIO, sizeof(enableIO));
AURenderCallbackStruct renderCB;
memset(&renderCB, 0, sizeof(AURenderCallbackStruct));
renderCB.inputProcRefCon = NULL;
renderCB.inputProc = MyRenderProc;
err = AudioUnitSetProperty(mEffectUnit,
kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0,
&renderCB, sizeof(AURenderCallbackStruct));
You are trying to establish both a connection and a callback to the
Input (0) of mEffect Unit.
You can only have one or the other, not both. That is, an input bus
on an audio unit either gets input from a connection or from a
callback, but not both.
err = AUGraphInitialize(mGraph);
At this point, the connection is made, so you no longer have a render
callback.
err = AUGraphStart (mGraph);
OSStatus MyRenderProc(void *inRefCon, AudioUnitRenderActionFlags
*inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32
inBusNumber,UInt32 inNumFrames, AudioBufferList *ioData)
{
OSStatus err = noErr;
err = AudioUnitRender(mHALUnit, inActionFlags, inTimeStamp,
inBusNumber, inNumFrames, mInputBuffer);// my allocated InputBuffer
MyProcess(mInputBuffer);
Copy_InputBuffer_Into_IOData(mInputBuffer, ioData);
return err;
}
So, you don't need the connection from the ioUnit to the effect unit
- delete line (***) above and this will work just fine.
What your callback will do here is pretty much exactly what the
connection would do - ie. call the ouput unit's render call on bus 1
Bill
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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