diff options
author | Tanu Kaskinen <tanu.kaskinen@digia.com> | 2011-02-24 16:16:39 +0200 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2011-02-26 10:38:15 +0000 |
commit | 8702d15d0303fdb53e9aaf66656610741728d2e3 (patch) | |
tree | 36f6b3455d6ea1eb78a1ec554342afd7b5404521 /src/modules/module-virtual-sink.c | |
parent | c9c88fb8dcbd35774e7aaae09e057e1b8bcdc3d4 (diff) |
virtual-sink: Add a modarg for enabling volume sharing.
Diffstat (limited to 'src/modules/module-virtual-sink.c')
-rw-r--r-- | src/modules/module-virtual-sink.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c index 40bab5aa9..ceb26977b 100644 --- a/src/modules/module-virtual-sink.c +++ b/src/modules/module-virtual-sink.c @@ -57,6 +57,7 @@ PA_MODULE_USAGE( "rate=<sample rate> " "channels=<number of channels> " "channel_map=<channel map> " + "use_volume_sharing=<yes or no> " )); #define MEMBLOCKQ_MAXLENGTH (16*1024*1024) @@ -81,6 +82,7 @@ static const char* const valid_modargs[] = { "rate", "channels", "channel_map", + "use_volume_sharing", NULL }; @@ -478,6 +480,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; pa_bool_t *use_default = NULL; + pa_bool_t use_volume_sharing = FALSE; pa_assert(m); @@ -501,6 +504,11 @@ int pa__init(pa_module*m) { goto fail; } + if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", &use_volume_sharing) < 0) { + pa_log("use_volume_sharing= expects a boolean argument"); + goto fail; + } + u = pa_xnew0(struct userdata, 1); u->module = m; m->userdata = u; @@ -531,9 +539,8 @@ int pa__init(pa_module*m) { pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Virtual Sink %s on %s", sink_data.name, z ? z : master->name); } - u->sink = pa_sink_new(m->core, &sink_data, - PA_SINK_HW_MUTE_CTRL|PA_SINK_HW_VOLUME_CTRL|PA_SINK_DECIBEL_VOLUME| - (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY))); + u->sink = pa_sink_new(m->core, &sink_data, (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)) + | (use_volume_sharing ? PA_SINK_SHARE_VOLUME_WITH_MASTER : 0)); pa_sink_new_data_done(&sink_data); if (!u->sink) { @@ -545,7 +552,7 @@ int pa__init(pa_module*m) { u->sink->set_state = sink_set_state_cb; u->sink->update_requested_latency = sink_update_requested_latency_cb; u->sink->request_rewind = sink_request_rewind_cb; - u->sink->set_volume = sink_set_volume_cb; + u->sink->set_volume = use_volume_sharing ? NULL : sink_set_volume_cb; u->sink->set_mute = sink_set_mute_cb; u->sink->userdata = u; @@ -580,7 +587,7 @@ int pa__init(pa_module*m) { u->sink_input->state_change = sink_input_state_change_cb; u->sink_input->may_move_to = sink_input_may_move_to_cb; u->sink_input->moving = sink_input_moving_cb; - u->sink_input->volume_changed = sink_input_volume_changed_cb; + u->sink_input->volume_changed = use_volume_sharing ? NULL : sink_input_volume_changed_cb; u->sink_input->mute_changed = sink_input_mute_changed_cb; u->sink_input->userdata = u; |