getStreamTime goes out of whack on Mac OS X when plugging/unplugging headphones => RETEST
On Jan 16, 2007, at 9:24 PM, Brant Sears wrote:
> Hi. I'm seeing an issue where when I plug headphones into my computer or remove them the results of Pa_GetStreamTime change - basically it causes the clock to reset on the stream.
>
> I'm seeing this on a Dual Processor G5 PowerMac running MacOS X 10.4.8.
>
> Has anyone else seen this? Am I doing something wrong?
I'm sorry to say this looks like a bug. I get similar results when I plug/unplug the headphones on my MacBook and I run patest_time.
It seems OS X doesn't just let the sound-card handle this changeover -- it has to intervene and treat the headphone output as a new device. I'm sure PortAudio could add a listener for this change and update it's own "startTime", but it seems it would be hard to guarantee that this change happened at the same time as the plug/unplug -- at least from the perspective of another thread. So the downside of this fix is that there could be a moment where there's a huge jump in time before it settles back to the right time.
The only workaround that seems like it would work, would be to use the timing information from the callback, which seems to stay on track. I have generally considered this info to be less up-to-date than the info coming from AudioDeviceGetCurrentTime, but it seems hard to create a high-latency situation on Mac OS X, so maybe it's good enough for most people.
> Hi. I'm seeing an issue where when I plug headphones into my computer or remove them the results of Pa_GetStreamTime change - basically it causes the clock to reset on the stream.
>
> I'm seeing this on a Dual Processor G5 PowerMac running MacOS X 10.4.8.
>
> Has anyone else seen this? Am I doing something wrong?
I'm sorry to say this looks like a bug. I get similar results when I plug/unplug the headphones on my MacBook and I run patest_time.
It seems OS X doesn't just let the sound-card handle this changeover -- it has to intervene and treat the headphone output as a new device. I'm sure PortAudio could add a listener for this change and update it's own "startTime", but it seems it would be hard to guarantee that this change happened at the same time as the plug/unplug -- at least from the perspective of another thread. So the downside of this fix is that there could be a moment where there's a huge jump in time before it settles back to the right time.
The only workaround that seems like it would work, would be to use the timing information from the callback, which seems to stay on track. I have generally considered this info to be less up-to-date than the info coming from AudioDeviceGetCurrentTime, but it seems hard to create a high-latency situation on Mac OS X, so maybe it's good enough for most people.
Leave a comment