Detecting file completion of AUAudioFilePlayer playback
Detecting file completion of AUAudioFilePlayer playback
- Subject: Detecting file completion of AUAudioFilePlayer playback
- From: Björn Kempen <email@hidden>
- Date: Tue, 1 Dec 2009 09:59:07 +0100
Hi, I'm working on an app which uses an AUAudioFilePlayer audio unit
and I just can't seem to find a way to get a callback once the file
has finished playing.
Looking through the docs in AudioUnitProperties.h revealed something a
bit weird.
The docs first claim "The unit is a subclass of AUScheduledSoundPlayer
and inherits all of its "behavior.".
However, in the Completion Callbacks section, it seems like
mCompletionProc does something completely different.
AUScheduledSoundPlayer
"To receive a callback when the slice has been played, store a
pointer to a callback function in the mCompletionProc field.
This function will be called (from the audio unit's rendering
thread) when the slice has been completely
played -- or when the slice is determined to be unplayable due to an error.
As an alternative, you may also poll the slice's (mFlags &
kScheduledAudioSliceFlag_Complete)."
AUAudioFilePlayer
"A region's completion callback (mCompletionProc) is called when
it has been completely scheduled for reading from disk.
This callback is issued on the disk read thread."
In other words, it seems like the callback is called when the
scheduled sound of an AUScheduledSoundPlayer has finished playing, but
it will be called prior to that (since the scheduling will be
completed before the playback) for AUAudioFilePlayer.
My usage of mCompletionProc on an AUAudioFilePlayer confirms this,
which is sortof bad since I'd rather not have to resort to polling the
player to find out when the sound has finished playing.
Anyone has any ideas how to detect when playback has finished?
Thanks
- Björn Kempén
_______________________________________________
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