From e8938b1069739eca2bd2f27705c1c7783e834e59 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 5 Feb 2014 00:02:02 +0100 Subject: MixerPlugin: add EventLoop& init() parameter --- test/read_mixer.cxx | 8 ++------ test/run_output.cxx | 13 +++++-------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/read_mixer.cxx b/test/read_mixer.cxx index 095d9945d..4849b7a8c 100644 --- a/test/read_mixer.cxx +++ b/test/read_mixer.cxx @@ -35,8 +35,6 @@ #include #include -EventLoop *main_loop; - #ifdef HAVE_PULSE #include "output/plugins/PulseOutputPlugin.hxx" @@ -115,10 +113,10 @@ int main(int argc, gcc_unused char **argv) g_thread_init(NULL); #endif - main_loop = new EventLoop; + EventLoop event_loop; Error error; - Mixer *mixer = mixer_new(&alsa_mixer_plugin, nullptr, + Mixer *mixer = mixer_new(event_loop, &alsa_mixer_plugin, nullptr, config_param(), error); if (mixer == NULL) { LogError(error, "mixer_new() failed"); @@ -135,8 +133,6 @@ int main(int argc, gcc_unused char **argv) mixer_close(mixer); mixer_free(mixer); - delete main_loop; - assert(volume >= -1 && volume <= 100); if (volume < 0) { diff --git a/test/run_output.cxx b/test/run_output.cxx index 23fd1ad3a..6a6400477 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -45,8 +45,6 @@ #include #include -EventLoop *main_loop; - void GlobalEvents::Emit(gcc_unused Event event) { @@ -80,7 +78,7 @@ PlayerControl::PlayerControl(gcc_unused MultipleOutputs &_outputs, PlayerControl::~PlayerControl() {} static AudioOutput * -load_audio_output(const char *name) +load_audio_output(EventLoop &event_loop, const char *name) { const struct config_param *param; @@ -95,7 +93,8 @@ load_audio_output(const char *name) Error error; AudioOutput *ao = - audio_output_new(*param, dummy_player_control, error); + audio_output_new(event_loop, *param, dummy_player_control, + error); if (ao == nullptr) LogError(error); @@ -189,14 +188,14 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - main_loop = new EventLoop(); + EventLoop event_loop; io_thread_init(); io_thread_start(); /* initialize the audio output */ - AudioOutput *ao = load_audio_output(argv[2]); + AudioOutput *ao = load_audio_output(event_loop, argv[2]); if (ao == NULL) return 1; @@ -219,8 +218,6 @@ int main(int argc, char **argv) io_thread_deinit(); - delete main_loop; - config_global_finish(); return success ? EXIT_SUCCESS : EXIT_FAILURE; -- cgit v1.2.3