http://bugs.winehq.org/show_bug.cgi?id=29602
--- Comment #14 from Andrew Eikum aeikum@codeweavers.com 2012-01-25 10:10:01 CST --- Another AudioQueue bug, it seems.
AudioQueueEnqueueWithParameters() returns the time in samples since device start when the given buffer will begin playing. In theory, AudioQueueGetTime() will return the same value when that buffer starts playing through the speakers.
Instead, AudioQueueEnqueueWithParameters() returns a value which is basically the sum of all written samples (that is, ignoring underruns). AudioQueueGetTime() returns the clock time since the queue started, in samples (including underruns).
So:
Enqueue(100) -> start_time = 0 Enqueue(200) -> start_time = 100 GetCurrentTime() -> ~150 or something reasonable Sleep(5 seconds) Enqueue(300) -> start_time = 300 = 100 + 200 GetCurrentTime() -> 50000 (that is, 5 seconds in terms of samples)
I'm trying to tweak our usage of the API so it turns out the right numbers.