Mercurial > hg > svapp
comparison audioio/AudioPulseAudioTarget.cpp @ 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 | 53fee450891e |
children | 72c662fe7ea3 |
comparison
equal
deleted
inserted
replaced
410:7657075ecfca | 411:7709bb9a1130 |
---|---|
237 | 237 |
238 for (int ch = 0; ch < 2; ++ch) { | 238 for (int ch = 0; ch < 2; ++ch) { |
239 | 239 |
240 float peak = 0.0; | 240 float peak = 0.0; |
241 | 241 |
242 if (ch < sourceChannels) { | 242 // PulseAudio samples are interleaved |
243 | 243 for (int i = 0; i < nframes; ++i) { |
244 // PulseAudio samples are interleaved | 244 if (i < received) { |
245 for (int i = 0; i < nframes; ++i) { | 245 output[i * 2 + ch] = tmpbuf[ch][i] * m_outputGain; |
246 if (i < received) { | 246 float sample = fabsf(output[i * 2 + ch]); |
247 output[i * 2 + ch] = tmpbuf[ch][i] * m_outputGain; | 247 if (sample > peak) peak = sample; |
248 float sample = fabsf(output[i * 2 + ch]); | 248 } else { |
249 if (sample > peak) peak = sample; | 249 output[i * 2 + ch] = 0; |
250 } else { | 250 } |
251 output[i * 2 + ch] = 0; | 251 } |
252 } | |
253 } | |
254 | |
255 } else { | |
256 for (int i = 0; i < nframes; ++i) { | |
257 output[i * 2 + ch] = 0; | |
258 } | |
259 } | |
260 | 252 |
261 if (ch == 0) peakLeft = peak; | 253 if (ch == 0) peakLeft = peak; |
262 if (ch > 0 || sourceChannels == 1) peakRight = peak; | 254 if (ch == 1) peakRight = peak; |
263 } | 255 } |
264 | 256 |
265 #ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY | 257 #ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY |
266 SVDEBUG << "calling pa_stream_write with " | 258 SVDEBUG << "calling pa_stream_write with " |
267 << nframes * tmpbufch * sizeof(float) << " bytes" << endl; | 259 << nframes * tmpbufch * sizeof(float) << " bytes" << endl; |