Mercurial > hg > svapp
comparison audioio/AudioPulseAudioTarget.cpp @ 412:c1b2b8b84165 tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 16:36:21 +0100 |
parents | 7709bb9a1130 |
children | 72c662fe7ea3 |
comparison
equal
deleted
inserted
replaced
404:08a45e4cf1b1 | 412:c1b2b8b84165 |
---|---|
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 if (ch == 1 && sourceChannels == 1) { | |
256 | |
257 for (int i = 0; i < nframes; ++i) { | |
258 if (i < received) { | |
259 output[i * 2 + ch] = tmpbuf[0][i] * m_outputGain; | |
260 float sample = fabsf(output[i * 2 + ch]); | |
261 if (sample > peak) peak = sample; | |
262 } else { | |
263 output[i * 2 + ch] = 0; | |
264 } | |
265 } | |
266 | |
267 } else { | |
268 for (int i = 0; i < nframes; ++i) { | |
269 output[i * 2 + ch] = 0; | |
270 } | |
271 } | |
272 | 252 |
273 if (ch == 0) peakLeft = peak; | 253 if (ch == 0) peakLeft = peak; |
274 if (ch > 0 || sourceChannels == 1) peakRight = peak; | 254 if (ch == 1) peakRight = peak; |
275 } | 255 } |
276 | 256 |
277 #ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY | 257 #ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY |
278 SVDEBUG << "calling pa_stream_write with " | 258 SVDEBUG << "calling pa_stream_write with " |
279 << nframes * tmpbufch * sizeof(float) << " bytes" << endl; | 259 << nframes * tmpbufch * sizeof(float) << " bytes" << endl; |