diff options
Diffstat (limited to 'src/mixer')
-rw-r--r-- | src/mixer/MixerControl.cxx | 2 | ||||
-rw-r--r-- | src/mixer/MixerControl.hxx | 3 | ||||
-rw-r--r-- | src/mixer/MixerPlugin.hxx | 5 | ||||
-rw-r--r-- | src/mixer/plugins/AlsaMixerPlugin.cxx | 2 | ||||
-rw-r--r-- | src/mixer/plugins/OssMixerPlugin.cxx | 2 | ||||
-rw-r--r-- | src/mixer/plugins/PulseMixerPlugin.cxx | 31 | ||||
-rw-r--r-- | src/mixer/plugins/PulseMixerPlugin.hxx | 6 | ||||
-rw-r--r-- | src/mixer/plugins/RoarMixerPlugin.cxx | 8 | ||||
-rw-r--r-- | src/mixer/plugins/SoftwareMixerPlugin.cxx | 3 | ||||
-rw-r--r-- | src/mixer/plugins/WinmmMixerPlugin.cxx | 10 |
10 files changed, 33 insertions, 39 deletions
diff --git a/src/mixer/MixerControl.cxx b/src/mixer/MixerControl.cxx index e7b6e8395..568fad058 100644 --- a/src/mixer/MixerControl.cxx +++ b/src/mixer/MixerControl.cxx @@ -26,7 +26,7 @@ Mixer * mixer_new(EventLoop &event_loop, - const MixerPlugin &plugin, void *ao, + const MixerPlugin &plugin, AudioOutput &ao, const config_param ¶m, Error &error) { diff --git a/src/mixer/MixerControl.hxx b/src/mixer/MixerControl.hxx index cc2ccc087..46a9138e6 100644 --- a/src/mixer/MixerControl.hxx +++ b/src/mixer/MixerControl.hxx @@ -28,11 +28,12 @@ class Error; class Mixer; class EventLoop; +struct AudioOutput; struct MixerPlugin; struct config_param; Mixer * -mixer_new(EventLoop &event_loop, const MixerPlugin &plugin, void *ao, +mixer_new(EventLoop &event_loop, const MixerPlugin &plugin, AudioOutput &ao, const config_param ¶m, Error &error); diff --git a/src/mixer/MixerPlugin.hxx b/src/mixer/MixerPlugin.hxx index 27e59accf..bf9af14e3 100644 --- a/src/mixer/MixerPlugin.hxx +++ b/src/mixer/MixerPlugin.hxx @@ -28,6 +28,7 @@ #define MPD_MIXER_PLUGIN_HXX struct config_param; +struct AudioOutput; class Mixer; class EventLoop; class Error; @@ -36,13 +37,13 @@ struct MixerPlugin { /** * Alocates and configures a mixer device. * - * @param ao the pointer returned by AudioOutputPlugin.init + * @param ao the associated AudioOutput * @param param the configuration section * @param error_r location to store the error occurring, or * nullptr to ignore errors * @return a mixer object, or nullptr on error */ - Mixer *(*init)(EventLoop &event_loop, void *ao, + Mixer *(*init)(EventLoop &event_loop, AudioOutput &ao, const config_param ¶m, Error &error); diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx index 3a520725f..26007fef3 100644 --- a/src/mixer/plugins/AlsaMixerPlugin.cxx +++ b/src/mixer/plugins/AlsaMixerPlugin.cxx @@ -167,7 +167,7 @@ AlsaMixer::Configure(const config_param ¶m) } static Mixer * -alsa_mixer_init(EventLoop &event_loop, gcc_unused void *ao, +alsa_mixer_init(EventLoop &event_loop, gcc_unused AudioOutput &ao, const config_param ¶m, gcc_unused Error &error) { diff --git a/src/mixer/plugins/OssMixerPlugin.cxx b/src/mixer/plugins/OssMixerPlugin.cxx index fc86f292e..939fe0824 100644 --- a/src/mixer/plugins/OssMixerPlugin.cxx +++ b/src/mixer/plugins/OssMixerPlugin.cxx @@ -97,7 +97,7 @@ OssMixer::Configure(const config_param ¶m, Error &error) } static Mixer * -oss_mixer_init(gcc_unused EventLoop &event_loop, gcc_unused void *ao, +oss_mixer_init(gcc_unused EventLoop &event_loop, gcc_unused AudioOutput &ao, const config_param ¶m, Error &error) { diff --git a/src/mixer/plugins/PulseMixerPlugin.cxx b/src/mixer/plugins/PulseMixerPlugin.cxx index 10aa6a93a..b838de689 100644 --- a/src/mixer/plugins/PulseMixerPlugin.cxx +++ b/src/mixer/plugins/PulseMixerPlugin.cxx @@ -35,13 +35,13 @@ #include <assert.h> class PulseMixer final : public Mixer { - PulseOutput *output; + PulseOutput &output; bool online; struct pa_cvolume volume; public: - PulseMixer(PulseOutput *_output) + PulseMixer(PulseOutput &_output) :Mixer(pulse_mixer_plugin), output(_output), online(false) { @@ -130,7 +130,7 @@ PulseMixer::Update(pa_context *context, pa_stream *stream) } void -pulse_mixer_on_connect(gcc_unused PulseMixer *pm, +pulse_mixer_on_connect(gcc_unused PulseMixer &pm, struct pa_context *context) { pa_operation *o; @@ -151,41 +151,34 @@ pulse_mixer_on_connect(gcc_unused PulseMixer *pm, } void -pulse_mixer_on_disconnect(PulseMixer *pm) +pulse_mixer_on_disconnect(PulseMixer &pm) { - pm->Offline(); + pm.Offline(); } void -pulse_mixer_on_change(PulseMixer *pm, +pulse_mixer_on_change(PulseMixer &pm, struct pa_context *context, struct pa_stream *stream) { - pm->Update(context, stream); + pm.Update(context, stream); } static Mixer * -pulse_mixer_init(gcc_unused EventLoop &event_loop, void *ao, +pulse_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, gcc_unused const config_param ¶m, - Error &error) + gcc_unused Error &error) { - PulseOutput *po = (PulseOutput *)ao; - - if (ao == nullptr) { - error.Set(pulse_mixer_domain, - "The pulse mixer cannot work without the audio output"); - return nullptr; - } - + PulseOutput &po = (PulseOutput &)ao; PulseMixer *pm = new PulseMixer(po); - pulse_output_set_mixer(po, pm); + pulse_output_set_mixer(po, *pm); return pm; } PulseMixer::~PulseMixer() { - pulse_output_clear_mixer(output, this); + pulse_output_clear_mixer(output, *this); } int diff --git a/src/mixer/plugins/PulseMixerPlugin.hxx b/src/mixer/plugins/PulseMixerPlugin.hxx index 23cf03566..9b3a6daf1 100644 --- a/src/mixer/plugins/PulseMixerPlugin.hxx +++ b/src/mixer/plugins/PulseMixerPlugin.hxx @@ -25,12 +25,12 @@ struct pa_context; struct pa_stream; void -pulse_mixer_on_connect(PulseMixer *pm, pa_context *context); +pulse_mixer_on_connect(PulseMixer &pm, pa_context *context); void -pulse_mixer_on_disconnect(PulseMixer *pm); +pulse_mixer_on_disconnect(PulseMixer &pm); void -pulse_mixer_on_change(PulseMixer *pm, pa_context *context, pa_stream *stream); +pulse_mixer_on_change(PulseMixer &pm, pa_context *context, pa_stream *stream); #endif diff --git a/src/mixer/plugins/RoarMixerPlugin.cxx b/src/mixer/plugins/RoarMixerPlugin.cxx index d1ac8a6e3..7c2a25dfb 100644 --- a/src/mixer/plugins/RoarMixerPlugin.cxx +++ b/src/mixer/plugins/RoarMixerPlugin.cxx @@ -26,10 +26,10 @@ class RoarMixer final : public Mixer { /** the base mixer class */ - RoarOutput *self; + RoarOutput &self; public: - RoarMixer(RoarOutput *_output) + RoarMixer(RoarOutput &_output) :Mixer(roar_mixer_plugin), self(_output) {} @@ -46,11 +46,11 @@ public: }; static Mixer * -roar_mixer_init(gcc_unused EventLoop &event_loop, void *ao, +roar_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, gcc_unused const config_param ¶m, gcc_unused Error &error) { - return new RoarMixer((RoarOutput *)ao); + return new RoarMixer((RoarOutput &)ao); } int diff --git a/src/mixer/plugins/SoftwareMixerPlugin.cxx b/src/mixer/plugins/SoftwareMixerPlugin.cxx index 7dba2ee5e..78f0769ab 100644 --- a/src/mixer/plugins/SoftwareMixerPlugin.cxx +++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx @@ -84,7 +84,8 @@ public: }; static Mixer * -software_mixer_init(gcc_unused EventLoop &event_loop, gcc_unused void *ao, +software_mixer_init(gcc_unused EventLoop &event_loop, + gcc_unused AudioOutput &ao, gcc_unused const config_param ¶m, gcc_unused Error &error) { diff --git a/src/mixer/plugins/WinmmMixerPlugin.cxx b/src/mixer/plugins/WinmmMixerPlugin.cxx index d69480264..6b81fa095 100644 --- a/src/mixer/plugins/WinmmMixerPlugin.cxx +++ b/src/mixer/plugins/WinmmMixerPlugin.cxx @@ -31,10 +31,10 @@ #include <windows.h> class WinmmMixer final : public Mixer { - WinmmOutput *output; + WinmmOutput &output; public: - WinmmMixer(WinmmOutput *_output) + WinmmMixer(WinmmOutput &_output) :Mixer(winmm_mixer_plugin), output(_output) { } @@ -67,13 +67,11 @@ winmm_volume_encode(int volume) } static Mixer * -winmm_mixer_init(gcc_unused EventLoop &event_loop, void *ao, +winmm_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao, gcc_unused const config_param ¶m, gcc_unused Error &error) { - assert(ao != nullptr); - - return new WinmmMixer((WinmmOutput *)ao); + return new WinmmMixer((WinmmOutput &)ao); } int |