# HG changeset patch # User Chris Cannam # Date 1409745711 -3600 # Node ID 7709bb9a11306752380c46968b82370b16932567 # Parent 7657075ecfca301c810df454b717e3a18077ea1c Remove redundant code (sourceChannels must be at least 2 "because we offer pan") (from coverity scan) diff -r 7657075ecfca -r 7709bb9a1130 audioio/AudioPulseAudioTarget.cpp --- a/audioio/AudioPulseAudioTarget.cpp Wed Sep 03 09:37:37 2014 +0100 +++ b/audioio/AudioPulseAudioTarget.cpp Wed Sep 03 13:01:51 2014 +0100 @@ -239,27 +239,19 @@ float peak = 0.0; - if (ch < sourceChannels) { - - // PulseAudio samples are interleaved - for (int i = 0; i < nframes; ++i) { - if (i < received) { - output[i * 2 + ch] = tmpbuf[ch][i] * m_outputGain; - float sample = fabsf(output[i * 2 + ch]); - if (sample > peak) peak = sample; - } else { - output[i * 2 + ch] = 0; - } - } - - } else { - for (int i = 0; i < nframes; ++i) { - output[i * 2 + ch] = 0; - } - } + // PulseAudio samples are interleaved + for (int i = 0; i < nframes; ++i) { + if (i < received) { + output[i * 2 + ch] = tmpbuf[ch][i] * m_outputGain; + float sample = fabsf(output[i * 2 + ch]); + if (sample > peak) peak = sample; + } else { + output[i * 2 + ch] = 0; + } + } if (ch == 0) peakLeft = peak; - if (ch > 0 || sourceChannels == 1) peakRight = peak; + if (ch == 1) peakRight = peak; } #ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY