]> code.delx.au - pulseaudio/blobdiff - src/modules/module-position-event-sounds.c
filter-apply: Move sink/source unlink callbacks before m-s-r
[pulseaudio] / src / modules / module-position-event-sounds.c
index 7221b14f089e5254258d3957cb9e25fe411ed85b..ce37588c42a85fb37b0f784c6dd69a881a28219e 100644 (file)
 #endif
 
 #include <unistd.h>
-#include <string.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <pulse/xmalloc.h>
 #include <pulse/volume.h>
 #include <pulse/channelmap.h>
 
-#include <pulsecore/core-error.h>
 #include <pulsecore/module.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/modargs.h>
@@ -74,7 +71,7 @@ static int parse_pos(const char *pos, double *f) {
 }
 
 static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_input_new_data *data, struct userdata *u) {
-    const char *hpos, *vpos, *role;
+    const char *hpos, *vpos, *role, *id;
     double f;
     char t[PA_CVOLUME_SNPRINT_MAX];
     pa_cvolume v;
@@ -87,6 +84,22 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
     if (!pa_streq(role, "event"))
         return PA_HOOK_OK;
 
+    if ((id = pa_proplist_gets(data->proplist, PA_PROP_EVENT_ID))) {
+
+        /* The test sounds should never be positioned in space, since
+         * they might be triggered themselves to configure the speakers
+         * in space, which we don't want to mess up. */
+
+        if (pa_startswith(id, "audio-channel-"))
+            return PA_HOOK_OK;
+
+        if (pa_streq(id, "audio-volume-change"))
+            return PA_HOOK_OK;
+
+        if (pa_streq(id, "audio-test-signal"))
+            return PA_HOOK_OK;
+    }
+
     if (!(hpos = pa_proplist_gets(data->proplist, PA_PROP_EVENT_MOUSE_HPOS)))
         hpos = pa_proplist_gets(data->proplist, PA_PROP_WINDOW_HPOS);
 
@@ -148,7 +161,7 @@ fail:
     if (ma)
         pa_modargs_free(ma);
 
-    return  -1;
+    return -1;
 }
 
 void pa__done(pa_module*m) {