Re: Callback [was PlayFile]
Re: Callback [was PlayFile]
- Subject: Re: Callback [was PlayFile]
- From: Michael Hanna <email@hidden>
- Date: Fri, 16 Dec 2005 14:51:48 -0800
Oh, was that what I was doing? I was trying setup a render callback
to the PlayFile example as a matter of fact. I thought that simply
adding a render callback property to the head node of the AUGraph was
all I needed to do. I would like to use AUFilePlayer, but also have a
render callback so that I can find out
at which point playback is at,
from a user event change playback position
from a user event change the playback region.
Is this what I can use the callback for?
I'm slowly going through the docs, but a lot of the concepts are
taking time to grasp for me.
Michael
On 16-Dec-05, at 11:46 AM, William Stewart wrote:
You can't feed an audio unit MP3 data directly.
We've numerous examples of how to play a file, I think the simplest
one is PlayFile (in the Simple examples in the latest SDK). It
shows you how to use the AUFilePlayer.
If you want more control than this, you can use the ExtAudioFile
API (see the ConvertFile) - the difference being that you can't
read files from the I/O thread (and the ExtAF API also does the
conversion from say MP3 to linear PCM which is what you need to
give an AU) - so you have to do your file reads in an ancilliary
thread (This is what the AUFilePlayer does for you)
I really think the AUFilePlayer is the best course to take - you
can schedule small slices for it to play (rather than just one big
slice), so you can still exercise some fine degree of control over
its playback behaviour.
Bill
On 15/12/2005, at 10:10 PM, Michael Hanna wrote:
Thanks Bill, I put together this at the end of MakeSimpleGraph();
[...............]
OSStatus err;
// setup the render callback
AURenderCallbackStruct input;
input.inputProc = MyRendererCallback;
input.inputProcRefCon = NULL;
err = AudioUnitSetProperty (anAU,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&input,
sizeof(input));
XThrowIfError (err, "kAudioUnitProperty_SetRenderCallback");
}
currently MyRendererCallback() does nothing:
OSStatus MyRendererCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
return noErr;
}
but I get a CAException from this setup when MakeSimpleGraph gets
called:
playing file: /Users/tao/Music/iTunes/iTunes Music/Lamb/What Sound/
07 Small.mp3
format: AudioStreamBasicDescription: 2 ch, 44100 Hz,
'.mp3' (0x00000000) 0 bits/channel, 0 bytes/packet, 1152 frames/
packet, 0 bytes/frame
terminate called after throwing an instance of 'CAXException'
CocoaPlayFile has exited due to signal 6 (SIGABRT).
pretty certain it's my new code. Any suggestions on this?
Michael
On 15-Dec-05, at 10:48 AM, William Stewart wrote:
Have a look at the Default Output code in the SDK - it shows you
have to establish the callback and feed data to it once the
output unit has been started. There are also some explanations in:
/Developer/Examples/CoreAudio/Documentation/AudioUnits/
Bill
On 14/12/2005, at 10:01 PM, Michael Hanna wrote:
Hi all,
I'm assuming this call is done in a callback. How do I setup and
create this callback? Pardon my naive questions.
--
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