aboutsummaryrefslogtreecommitdiffstats
path: root/test/read_mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/read_mixer.c')
-rw-r--r--test/read_mixer.c70
1 files changed, 64 insertions, 6 deletions
diff --git a/test/read_mixer.c b/test/read_mixer.c
index be6864ba1..208503618 100644
--- a/test/read_mixer.c
+++ b/test/read_mixer.c
@@ -19,6 +19,10 @@
#include "mixer_control.h"
#include "mixer_list.h"
+#include "filter_registry.h"
+#include "pcm_volume.h"
+#include "event_pipe.h"
+#include "config.h"
#include <glib.h>
@@ -26,8 +30,55 @@
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_PULSE
+#include "output/pulse_output_plugin.h"
+
+void
+pulse_output_set_mixer(G_GNUC_UNUSED struct pulse_output *po,
+ G_GNUC_UNUSED struct pulse_mixer *pm)
+{
+}
+
+void
+pulse_output_clear_mixer(G_GNUC_UNUSED struct pulse_output *po,
+ G_GNUC_UNUSED struct pulse_mixer *pm)
+{
+}
+
+bool
+pulse_output_set_volume(G_GNUC_UNUSED struct pulse_output *po,
+ G_GNUC_UNUSED const struct pa_cvolume *volume,
+ G_GNUC_UNUSED GError **error_r)
+{
+ return false;
+}
+
+#endif
+
+void
+event_pipe_emit(G_GNUC_UNUSED enum pipe_event event)
+{
+}
+
+const struct filter_plugin *
+filter_plugin_by_name(G_GNUC_UNUSED const char *name)
+{
+ assert(false);
+ return NULL;
+}
+
+bool
+pcm_volume(G_GNUC_UNUSED void *buffer, G_GNUC_UNUSED int length,
+ G_GNUC_UNUSED const struct audio_format *format,
+ G_GNUC_UNUSED int volume)
+{
+ assert(false);
+ return false;
+}
+
int main(int argc, G_GNUC_UNUSED char **argv)
{
+ GError *error = NULL;
struct mixer *mixer;
bool success;
int volume;
@@ -39,27 +90,34 @@ int main(int argc, G_GNUC_UNUSED char **argv)
g_thread_init(NULL);
- mixer = mixer_new(&alsa_mixer, NULL);
+ mixer = mixer_new(&alsa_mixer_plugin, NULL, NULL, &error);
if (mixer == NULL) {
- g_printerr("mixer_new() failed\n");
+ g_printerr("mixer_new() failed: %s\n", error->message);
+ g_error_free(error);
return 2;
}
- success = mixer_open(mixer);
+ success = mixer_open(mixer, &error);
if (!success) {
mixer_free(mixer);
- g_printerr("failed to open the mixer\n");
+ g_printerr("failed to open the mixer: %s\n", error->message);
+ g_error_free(error);
return 2;
}
- volume = mixer_get_volume(mixer);
+ volume = mixer_get_volume(mixer, &error);
mixer_close(mixer);
mixer_free(mixer);
assert(volume >= -1 && volume <= 100);
if (volume < 0) {
- g_printerr("failed to read volume\n");
+ if (error != NULL) {
+ g_printerr("failed to read volume: %s\n",
+ error->message);
+ g_error_free(error);
+ } else
+ g_printerr("failed to read volume\n");
return 2;
}