Loop notification
Loop notification
- Subject: Loop notification
- From: "Andreas Falkenhahn" <email@hidden>
- Date: Tue, 16 Oct 2007 11:36:44 +0200 (CEST)
- Importance: Normal
Hi,
how could I implement a loop notification in my double buffered audio file
player? I want to post an event to the main thread's event queue every
time an audio file is looped.
This does not seem to be as easy as it sounds, because the feeder thread
I'm employing for my double buffer reads the data from the stream (using
AudioFileReadPackets) in chunks of about 1 second's worth of audio data.
Thus, I can't simply send the loop notification when my feeder thread
detects the end of the stream and moves its cursor back to 0, because the
loop is not there yet. There's still audio left to be rendered.
I can't send the loop notification from the PreRender or PostRender events
either, because my ACFillComplexBuffer() callback is also called only in
intervals of about 1 second, which is too unprecise for a good loop
detection.
Could someone please point me in the direction I should take to implement
a precise loop notification feature? Of course, I could do it using a
hacky way, i.e. set flag on audio end detection in feeder thread, then on
the next PostRender notification calculate the remaining playing time
until loop, and then install a timer which fires after this remaining
playing time is up. But that doesn't look like a nice solution. Is there a
better one?
Tks
Andreas
_______________________________________________
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