Re: Callbacks in an AUGraph induced state
Re: Callbacks in an AUGraph induced state
- Subject: Re: Callbacks in an AUGraph induced state
- From: Robert Grant <email@hidden>
- Date: Sun, 28 Nov 2004 21:30:50 -0500
Hi Chilton,
I don't understand why you don't just wire the output of the AUHAL to
the input of the filter? Why are you using a render proc?
See this tech note for AUHAL bus config info:
http://developer.apple.com/technotes/tn2002/tn2091.html
Best,
Robert.
On Nov 28, 2004, at 9:19 PM, Chilton Webb wrote:
Hi,
This will probably be an easy one to figure out if you have used
AUGraphs before.
I have an AU based engine that uses AUHAL to read into a buffer, which
is then later retrieved by a filter effect, processed, and sent out
the output AUHAL. It works well enough, but I get horrible noise if I
stop it in-program and restart it (which I have to do fairly often,
unfortunately). So I'm trying these AU Graph things all the kids are
raving about. But my attempts thus far have been unsuccessful. The new
code is below, and is pretty simple.
The second function is from my (working) current code. I'd like to
move to AUGraphs though, so I'm replacing my normal filter effect and
output AUHAL unit with the BuildGraph code below. Any idea why this is
not working?
Thank you,
-Chilton
// code follows.
OSStatus BuildGraph(void)
{
AUNode synthNode, delayNode, outputNode;
ComponentDescription desc;
OSStatus err = noErr;
err = NewAUGraph(&myGraph);
// create nodes
desc.componentType = kAudioUnitComponentType;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
// our filter
desc.componentSubType = kAudioUnitSubType_Effect;
desc.componentManufacturer = kAudioUnitID_Delay;
err = AUGraphNewNode(myGraph, &desc, 0, NULL, &delayNode);
// default output unit
desc.componentSubType = kAudioUnitSubType_Output;
desc.componentManufacturer = kAudioUnitID_DefaultOutput;
err = AUGraphNewNode(myGraph, &desc, 0, NULL, &outputNode);
// connect nodes
err = AUGraphConnectNodeInput( myGraph, delayNode, 0, outputNode, 0 );
err = AUGraphOpen(myGraph);
err = AUGraphInitialize(myGraph);
err = AUGraphGetNodeInfo(myGraph, delayNode, NULL, NULL, NULL,
&FilterUnit);
err = AUGraphGetNodeInfo(myGraph, outputNode, NULL, NULL, NULL,
&OutputUnit);
// here is where we set our callback.
SetRenderProc();
err = AUGraphStart(myGraph);
return err;
}
// Set a render proc on our filter unit, to read from the buffer
OSStatus SetRenderProc(void)
{
OSStatus err = noErr;
AURenderCallbackStruct renderCallback;
renderCallback.inputProc = MyReadFromBufferProc;
renderCallback.inputProcRefCon = 0;
err = AudioUnitSetProperty (FilterUnit,
kAudioUnitProperty_SetRenderCallback,kAudioUnitScope_Input,0,&renderCal
lback,sizeof(AURenderCallbackStruct));
return err;
}
_______________________________________________
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
_______________________________________________
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