From 072e39c9cf449ccb8d7be301768a769f479c2875 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 1 Jul 2016 21:17:52 +0200 Subject: [PATCH] filter/ReplayGain: skip PcmVolume if a mixer is set Previously, volume was applied twice: once by PcmVolume, and again by the hardware mixer. --- NEWS | 1 + src/filter/plugins/ReplayGainFilterPlugin.cxx | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 2649ac44c..43190a367 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ ver 0.19.17 (not yet released) +* replay gain: fix "replay_gain_handler mixer" setting ver 0.19.16 (2016/06/13) * faster seeking diff --git a/src/filter/plugins/ReplayGainFilterPlugin.cxx b/src/filter/plugins/ReplayGainFilterPlugin.cxx index f76e48e37..b6f574bd0 100644 --- a/src/filter/plugins/ReplayGainFilterPlugin.cxx +++ b/src/filter/plugins/ReplayGainFilterPlugin.cxx @@ -134,8 +134,6 @@ ReplayGainFilter::Update() volume = pcm_float_to_volume(scale); } - pv.SetVolume(volume); - if (mixer != nullptr) { /* update the hardware mixer volume */ @@ -146,7 +144,8 @@ ReplayGainFilter::Update() Error error; if (!mixer_set_volume(mixer, _volume, error)) LogError(error, "Failed to update hardware mixer"); - } + } else + pv.SetVolume(volume); } static Filter * @@ -174,7 +173,9 @@ ReplayGainFilter::Close() ConstBuffer ReplayGainFilter::FilterPCM(ConstBuffer src, gcc_unused Error &error) { - return pv.Apply(src); + return mixer != nullptr + ? src + : pv.Apply(src); } const struct filter_plugin replay_gain_filter_plugin = {