Sync audio tracks
Sync audio tracks
- Subject: Sync audio tracks
- From: Savvas Constantinides <email@hidden>
- Date: Sat, 1 Nov 2008 15:04:09 +0000
- Importance: Normal
I have managed to play sounds
using the AudioQueue services. I can even play two or more sounds at
the same time using one or several audio queues but I have a problem trying to sync them together. I need
to sync the second track to the first while the first is already
playing. Just
to make this clear I am not trying to sync different audio files or
files with different bpm now I am actually trying to sync the same
audio track. What
I have tried until now is get the AudioTimeStamp of the hardware device
so I know the exact sample playing at the moment I press play on the
second one. I then fill the buffers of the second AudioQueue and play
it immediately. Unfortunately although really close in time the two tracks are not
really in time and their time difference is not a constant value. It
varies a bit and creates a phasing effect. I am wondering how can I overcome this problem. Is it
due to the latency of the hardware? If it is then the time difference
should be a constant value so there must be something else there. Is it
maybe because of too many calculations (I doubt that)? Something
else I tried was to use only one AudioQueue and multiple audio files
and mix the samples in the callback function. There is a noticable
delay there ofcourse because I am actually filling the buffer that was
just played which means there will be at least 2 times the buffer
length delay until the second file goes to the speakers. I
think the first approach is better but I am missing something.
Any ideas, clues?? Savvas
Get the best wallpapers on the Web - FREE. Click here!
|
_______________________________________________
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