diff options
author | Max Kellermann <max@duempel.org> | 2014-09-24 21:49:20 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-09-24 21:49:20 +0200 |
commit | 92704857231423f662152495d5521301195dfd17 (patch) | |
tree | fdc2e8102018456790652f3c96953ce23147ce56 /src/output/OutputThread.cxx | |
parent | cbdaf4827fedd4159de07a648899d88ca9a884af (diff) | |
parent | e93975cb466db335f4c9739669fb22ad4ecf0b08 (diff) |
Merge branch 'v0.18.x'
Diffstat (limited to 'src/output/OutputThread.cxx')
-rw-r--r-- | src/output/OutputThread.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 98e43cffd..e46425097 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -371,11 +371,20 @@ ao_filter_chunk(AudioOutput *ao, const MusicChunk *chunk) if (data.size > other_data.size) data.size = other_data.size; + 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_data.size); memcpy(dest, other_data.data, other_data.size); if (!pcm_mix(ao->cross_fade_dither, dest, data.data, data.size, 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)); |