summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKyle Cronan <kyle@pbx.org>2009-03-30 12:49:37 -0500
committerLennart Poettering <lennart@poettering.net>2009-03-31 00:56:41 +0200
commit92ae5f1a742d52a72562251a0b550bf39af28d8c (patch)
treedaaa427a7a9d7e2a8301818e63d0516a3aa75682 /src
parentfacc46d5bfe8120424e9cb0679da91a35c9003ec (diff)
Specifying ALSA mixer control
On Fri, Mar 27, 2009 at 7:21 AM, Lennart Poettering <lennart@poettering.net> wrote: >> I tried installing the latest git sources on my Ubuntu Jaunty box but >> it just broke sound in all my applications.  For my own purposes, I'm >> going to need to start with the Ubuntu-patched 0.9.14.  However, if >> you are willing to accept this patch I will forward port it so that it >> applies to the latest sources.  It's a completely harmless change, so >> why not apply it? > > Yes, I am happy to apply it. Could you please update it for current git? > Great. An updated patch is attached. For symmetry, I added this option to the alsa source module as well. The Ubuntu folks have customized pulse so much that it is difficult for me to get this version working on my system. For this patch I have only made sure that it compiles. But it does pretty much the same thing as the one for 0.9.14, which is working great for me. Thanks, Kyle
Diffstat (limited to 'src')
-rw-r--r--src/modules/alsa/alsa-sink.c2
-rw-r--r--src/modules/alsa/alsa-source.c2
-rw-r--r--src/modules/alsa/alsa-util.c13
-rw-r--r--src/modules/alsa/alsa-util.h2
-rw-r--r--src/modules/alsa/module-alsa-sink.c4
-rw-r--r--src/modules/alsa/module-alsa-source.c4
6 files changed, 19 insertions, 8 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 0296f64e..0dc0e2b3 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1644,7 +1644,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
/* ALSA might tweak the sample spec, so recalculate the frame size */
frame_size = pa_frame_size(&ss);
- pa_alsa_find_mixer_and_elem(u->pcm_handle, &u->mixer_handle, &u->mixer_elem);
+ pa_alsa_find_mixer_and_elem(u->pcm_handle, &u->mixer_handle, &u->mixer_elem, pa_modargs_get_value(ma, "control", NULL));
pa_sink_new_data_init(&data);
data.driver = driver;
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index ef365a21..348cd082 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1496,7 +1496,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
/* ALSA might tweak the sample spec, so recalculate the frame size */
frame_size = pa_frame_size(&ss);
- pa_alsa_find_mixer_and_elem(u->pcm_handle, &u->mixer_handle, &u->mixer_elem);
+ pa_alsa_find_mixer_and_elem(u->pcm_handle, &u->mixer_handle, &u->mixer_elem, pa_modargs_get_value(ma, "control", NULL));
pa_source_new_data_init(&data);
data.driver = driver;
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 2d0ca107..5b5270b8 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -1094,7 +1094,8 @@ success:
int pa_alsa_find_mixer_and_elem(
snd_pcm_t *pcm,
snd_mixer_t **_m,
- snd_mixer_elem_t **_e) {
+ snd_mixer_elem_t **_e,
+ const char *control_name) {
int err;
snd_mixer_t *m;
@@ -1146,11 +1147,17 @@ int pa_alsa_find_mixer_and_elem(
switch (snd_pcm_stream(pcm)) {
case SND_PCM_STREAM_PLAYBACK:
- e = pa_alsa_find_elem(m, "Master", "PCM", TRUE);
+ if (control_name)
+ e = pa_alsa_find_elem(m, control_name, NULL, TRUE);
+ else
+ e = pa_alsa_find_elem(m, "Master", "PCM", TRUE);
break;
case SND_PCM_STREAM_CAPTURE:
- e = pa_alsa_find_elem(m, "Capture", "Mic", FALSE);
+ if (control_name)
+ e = pa_alsa_find_elem(m, control_name, NULL, FALSE);
+ else
+ e = pa_alsa_find_elem(m, "Capture", "Mic", FALSE);
break;
default:
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 68496d51..5cad2958 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -54,7 +54,7 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min);
int pa_alsa_prepare_mixer(snd_mixer_t *mixer, const char *dev);
snd_mixer_elem_t *pa_alsa_find_elem(snd_mixer_t *mixer, const char *name, const char *fallback, pa_bool_t playback);
-int pa_alsa_find_mixer_and_elem(snd_pcm_t *pcm, snd_mixer_t **_m, snd_mixer_elem_t **_e);
+int pa_alsa_find_mixer_and_elem(snd_pcm_t *pcm, snd_mixer_t **_m, snd_mixer_elem_t **_e, const char *control_name);
typedef struct pa_alsa_profile_info {
pa_channel_map map;
diff --git a/src/modules/alsa/module-alsa-sink.c b/src/modules/alsa/module-alsa-sink.c
index c728a446..8e600ab8 100644
--- a/src/modules/alsa/module-alsa-sink.c
+++ b/src/modules/alsa/module-alsa-sink.c
@@ -52,7 +52,8 @@ PA_MODULE_USAGE(
"tsched=<enable system timer based scheduling mode?> "
"tsched_buffer_size=<buffer size when using timer based scheduling> "
"tsched_buffer_watermark=<lower fill watermark> "
- "ignore_dB=<ignore dB information from the device?>");
+ "ignore_dB=<ignore dB information from the device?> "
+ "control=<name of mixer control>");
static const char* const valid_modargs[] = {
"name",
@@ -70,6 +71,7 @@ static const char* const valid_modargs[] = {
"tsched_buffer_size",
"tsched_buffer_watermark",
"ignore_dB",
+ "control",
NULL
};
diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c
index 6188019f..e6b27b3d 100644
--- a/src/modules/alsa/module-alsa-source.c
+++ b/src/modules/alsa/module-alsa-source.c
@@ -76,7 +76,8 @@ PA_MODULE_USAGE(
"tsched=<enable system timer based scheduling mode?> "
"tsched_buffer_size=<buffer size when using timer based scheduling> "
"tsched_buffer_watermark=<upper fill watermark> "
- "ignore_dB=<ignore dB information from the device?>");
+ "ignore_dB=<ignore dB information from the device?> "
+ "control=<name of mixer control>");
static const char* const valid_modargs[] = {
"name",
@@ -94,6 +95,7 @@ static const char* const valid_modargs[] = {
"tsched_buffer_size",
"tsched_buffer_watermark",
"ignore_dB",
+ "control",
NULL
};