Re: AURender Call back function
Re: AURender Call back function
- Subject: Re: AURender Call back function
- From: Gabriele Palmas <email@hidden>
- Date: Sat, 28 Feb 2009 09:43:23 -0500
Hi all,
I got my code compiling and this is a good step forward...
Now My call back function doesn't get called! That implies that something is wrong before that.
After I set up a basic AUGraph with a mixer node and a output node here is what I do:
UInt32 numbuses;
numbuses = 1;
printf("set output bus count %lu\n", numbuses);
err = AudioUnitSetProperty( MixerUnit, kAudioUnitProperty_ElementCount, kAudioUnitScope_Output, 0, &numbuses, sizeof(UInt32) );
UInt32 size;
size = sizeof(desc);
AudioFileGetProperty(playState.audioFile, kAudioFilePropertyDataFormat, &size, &desc);
for (int i=0; i<numbuses; ++i) {
// set render callback
AURenderCallbackStruct rcbs;
rcbs.inputProc = &renderInput;
rcbs.inputProcRefCon = &playState;
err = AudioUnitSetProperty( MixerUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, i, &rcbs, sizeof(rcbs) );
printf("set input format %d\n", i);
err = AudioUnitSetProperty( MixerUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, i, &desc, sizeof(desc) );
}
// set output stream format
err = AudioUnitGetProperty( MixerUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &desc, &size );
NSAssert(err == noErr, @"Graph failed to initialize");
AUGraphStart(myGraph);
}
Do you guys see anything wrong?
Thanks
Gab
On Thu, Feb 26, 2009 at 12:02 PM, Jens Alfke
<email@hidden> wrote:
On Feb 25, 2009, at 8:41 PM, Gabriele Palmas wrote:
Now I checked AudioFileOpen, ExtAudioFileOpen and ExtAudioFileCreateNew are part of the AudioTollBox Framework that is included in my app.
Adding the framework to the project makes more of a difference at link time. At compile time, the headers need to have been #included. It looks like CAAudioFile.h does include <AudioToolbox/AudioToolbox.h>, so I'm not sure why it wouldn't pick up the AudioFile declarations. Unless there's something different about the header layout on iPhone.
UInt32 nFrames = inNumberFrames;
PullBuffer(nFrames, ioData);
if (nFrames < inNumberFrames) { ....
Um, PullBuffer is a method, not a function. You have to call it through an instance of the class, i.e. myfile->PullBuffer. (Unless this snippet is part of a method in a class that subclasses CAAudioFile? In that case, we'd need to see more of the code.)
—Jens
_______________________________________________
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