Skip to content

Commit c7ac6b1

Browse files
committed
More debug messages.
1 parent ff5e58d commit c7ac6b1

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/soundio/sounddeviceportaudio.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ void SoundDevicePortAudio::readProcess(SINT framesPerBuffer) {
516516
if (m_inputFifo->readAvailable() == 0) {
517517
// Initial call or underflow at last call
518518
// Init half of the buffer with silence
519+
qDebug() << "SoundDevicePortAudio::readProcess() init m_inputFifo";
519520
CSAMPLE* dataPtr1;
520521
ring_buffer_size_t size1;
521522
CSAMPLE* dataPtr2;
@@ -634,6 +635,7 @@ void SoundDevicePortAudio::readProcess(SINT framesPerBuffer) {
634635
clearInputBuffer(inChunkSize - readCount, readCount);
635636
}
636637

638+
qDebug() << "pushInputBuffers 2" << &m_audioInputs;
637639
m_pSoundManager->pushInputBuffers(m_audioInputs, framesPerBuffer);
638640
}
639641
}
@@ -757,6 +759,18 @@ int SoundDevicePortAudio::callbackProcessDrift(
757759
m_pSoundManager->underflowHappened(7);
758760
}
759761

762+
double timeSinceLastCbSecs = m_clkRefTimer.restart().toDoubleSeconds();
763+
764+
PaTime callbackEntrytoDacSecs = timeInfo->outputBufferDacTime - timeInfo->currentTime;
765+
double bufferSizeSec = framesPerBuffer / m_sampleRate.toDouble();
766+
767+
double diff = (timeSinceLastCbSecs + callbackEntrytoDacSecs) -
768+
(m_lastCallbackEntrytoDacSecs + bufferSizeSec);
769+
770+
qDebug() << "DAC Drift" << timeInfo->outputBufferDacTime
771+
<< "callbackEntrytoDacSecs" << callbackEntrytoDacSecs << "diff"
772+
<< diff << "this" << timeSinceLastCbSecs;
773+
760774
// Since we are on the non Clock reference device and may have an independent
761775
// Crystal clock, a drift correction is required
762776
//
@@ -1042,6 +1056,7 @@ int SoundDevicePortAudio::callbackProcessClkRef(
10421056
ScopedTimer t(u"SoundDevicePortAudio::callbackProcess input %1",
10431057
m_deviceId.debugName());
10441058
composeInputBuffer(in, framesPerBuffer, 0, m_inputParams.channelCount);
1059+
qDebug() << "pushInputBuffers 1" << &m_audioInputs;
10451060
m_pSoundManager->pushInputBuffers(m_audioInputs, framesPerBuffer);
10461061
}
10471062

0 commit comments

Comments
 (0)