[pulseaudio-discuss] [PATCH] ladspa: Use volume sharing.
Tanu Kaskinen
tanuk at iki.fi
Sun Jan 20 14:48:08 PST 2013
The previous volume handling could cause ear damage: by default the
ladspa sink volume was 100%, and with flat volumes that would cause
the master sink volume to jump to 100% too.
---
src/Makefile.am | 2 +-
src/modules/module-ladspa-sink.c | 29 +----------------------------
2 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8c04428..93d615f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1575,7 +1575,7 @@ module_remap_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_remap_sink_la_LIBADD = $(MODULE_LIBADD)
module_ladspa_sink_la_SOURCES = modules/module-ladspa-sink.c modules/ladspa.h
-module_ladspa_sink_la_CFLAGS = -DLADSPA_PATH=\"$(libdir)/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/local/lib64/ladspa:/usr/lib64/ladspa\" $(AM_CFLAGS)
+module_ladspa_sink_la_CFLAGS = -DLADSPA_PATH=\"$(libdir)/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa:/usr/local/lib64/ladspa:/usr/lib64/ladspa\" $(AM_CFLAGS) $(SERVER_CFLAGS)
module_ladspa_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
module_ladspa_sink_la_LIBADD = $(MODULE_LIBADD) $(LIBLTDL)
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 05fb215..b392c57 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -424,20 +424,6 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
}
/* Called from main context */
-static void sink_set_volume_cb(pa_sink *s) {
- struct userdata *u;
-
- pa_sink_assert_ref(s);
- pa_assert_se(u = s->userdata);
-
- if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) ||
- !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input)))
- return;
-
- pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE);
-}
-
-/* Called from main context */
static void sink_set_mute_cb(pa_sink *s) {
struct userdata *u;
@@ -693,16 +679,6 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
}
/* Called from main context */
-static void sink_input_volume_changed_cb(pa_sink_input *i) {
- struct userdata *u;
-
- pa_sink_input_assert_ref(i);
- pa_assert_se(u = i->userdata);
-
- pa_sink_volume_changed(u->sink, &i->volume);
-}
-
-/* Called from main context */
static void sink_input_mute_changed_cb(pa_sink_input *i) {
struct userdata *u;
@@ -1271,7 +1247,7 @@ int pa__init(pa_module*m) {
}
u->sink = pa_sink_new(m->core, &sink_data,
- (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)));
+ (master->flags & (PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY)) | PA_SINK_SHARE_VOLUME_WITH_MASTER);
pa_sink_new_data_done(&sink_data);
if (!u->sink) {
@@ -1283,8 +1259,6 @@ 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;
- pa_sink_enable_decibel_volume(u->sink, TRUE);
- pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb);
u->sink->userdata = u;
@@ -1319,7 +1293,6 @@ 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->mute_changed = sink_input_mute_changed_cb;
u->sink_input->userdata = u;
--
1.7.10.4
More information about the pulseaudio-discuss
mailing list