Stream time when two processes use same device.
Stream time when two processes use same device.
- Subject: Stream time when two processes use same device.
- From: Dominic Mazzoni <email@hidden>
- Date: Wed, 17 Sep 2003 22:41:26 -0700
I have a program that plays audio using CoreAudio, and displays the
current position within the audio file using the
"AudioDeviceGetCurrentTime" function.
This works great normally. However, when another program is also
using the same audio device (for example, if I start playing a song
in iTunes), then "AudioDeviceGetCurrentTime" doesn't give me times
relative to the beginning of my stream, but rather relative to the
beginning of when iTunes opened its stream. In other words, if I
start playing a song in iTunes, and 30 seconds later my program
starts playing, then my program shows that 30 seconds have elapsed.
Is there any way around this?
Obviously one solution is to just capture the stream time when I
start playing. However, that isn't a perfect solution, because
when iTunes is not running, the initial stream time I get is not
actually zero, but a little less than zero, because CoreAudio is
taking into account the hardware buffering and the estimated exact
time that the first sample will really play. Empirically, this
value seems to be quite different every time - ranging from 0.02
to 0.09 seconds.
I tested this with two devices: the built-in audio on my Power Mac
G4/733, and with a USB Audio Quattro. Same behavior.
Any suggestions would be greatly appreciated.
- Dominic
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.