Mercurial > hg > sonic-visualiser
diff audioio/AudioJACKTarget.cpp @ 106:f8e362511b2f
* Probable fix to occasional channel misalignment during playback
author | Chris Cannam |
---|---|
date | Mon, 26 Feb 2007 16:32:37 +0000 |
parents | 0581d552481d |
children | 75b0087233d8 |
line wrap: on
line diff
--- a/audioio/AudioJACKTarget.cpp Mon Feb 26 14:55:08 2007 +0000 +++ b/audioio/AudioJACKTarget.cpp Mon Feb 26 16:32:37 2007 +0000 @@ -352,14 +352,16 @@ buffers[ch] = (float *)jack_port_get_buffer(m_outputs[ch], nframes); } + size_t received = 0; + if (m_source) { - m_source->getSourceSamples(nframes, buffers); - } else { - for (size_t ch = 0; ch < m_outputs.size(); ++ch) { - for (size_t i = 0; i < nframes; ++i) { - buffers[ch][i] = 0.0; - } - } + received = m_source->getSourceSamples(nframes, buffers); + } + + for (size_t ch = 0; ch < m_outputs.size(); ++ch) { + for (size_t i = received; i < nframes; ++i) { + buffers[ch][i] = 0.0; + } } float peakLeft = 0.0, peakRight = 0.0;