aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer/plugins/PulseMixerPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-05 23:20:33 +0100
committerMax Kellermann <max@duempel.org>2014-02-19 21:40:14 +0100
commit8d6fedf8177d0d2ced81e6d93d35c368b2ac69db (patch)
tree17890432eb5d7f6cbdf5feb32a0105dc6f9d8974 /src/mixer/plugins/PulseMixerPlugin.cxx
parentf4f8fa7c947af10235d1cdd70b294a3b8810c6f4 (diff)
downloadmpd-8d6fedf8177d0d2ced81e6d93d35c368b2ac69db.tar.gz
mpd-8d6fedf8177d0d2ced81e6d93d35c368b2ac69db.tar.xz
mpd-8d6fedf8177d0d2ced81e6d93d35c368b2ac69db.zip
Mixer: add class MixerListener
Use a listener interface instead of GlobalEvents.
Diffstat (limited to 'src/mixer/plugins/PulseMixerPlugin.cxx')
-rw-r--r--src/mixer/plugins/PulseMixerPlugin.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mixer/plugins/PulseMixerPlugin.cxx b/src/mixer/plugins/PulseMixerPlugin.cxx
index b838de689..0a765bf68 100644
--- a/src/mixer/plugins/PulseMixerPlugin.cxx
+++ b/src/mixer/plugins/PulseMixerPlugin.cxx
@@ -20,8 +20,8 @@
#include "config.h"
#include "PulseMixerPlugin.hxx"
#include "mixer/MixerInternal.hxx"
+#include "mixer/Listener.hxx"
#include "output/plugins/PulseOutputPlugin.hxx"
-#include "GlobalEvents.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
@@ -41,9 +41,9 @@ class PulseMixer final : public Mixer {
struct pa_cvolume volume;
public:
- PulseMixer(PulseOutput &_output)
- :Mixer(pulse_mixer_plugin),
- output(_output), online(false)
+ PulseMixer(PulseOutput &_output, MixerListener &_listener)
+ :Mixer(pulse_mixer_plugin, _listener),
+ output(_output), online(false)
{
}
@@ -75,7 +75,7 @@ PulseMixer::Offline()
online = false;
- GlobalEvents::Emit(GlobalEvents::MIXER);
+ listener.OnMixerVolumeChanged(*this, -1);
}
inline void
@@ -92,7 +92,7 @@ PulseMixer::VolumeCallback(const pa_sink_input_info *i, int eol)
online = true;
volume = i->volume;
- GlobalEvents::Emit(GlobalEvents::MIXER);
+ listener.OnMixerVolumeChanged(*this, GetVolume(IgnoreError()));
}
/**
@@ -165,11 +165,12 @@ pulse_mixer_on_change(PulseMixer &pm,
static Mixer *
pulse_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
+ MixerListener &listener,
gcc_unused const config_param &param,
gcc_unused Error &error)
{
PulseOutput &po = (PulseOutput &)ao;
- PulseMixer *pm = new PulseMixer(po);
+ PulseMixer *pm = new PulseMixer(po, listener);
pulse_output_set_mixer(po, *pm);