Skip to content

Commit ed7fd00

Browse files
committed
move m_clkRefTimer into isClkRefDevice block, improve comments
1 parent 1ff048c commit ed7fd00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/soundio/sounddeviceportaudio.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ SoundDeviceError SoundDevicePortAudio::open(bool isClkRefDevice, int syncBuffers
347347
qDebug() << "PortAudio: Started stream successfully";
348348
}
349349

350-
m_clkRefTimer.start();
351-
352350
// Get the actual details of the stream & update Mixxx's data
353351
const PaStreamInfo* streamDetails = Pa_GetStreamInfo(pStream);
354352
m_dSampleRate = streamDetails->sampleRate;
@@ -363,6 +361,7 @@ SoundDeviceError SoundDevicePortAudio::open(bool isClkRefDevice, int syncBuffers
363361
ControlObject::set(ConfigKey("[Master]", "samplerate"), m_dSampleRate);
364362
ControlObject::set(ConfigKey("[Master]", "audio_buffer_size"), bufferMSec);
365363
m_invalidTimeInfoCount = 0;
364+
m_clkRefTimer.start();
366365
}
367366
m_pStream = pStream;
368367
return SOUNDDEVICE_ERROR_OK;
@@ -1005,7 +1004,8 @@ void SoundDevicePortAudio::updateCallbackEntryToDacTime(
10051004
(timeSinceLastCbSecs < bufferSizeSec * 2 &&
10061005
fabs(diff) / bufferSizeSec > 0.1)) {
10071006
// Fall back to CPU timing:
1008-
// If timeSinceLastCbSecs from a CPU timer is reasonable (no underflow)
1007+
// If timeSinceLastCbSecs from a CPU timer is reasonable (no underflow),
1008+
// the callbackEntrytoDacSecs time is not in the past
10091009
// and we have more than 10 % difference to the timing provided by Portaudio
10101010
// we do not trust the Portaudio timing.
10111011
// (A difference up to ~ 5 % is normal)

0 commit comments

Comments
 (0)