summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-05 00:02:02 +0100
committerMax Kellermann <max@duempel.org>2014-02-05 00:02:02 +0100
commite8938b1069739eca2bd2f27705c1c7783e834e59 (patch)
tree482330dbf228c12a60c9a401f0428cc4e292e234 /test
parent4a283330394fd2e1541a03bd312e5fadf54aa055 (diff)
MixerPlugin: add EventLoop& init() parameter
Diffstat (limited to 'test')
-rw-r--r--test/read_mixer.cxx8
-rw-r--r--test/run_output.cxx13
2 files changed, 7 insertions, 14 deletions
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 <string.h>
#include <unistd.h>
-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 <stdlib.h>
#include <stdio.h>
-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;