aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_mix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcm_mix.c')
-rw-r--r--src/pcm_mix.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pcm_mix.c b/src/pcm_mix.c
index 9a8aaeaca..28129608b 100644
--- a/src/pcm_mix.c
+++ b/src/pcm_mix.c
@@ -137,7 +137,16 @@ pcm_mix(void *buffer1, const void *buffer2, size_t size,
const struct audio_format *format, float portion1)
{
int vol1;
- float s = sin(M_PI_2 * portion1);
+ float s;
+
+ /* portion1 is between 0.0 and 1.0 for crossfading, MixRamp uses NaN
+ * to signal mixing rather than fading */
+ if (isnan(portion1)) {
+ pcm_add(buffer1, buffer2, size, PCM_VOLUME_1, PCM_VOLUME_1, format);
+ return;
+ }
+
+ s = sin(M_PI_2 * portion1);
s *= s;
vol1 = s * PCM_VOLUME_1 + 0.5;