Re: Loop notification
Re: Loop notification
- Subject: Re: Loop notification
- From: Mark Pauley <email@hidden>
- Date: Tue, 16 Oct 2007 11:32:24 -0700
I would use the CFRunLoopSource api: http://developer.apple.com/documentation/CoreFoundation/Reference/CFRunLoopSourceRef/Reference/reference.html
Essentially, you schedule a source on the main runloop from your main
thread and pass that to where ever you may need to signal the source.
Signal the source every time the event occurs, unschedule the source
when you're done with it.
_Mark
On Oct 16, 2007, at 2:36 AM, Andreas Falkenhahn wrote:
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
_______________________________________________
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