aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputThread.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-09-18 13:50:23 +0200
committerMax Kellermann <max@duempel.org>2014-09-18 13:50:23 +0200
commitb6fa22bd84b6f60bb73bec99a1182832b761542b (patch)
tree84b6b610f2bc7586e1b7f2d104f0b8e4dc8d77a5 /src/OutputThread.cxx
parenta0ef27a0cd97d53f89def5ed5c94250b92cbd587 (diff)
downloadmpd-b6fa22bd84b6f60bb73bec99a1182832b761542b.tar.gz
mpd-b6fa22bd84b6f60bb73bec99a1182832b761542b.tar.xz
mpd-b6fa22bd84b6f60bb73bec99a1182832b761542b.zip
OutputThread: retain negative mix ratio
Fixes MixRamp breakage.
Diffstat (limited to '')
-rw-r--r--src/OutputThread.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx
index 30d3ba30f..b96ba4efd 100644
--- a/src/OutputThread.cxx
+++ b/src/OutputThread.cxx
@@ -385,11 +385,20 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
if (length > other_length)
length = other_length;
+ float mix_ratio = chunk->mix_ratio;
+ if (mix_ratio >= 0)
+ /* reverse the mix ratio (because the
+ arguments to pcm_mix() are reversed), but
+ only if the mix ratio is non-negative; a
+ negative mix ratio is a MixRamp special
+ case */
+ mix_ratio = 1.0 - mix_ratio;
+
void *dest = ao->cross_fade_buffer.Get(other_length);
memcpy(dest, other_data, other_length);
if (!pcm_mix(dest, data, length,
ao->in_audio_format.format,
- 1.0 - chunk->mix_ratio)) {
+ mix_ratio)) {
FormatError(output_domain,
"Cannot cross-fade format %s",
sample_format_to_string(ao->in_audio_format.format));