[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test4-108-g7af3833
Lennart Poettering
gitmailer-noreply at 0pointer.de
Tue Aug 18 18:37:45 PDT 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 8c31974f56ebbbfc1a4978150026acf77c32689e (commit)
- Log -----------------------------------------------------------------
7af3833 lirc: replace manual code by pa_cvolume_{inc|dec}()
2f54798 mmkbd: replace manual code by pa_cvolume_{inc|dec}()
-----------------------------------------------------------------------
Summary of changes:
src/modules/module-lirc.c | 22 +++---------------
src/modules/module-mmkbd-evdev.c | 43 ++++++++++++++++++-------------------
2 files changed, 25 insertions(+), 40 deletions(-)
-----------------------------------------------------------------------
commit 2f54798b1afdbe684dd1e5ba6d39a807c6afc8d8
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Aug 19 03:37:29 2009 +0200
mmkbd: replace manual code by pa_cvolume_{inc|dec}()
diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c
index 7be4870..516bf41 100644
--- a/src/modules/module-mmkbd-evdev.c
+++ b/src/modules/module-mmkbd-evdev.c
@@ -65,6 +65,8 @@ struct userdata {
pa_module *module;
};
+#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;
@@ -85,14 +87,27 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
}
if (ev.type == EV_KEY && (ev.value == 1 || ev.value == 2)) {
- enum { INVALID, UP, DOWN, MUTE_TOGGLE } volchange = INVALID;
+ enum {
+ INVALID,
+ UP,
+ DOWN,
+ MUTE_TOGGLE
+ } volchange = INVALID;
pa_log_debug("Key code=%u, value=%u", ev.code, ev.value);
switch (ev.code) {
- case KEY_VOLUMEDOWN: volchange = DOWN; break;
- case KEY_VOLUMEUP: volchange = UP; break;
- case KEY_MUTE: volchange = MUTE_TOGGLE; break;
+ case KEY_VOLUMEDOWN:
+ volchange = DOWN;
+ break;
+
+ case KEY_VOLUMEUP:
+ volchange = UP;
+ break;
+
+ case KEY_MUTE:
+ volchange = MUTE_TOGGLE;
+ break;
}
if (volchange != INVALID) {
@@ -101,36 +116,20 @@ 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;
case MUTE_TOGGLE:
-
pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE);
break;
commit 7af3833b7110c08d3717edb6018350d390e9d492
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Aug 19 03:37:42 2009 +0200
lirc: replace manual code by pa_cvolume_{inc|dec}()
diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c
index fdfdc79..d0e902f 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;
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list