From d6f598ab3e1cdb71dc3b408592d06bba23f53a71 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Aug 2009 02:29:59 +0200 Subject: udev: allow passing of ignore_dB= parameter to alsa modules --- src/modules/module-lirc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/module-lirc.c') diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c index 06efeb8f..2bb8014d 100644 --- a/src/modules/module-lirc.c +++ b/src/modules/module-lirc.c @@ -133,7 +133,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event cv.values[i] = PA_VOLUME_MAX; } - pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE, TRUE); + pa_sink_set_volume(s, &cv, TRUE, TRUE); break; case DOWN: @@ -144,7 +144,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event cv.values[i] = PA_VOLUME_MUTED; } - pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE, TRUE); + pa_sink_set_volume(s, &cv, TRUE, TRUE); break; case MUTE: -- cgit From 8c31974f56ebbbfc1a4978150026acf77c32689e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Aug 2009 02:55:02 +0200 Subject: sink: volume handling rework, new flat volume logic - We now implement a logic where the sink maintains two distinct volumes: the 'reference' volume which is shown to the users, and the 'real' volume, which is configured to the hardware. The latter is configured to the max of all streams. Volume changes on sinks are propagated back to the streams proportional to the reference volume change. Volume changes on sink inputs are forwarded to the sink by 'pushing' the volume if necessary. This renames the old 'virtual_volume' to 'real_volume'. The 'reference_volume' is now the one exposed to users. By this logic the sink volume visible to the user, will always be the "upper" boundary for everything that is played. Saved/restored stream volumes are measured relative to this boundary, the factor here is always < 1.0. - introduce accuracy for sink volumes, similar to the accuracy we already have for source volumes. - other cleanups. --- src/modules/module-lirc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules/module-lirc.c') diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c index 2bb8014d..fdfdc797 100644 --- a/src/modules/module-lirc.c +++ b/src/modules/module-lirc.c @@ -120,7 +120,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event pa_log("Failed to get sink '%s'", u->sink_name); else { int i; - pa_cvolume cv = *pa_sink_get_volume(s, FALSE, FALSE); + pa_cvolume cv = *pa_sink_get_volume(s, FALSE); #define DELTA (PA_VOLUME_NORM/20) -- cgit From 7af3833b7110c08d3717edb6018350d390e9d492 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Aug 2009 03:37:42 +0200 Subject: lirc: replace manual code by pa_cvolume_{inc|dec}() --- src/modules/module-lirc.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'src/modules/module-lirc.c') diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c index fdfdc797..d0e902f6 100644 --- a/src/modules/module-lirc.c +++ b/src/modules/module-lirc.c @@ -63,6 +63,8 @@ struct userdata { float mute_toggle_save; }; +#define DELTA (PA_VOLUME_NORM/20) + static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event_flags_t events, void*userdata) { struct userdata *u = userdata; char *name = NULL, *code = NULL; @@ -119,31 +121,16 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) pa_log("Failed to get sink '%s'", u->sink_name); else { - int i; pa_cvolume cv = *pa_sink_get_volume(s, FALSE); -#define DELTA (PA_VOLUME_NORM/20) - switch (volchange) { case UP: - for (i = 0; i < cv.channels; i++) { - if (cv.values[i] < PA_VOLUME_MAX - DELTA) - cv.values[i] += DELTA; - else - cv.values[i] = PA_VOLUME_MAX; - } - + pa_cvolume_inc(&cv, DELTA); pa_sink_set_volume(s, &cv, TRUE, TRUE); break; case DOWN: - for (i = 0; i < cv.channels; i++) { - if (cv.values[i] > DELTA) - cv.values[i] -= DELTA; - else - cv.values[i] = PA_VOLUME_MUTED; - } - + pa_cvolume_dec(&cv, DELTA); pa_sink_set_volume(s, &cv, TRUE, TRUE); break; @@ -156,7 +143,6 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event break; case MUTE_TOGGLE: - pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE); break; -- cgit