filter/ReplayGain: skip PcmVolume if a mixer is set

Previously, volume was applied twice: once by PcmVolume, and again by
the hardware mixer.
This commit is contained in:
Max Kellermann 2016-07-01 21:17:52 +02:00
parent 8dc3f3b21a
commit 072e39c9cf
2 changed files with 6 additions and 4 deletions

1
NEWS
View File

@ -1,4 +1,5 @@
ver 0.19.17 (not yet released) ver 0.19.17 (not yet released)
* replay gain: fix "replay_gain_handler mixer" setting
ver 0.19.16 (2016/06/13) ver 0.19.16 (2016/06/13)
* faster seeking * faster seeking

View File

@ -134,8 +134,6 @@ ReplayGainFilter::Update()
volume = pcm_float_to_volume(scale); volume = pcm_float_to_volume(scale);
} }
pv.SetVolume(volume);
if (mixer != nullptr) { if (mixer != nullptr) {
/* update the hardware mixer volume */ /* update the hardware mixer volume */
@ -146,7 +144,8 @@ ReplayGainFilter::Update()
Error error; Error error;
if (!mixer_set_volume(mixer, _volume, error)) if (!mixer_set_volume(mixer, _volume, error))
LogError(error, "Failed to update hardware mixer"); LogError(error, "Failed to update hardware mixer");
} } else
pv.SetVolume(volume);
} }
static Filter * static Filter *
@ -174,7 +173,9 @@ ReplayGainFilter::Close()
ConstBuffer<void> ConstBuffer<void>
ReplayGainFilter::FilterPCM(ConstBuffer<void> src, gcc_unused Error &error) ReplayGainFilter::FilterPCM(ConstBuffer<void> src, gcc_unused Error &error)
{ {
return pv.Apply(src); return mixer != nullptr
? src
: pv.Apply(src);
} }
const struct filter_plugin replay_gain_filter_plugin = { const struct filter_plugin replay_gain_filter_plugin = {