From 3be5d60fc4f3b65f1b8c326f9ffdcb346cc6132b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 29 Mar 2013 09:17:33 -0700 Subject: [PATCH] comment out threshold frames to hopefully reduce clicks --- interface/src/Audio.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 5fc5d55dcf..142de52b0e 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -264,19 +264,19 @@ int audioCallback (const void *inputBuffer, } // check if we have more than we need to play out - int thresholdFrames = ceilf((PACKET_LENGTH_SAMPLES + JITTER_BUFFER_SAMPLES) / (float)PACKET_LENGTH_SAMPLES); - int thresholdSamples = thresholdFrames * PACKET_LENGTH_SAMPLES; - - if (ringBuffer->diffLastWriteNextOutput() > thresholdSamples) { - // we need to push the next output forwards - int samplesToPush = ringBuffer->diffLastWriteNextOutput() - thresholdSamples; - - if (ringBuffer->getNextOutput() + samplesToPush > ringBuffer->getBuffer()) { - ringBuffer->setNextOutput(ringBuffer->getBuffer() + (samplesToPush - (ringBuffer->getBuffer() + RING_BUFFER_SAMPLES - ringBuffer->getNextOutput()))); - } else { - ringBuffer->setNextOutput(ringBuffer->getNextOutput() + samplesToPush); - } - } +// int thresholdFrames = ceilf((PACKET_LENGTH_SAMPLES + JITTER_BUFFER_SAMPLES) / (float)PACKET_LENGTH_SAMPLES); +// int thresholdSamples = thresholdFrames * PACKET_LENGTH_SAMPLES; +// +// if (ringBuffer->diffLastWriteNextOutput() > thresholdSamples) { +// // we need to push the next output forwards +// int samplesToPush = ringBuffer->diffLastWriteNextOutput() - thresholdSamples; +// +// if (ringBuffer->getNextOutput() + samplesToPush > ringBuffer->getBuffer()) { +// ringBuffer->setNextOutput(ringBuffer->getBuffer() + (samplesToPush - (ringBuffer->getBuffer() + RING_BUFFER_SAMPLES - ringBuffer->getNextOutput()))); +// } else { +// ringBuffer->setNextOutput(ringBuffer->getNextOutput() + samplesToPush); +// } +// } for (int s = 0; s < PACKET_LENGTH_SAMPLES_PER_CHANNEL; s++) {