Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: playing audio files separated by specified time intervals
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: playing audio files separated by specified time intervals



So for getting the display to be in-sync with the audio, at least somewhat accurately, how can I check the output device's clock? Is there some method to do that?

thanks again guys, this is very helpful for me,
Maissam


On Dec 22, 2008, at 12:59 AM, tahome izwah wrote:

They count the samples that are being shuffled to the output device
and add the sample frames from their sound files in the appropriate
places. You don't need a clock for this at all, just insert the sample
frames from your audio file to the output in your render callback.
Since this is driven by the output devices' clock it is as accurate as
it can get.

HTH,
--th

2008/12/22 Maissam Barkeshli <email@hidden>:
Thanks for the help.

I'm still a little bit confused though about how this specifically should
work. Say I want to do something simple: play a single audio file once per
second and simultaneously update a visual counter on the GUI.


Right now I'm looking at starting a CoreAudioClock, running a loop and
continuously polling the clock to see whether a second has passed since the
last time. Once at least one second has passed, then play the file and
update the display. The problem with this is that even though CoreAudioClock
is very accurate, the program itself sometimes might actually take an extra
fraction of a second if the computer is busy with other applications.
But people still develop rock-solid metronome applications, with displays
and everything. How do they do it? The only thing I can think of about
making this work is that somehow I need to be using a thread that has
extremely high priority, so that the operating system focuses on this
particular program.


Perhaps I have settle with not being able to get the display to be perfectly
accurate, but with your suggestion I can get the audio to be accurate?



_______________________________________________ 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
References: 
 >playing audio files separated by specified time intervals (From: Maissam Barkeshli <email@hidden>)
 >Re: playing audio files separated by specified time intervals (From: Brian Willoughby <email@hidden>)
 >Re: playing audio files separated by specified time intervals (From: Maissam Barkeshli <email@hidden>)
 >Re: playing audio files separated by specified time intervals (From: "tahome izwah" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.