Re: Callbacks in an AUGraph induced state
Re: Callbacks in an AUGraph induced state
- Subject: Re: Callbacks in an AUGraph induced state
- From: William Stewart <email@hidden>
- Date: Mon, 29 Nov 2004 12:07:20 -0800
A couple of comments...
On 28/11/04 6:19 PM, "Chilton Webb" <email@hidden> 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;
This is the V1 version - please don't use these anymore - you can look at
the different V1 types (AudioUnit/AUComponent.h)
> 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();
(If you move over to the V2 AU's this would need to change to use the V2
version of that property - all of the deprecated V1 stuff is in
AUNTComponent.h)
I'd echo what Robert suggested - that you make a further connection:
AUGraphConnectNodeInput (myGraph, outputNode, 1, delayNode, 0)
You also HAVE to enable the input capability on the AUHAL unit - you also
CANNOT use the input stuff with anything but the AUHAL unit - so you can't
use the default output unit to do this... The tech note robert mentioned has
more details
Bill
> 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,&renderCall
> back,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
--
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
__________________________________________________________________________
_______________________________________________
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