310 // Slowly change gain to desired gain.
311 #define GAIN_DEZIPPER \
312 gain += (totalDesiredGain - gain) * DezipperRate; \
313 gain = DenormalDisabler::flushDenormalFloatToZero(gain);
314
315 // De-zipper for the first framesToDezipper frames and skip de-zippering for the remaining frames
316 // because the gain is close enough to the target gain.
317 #define PROCESS_WITH_GAIN(OP) \
318 for (k = 0; k < framesToDezipper; ++k) { \
319 OP \
320 GAIN_DEZIPPER \
321 } \
322 if (!framesToDezipper) \
323 gain = totalDesiredGain; \
324 OP##_V
325
326 #define STEREO_SUM \
327 { \
328 float sumL = DenormalDisabler::flushDenormalFloatToZero(*destinationL + gain * *sourceL++); \
329 float sumR = DenormalDisabler::flushDenormalFloatToZero(*destinationR + gain * *sourceR++); \
330 *destinationL++ = sumL; \
331 *destinationR++ = sumR; \
332 }
333
334 #define STEREO_SUM_V \
335 { \
336 vsma(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \
337 vsma(sourceR, 1, &gain, destinationR, 1, framesToProcess - k); \
338 }
339
340 // Mono -> stereo (mix equally into L and R)
341 // FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center...
342 #define MONO2STEREO_SUM \
343 { \
344 float scaled = gain * *sourceL++; \
345 float sumL = DenormalDisabler::flushDenormalFloatToZero(*destinationL + scaled); \
346 float sumR = DenormalDisabler::flushDenormalFloatToZero(*destinationR + scaled); \
347 *destinationL++ = sumL; \
348 *destinationR++ = sumR; \
349 }
350
351 #define MONO2STEREO_SUM_V \
352 { \
353 vsma(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \
354 vsma(sourceL, 1, &gain, destinationR, 1, framesToProcess - k); \
355 }
356
357 #define MONO_SUM \
358 { \
359 float sum = DenormalDisabler::flushDenormalFloatToZero(*destinationL + gain * *sourceL++); \
360 *destinationL++ = sum; \
361 }
362
363 #define MONO_SUM_V \
364 { \
365 vsma(sourceL, 1, &gain, destinationL, 1, framesToProcess - k); \
366 }
367
368 #define STEREO_NO_SUM \
369 { \
370 float sampleL = *sourceL++; \
371 float sampleR = *sourceR++; \
372 *destinationL++ = DenormalDisabler::flushDenormalFloatToZero(gain * sampleL); \
373 *destinationR++ = DenormalDisabler::flushDenormalFloatToZero(gain * sampleR); \