summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2013-01-21 00:48:08 +0200
committerTanu Kaskinen <tanuk@iki.fi>2013-03-13 15:17:49 +0200
commit759f82f17d81e38927c030d25370f21b7ce11a06 (patch)
tree608be030049b982a33fd29c2cdcff4f82247b6b2
parent56199172077b00a963b8fe1db6e0eed179b207b0 (diff)
downloadpulseaudio-759f82f17d81e38927c030d25370f21b7ce11a06.tar.gz
ladspa: Use volume sharing.
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.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/modules/module-ladspa-sink.c29
2 files changed, 2 insertions, 29 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7685e0c49..88e65cc86 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1596,7 +1596,7 @@ module_remap_source_la_LDFLAGS = $(MODULE_LDFLAGS)
module_remap_source_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 951cbc1b3..6a757e4e6 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;
@@ -683,16 +669,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;
@@ -1262,7 +1238,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) {
@@ -1274,8 +1250,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;
@@ -1309,7 +1283,6 @@ int pa__init(pa_module*m) {
u->sink_input->detach = sink_input_detach_cb;
u->sink_input->state_change = sink_input_state_change_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;