changeset 411:7709bb9a1130

Remove redundant code (sourceChannels must be at least 2 "because we offer pan") (from coverity scan)
author Chris Cannam
date Wed, 03 Sep 2014 13:01:51 +0100
parents 7657075ecfca
children c1b2b8b84165 a39a7d6b0f2d
files audioio/AudioPulseAudioTarget.cpp
diffstat 1 files changed, 11 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- 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