synchronizing audio queues
synchronizing audio queues
- Subject: synchronizing audio queues
- From: mister T <email@hidden>
- Date: Fri, 30 Jan 2009 17:41:48 +0100
Hello, I'm trying to sync two audio queues, but having difficulties
understanding how to perform the sync.
A little more explanation about what I want to achieve. There are 2
audio queues, each loaded with a sample equally in length (constant
bit rate, ima4 in a caf). When the first queue playes, after a certain
time (when a button is clicked) I want to 'kick in' the second queue
at the same time frame/packet index as the first queue.
I've used the player from the speakHere code example to define
multiple queues. According to the audio queue/session documentation
for synchronisation you have to change the audioQueueEnqueueBuffer
function in the callback function to
AudioTimeStamp aTimestamp;
AudioQueueEnqueueBufferWithParameters
(inAudioQueue,bufferReference,(bufferReference->mPacketDescriptions ?
numPackets : 0),bufferReference->mPacketDescriptions,0,0,0,NULL,NULL,&aTimestamp);
So I could get the timestamp when there are no more packets to read (1
full loop) and substract the timestamp from
AudioQueueDeviceGetNearestStartTime to know how much time one loop
takes. Combined with the total number of packets in the file I then
have a relation between elapsed time and packets. Nonetheless there
must be a better way to accomplish this, like computing the duration
beforehand using audioformat information. But I fail to see how to
accomplish this. Any information and/or advice on this matter would be
greatly appreciated.
_______________________________________________
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