aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/OutputCommand.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-26 16:29:07 +0100
committerMax Kellermann <max@duempel.org>2015-10-26 16:29:07 +0100
commitac61d43720393803cb3f6bc5c74aea588e1ca68d (patch)
tree1e2561805fde1bf7919e273d9b13145b34e6c8d0 /src/output/OutputCommand.cxx
parent1958f78cc1bd47ce1c9b57db41194f85aed942ab (diff)
downloadmpd-ac61d43720393803cb3f6bc5c74aea588e1ca68d.tar.gz
mpd-ac61d43720393803cb3f6bc5c74aea588e1ca68d.tar.xz
mpd-ac61d43720393803cb3f6bc5c74aea588e1ca68d.zip
output/Command: flush the mixer cache when enabling/disabling output
Fixes mixer lag (http://bugs.musicpd.org/view.php?id=4425).
Diffstat (limited to 'src/output/OutputCommand.cxx')
-rw-r--r--src/output/OutputCommand.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/output/OutputCommand.cxx b/src/output/OutputCommand.cxx
index 6afb70cf1..e6b8a8e7f 100644
--- a/src/output/OutputCommand.cxx
+++ b/src/output/OutputCommand.cxx
@@ -30,6 +30,7 @@
#include "Internal.hxx"
#include "PlayerControl.hxx"
#include "mixer/MixerControl.hxx"
+#include "mixer/Volume.hxx"
#include "Idle.hxx"
extern unsigned audio_output_state_version;
@@ -47,6 +48,11 @@ audio_output_enable_index(MultipleOutputs &outputs, unsigned idx)
ao.enabled = true;
idle_add(IDLE_OUTPUT);
+ if (ao.mixer != nullptr) {
+ InvalidateHardwareVolume();
+ idle_add(IDLE_MIXER);
+ }
+
ao.player_control->UpdateAudio();
++audio_output_state_version;
@@ -70,6 +76,7 @@ audio_output_disable_index(MultipleOutputs &outputs, unsigned idx)
Mixer *mixer = ao.mixer;
if (mixer != nullptr) {
mixer_close(mixer);
+ InvalidateHardwareVolume();
idle_add(IDLE_MIXER);
}
@@ -94,6 +101,7 @@ audio_output_toggle_index(MultipleOutputs &outputs, unsigned idx)
Mixer *mixer = ao.mixer;
if (mixer != nullptr) {
mixer_close(mixer);
+ InvalidateHardwareVolume();
idle_add(IDLE_MIXER);
}
}