Re: Audio queues synchronization
Re: Audio queues synchronization
- Subject: Re: Audio queues synchronization
- From: Nunzio <email@hidden>
- Date: Thu, 9 Apr 2009 15:36:48 +0200
Hi Doug,
thank you very much, now all is clearer.
I have another question: my app should also be capable of recording
audio while a track is in playback, just like a karaoke. In this case
the player and the recorder must start together, too. I suppose I have
to use the audiotimestamp again, but I was wondering: do I have to set
the startTime only for the first buffer of the recorder? Or for all
the buffers that I allocate and enqueue?
Thanks again,
Nunzio
Il giorno 09/apr/09, alle ore 14:51, Doug Wyatt ha scritto:
On Apr 9, 2009, at 4:05 , Nunzio wrote:
Hi everyone,
this is my first post here. I'm from Italy and I'm developing an
app for the iPhone. In this app, I'd like to play two audio tracks
and they should play at the same start time; I read that someone
here had the same question, and he was told to use mHostTime of the
AudioTimeStamp, as it is the mach_absolute_time.
Unfortunately, scheduling buffers via the host time is not
implemented. You can however start two queues at the same time by
passing the same timestamp to AudioQueueStart.
What I don't get is the use of the timestamp: I mean, I am making
the queue start at the currentTime of the hardware, right? What I
would like to do is to make the queue start some time AFTER the
current time, in order to allow the two queues to start together.
How could I do that? Is there something I am missing? Sorry for the
lack of knowledge here, but I really can't get to understand this
with just the audio queue services documentation.
Pick some amount of time a little bit in the future, say, 0.5
seconds. Then:
#include "CAHostTimeBase.h" // from CoreAudio PublicUtility
double secondsInFuture = 0.5;
UInt64 now = CAHostTimeBase::GetTheCurrentTime();
UInt64 hostTicksInFuture = (UInt64)(secondsInFuture *
CAHostTimeBase::GetFrequency());
AudioTimeStamp startTime;
startTime.mFlags = kAudioTimeStampHostTimeValid;
startTime.mHostTime = now + hostTicksInFuture;
Doug
_______________________________________________
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