Hi,

My audio device has an IEC958 output as well as analog out.  I set up
two module-alsa-sink's so that i can direct streams to either output,
but I found that I couldn't control the volume of each sink
independently.  I was able to use asound.conf to create a softvol
control for the digital out.  However, module-alsa-sink doesn't have
any way to select a particular mixer control.  Since both pcms are
part of the same card they both end up using the Master control.

The attached patch adds an argument called "control" to the ALSA sink
module.  If this argument is specified it tries to use that control.
Otherwise it uses the current method of selecting Master, with PCM as
a fallback.

Best,
Kyle
--- pulseaudio-0.9.14/src/modules/module-alsa-sink.c	2009-01-12 17:11:38.000000000 -0600
+++ pulseaudio-0.9.14.new/src/modules/module-alsa-sink.c	2009-03-24 01:20:21.000000000 -0500
@@ -72,7 +72,8 @@
         "mmap=<enable memory mapping?> "
         "tsched=<enable system timer based scheduling mode?> "
         "tsched_buffer_size=<buffer size when using timer based scheduling> "
-        "tsched_buffer_watermark=<lower fill watermark>");
+        "tsched_buffer_watermark=<lower fill watermark> "
+        "control=<name of mixer control>");
 
 static const char* const valid_modargs[] = {
     "sink_name",
@@ -88,6 +89,7 @@
     "tsched",
     "tsched_buffer_size",
     "tsched_buffer_watermark",
+    "control",
     NULL
 };
 
@@ -1251,6 +1253,7 @@
     pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d;
     pa_usec_t usec;
     pa_sink_new_data data;
+    const char *control_name;
 
     snd_pcm_info_alloca(&pcm_info);
 
@@ -1408,9 +1411,15 @@
             }
         }
 
-        if (found)
-            if (!(u->mixer_elem = pa_alsa_find_elem(u->mixer_handle, "Master", "PCM")))
-                found = FALSE;
+        if (found) {
+            if ((control_name = pa_modargs_get_value(ma, "control", NULL))) {
+                if (!(u->mixer_elem = pa_alsa_find_elem(u->mixer_handle, control_name, NULL)))
+                    found = FALSE;
+            } else {
+                if (!(u->mixer_elem = pa_alsa_find_elem(u->mixer_handle, "Master", "PCM")))
+                    found = FALSE;
+            }
+        }
 
         if (!found) {
             snd_mixer_close(u->mixer_handle);
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to