aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer/plugins/RoarMixerPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-06 20:44:33 +0100
committerMax Kellermann <max@duempel.org>2014-02-06 20:52:33 +0100
commitb6df4680df08db7827af56d5adf2a04264f2dcb9 (patch)
tree310e0e9305cdf1e5ef6da56c2f60af15c3774cb6 /src/mixer/plugins/RoarMixerPlugin.cxx
parente04090b477a6ec3c18b43250cf2ea37985057455 (diff)
downloadmpd-b6df4680df08db7827af56d5adf2a04264f2dcb9.tar.gz
mpd-b6df4680df08db7827af56d5adf2a04264f2dcb9.tar.xz
mpd-b6df4680df08db7827af56d5adf2a04264f2dcb9.zip
MixerPlugin: convert function pointers to Mixer virtual methods
Diffstat (limited to 'src/mixer/plugins/RoarMixerPlugin.cxx')
-rw-r--r--src/mixer/plugins/RoarMixerPlugin.cxx42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/mixer/plugins/RoarMixerPlugin.cxx b/src/mixer/plugins/RoarMixerPlugin.cxx
index f03c82c04..d1ac8a6e3 100644
--- a/src/mixer/plugins/RoarMixerPlugin.cxx
+++ b/src/mixer/plugins/RoarMixerPlugin.cxx
@@ -24,13 +24,25 @@
#include "output/plugins/RoarOutputPlugin.hxx"
#include "Compiler.h"
-struct RoarMixer final : public Mixer {
+class RoarMixer final : public Mixer {
/** the base mixer class */
RoarOutput *self;
+public:
RoarMixer(RoarOutput *_output)
:Mixer(roar_mixer_plugin),
self(_output) {}
+
+ /* virtual methods from class Mixer */
+ virtual bool Open(gcc_unused Error &error) override {
+ return true;
+ }
+
+ virtual void Close() override {
+ }
+
+ virtual int GetVolume(Error &error) override;
+ virtual bool SetVolume(unsigned volume, Error &error) override;
};
static Mixer *
@@ -41,35 +53,19 @@ roar_mixer_init(gcc_unused EventLoop &event_loop, void *ao,
return new RoarMixer((RoarOutput *)ao);
}
-static void
-roar_mixer_finish(Mixer *data)
-{
- RoarMixer *self = (RoarMixer *) data;
-
- delete self;
-}
-
-static int
-roar_mixer_get_volume(Mixer *mixer, gcc_unused Error &error)
+int
+RoarMixer::GetVolume(gcc_unused Error &error)
{
- RoarMixer *self = (RoarMixer *)mixer;
- return roar_output_get_volume(self->self);
+ return roar_output_get_volume(self);
}
-static bool
-roar_mixer_set_volume(Mixer *mixer, unsigned volume,
- gcc_unused Error &error)
+bool
+RoarMixer::SetVolume(unsigned volume, gcc_unused Error &error)
{
- RoarMixer *self = (RoarMixer *)mixer;
- return roar_output_set_volume(self->self, volume);
+ return roar_output_set_volume(self, volume);
}
const MixerPlugin roar_mixer_plugin = {
roar_mixer_init,
- roar_mixer_finish,
- nullptr,
- nullptr,
- roar_mixer_get_volume,
- roar_mixer_set_volume,
false,
};