How Can I Determine When a ScheduledAudioFileRegion Has Finished Playing?
How Can I Determine When a ScheduledAudioFileRegion Has Finished Playing?
- Subject: How Can I Determine When a ScheduledAudioFileRegion Has Finished Playing?
- From: n ketter <email@hidden>
- Date: Sun, 27 Jan 2013 08:28:31 -0800
I asked this on
SO but haven't received any replies so thought I'd try here...
On iOS, I have an Audio Unit of type kAudioUnitSubType_AudioFilePlayer wrapped by an AUNode and connected to a multichannel mixer and remote IO (output) in an Audio Graph. While the graph is playing I want to loop the file and be able to determine when the AudioFilePlayer has reached the end of the file, so that I can perform an operation before it begins the next iteration of its loop.
In reviewing AudioUnitProperties.h, while there is a completion callback - mCompletionProc - it's only called when the disk has read the file and scheduled it for playback, not when it has actually finished playing back the audio. So then I considered storing the length of the audio (packets/frames) as a property and, in an input callback attached to another input of the mixer, checking to see if we're at the end of the file. But that callback doesn't get called every frame, so it's likely that the end of the file would be reached before my callback is invoked.
Has anyone run up against this problem before and solved it or have ideas for how I might approach it?
Thanks in advance.
_______________________________________________
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