[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.13-407-g0f664b7

Lennart Poettering gitmailer-noreply at 0pointer.de
Tue Jan 27 14:56:03 PST 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  d1b754d99867e68dea71d4d6726949d0ce8ba0fa (commit)

- Log -----------------------------------------------------------------
0f664b7... instead of making the volume relative our own, let' pa_sink_input_new() do it for us
e439c18... make m-p-e-s use pa_cvolume_set_balance()
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-position-event-sounds.c |   34 ++-------------------------
 src/modules/module-stream-restore.c        |   15 ++++++++----
 2 files changed, 13 insertions(+), 36 deletions(-)

-----------------------------------------------------------------------

commit e439c18785fa0130ecff164e36e0096c4fd92866
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jan 27 23:52:35 2009 +0100

    make m-p-e-s use pa_cvolume_set_balance()

diff --git a/src/modules/module-position-event-sounds.c b/src/modules/module-position-event-sounds.c
index e75b1c5..8e4f4c3 100644
--- a/src/modules/module-position-event-sounds.c
+++ b/src/modules/module-position-event-sounds.c
@@ -58,30 +58,9 @@ struct userdata {
     pa_hook_slot *sink_input_fixate_hook_slot;
 };
 
-static pa_bool_t is_left(pa_channel_position_t p) {
-    return
-        p == PA_CHANNEL_POSITION_FRONT_LEFT ||
-        p == PA_CHANNEL_POSITION_REAR_LEFT ||
-        p == PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER ||
-        p == PA_CHANNEL_POSITION_SIDE_LEFT ||
-        p == PA_CHANNEL_POSITION_TOP_FRONT_LEFT ||
-        p == PA_CHANNEL_POSITION_TOP_REAR_LEFT;
-}
-
-static pa_bool_t is_right(pa_channel_position_t p) {
-    return
-        p == PA_CHANNEL_POSITION_FRONT_RIGHT ||
-        p == PA_CHANNEL_POSITION_REAR_RIGHT||
-        p == PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER ||
-        p == PA_CHANNEL_POSITION_SIDE_RIGHT ||
-        p == PA_CHANNEL_POSITION_TOP_FRONT_RIGHT ||
-        p == PA_CHANNEL_POSITION_TOP_REAR_RIGHT;
-}
-
 static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_input_new_data *data, struct userdata *u) {
     const char *hpos;
     double f;
-    unsigned c;
     char t[PA_CVOLUME_SNPRINT_MAX];
 
     pa_assert(data);
@@ -104,18 +83,11 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
     if (!data->virtual_volume_is_set) {
         pa_cvolume_reset(&data->virtual_volume, data->sample_spec.channels);
         data->virtual_volume_is_set = TRUE;
+        data->virtual_volume_is_absolute = FALSE;
     }
 
-    for (c = 0; c < data->sample_spec.channels; c++) {
-
-        if (is_left(data->channel_map.map[c]))
-            data->virtual_volume.values[c] =
-                pa_sw_volume_multiply(data->virtual_volume.values[c], (pa_volume_t) (PA_VOLUME_NORM * (1.0 - f)));
-
-        if (is_right(data->channel_map.map[c]))
-            data->virtual_volume.values[c] =
-                pa_sw_volume_multiply(data->virtual_volume.values[c], (pa_volume_t) (PA_VOLUME_NORM * f));
-    }
+    pa_cvolume_set_balance(&data->virtual_volume, &data->channel_map, f*2.0-1.0);
+    data->save_volume = FALSE;
 
     pa_log_debug("Final volume %s.", pa_cvolume_snprint(t, sizeof(t), &data->virtual_volume));
 

commit 0f664b736553f87bce6073b53c19f31046d67dfd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jan 27 23:55:22 2009 +0100

    instead of making the volume relative our own, let' pa_sink_input_new() do it for us

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index fe30e29..eb74bc0 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -392,15 +392,20 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
 
                     if (e->absolute_volume_valid &&
                         e->device_valid &&
-                        pa_streq(new_data->sink->name, e->device))
+                        pa_streq(new_data->sink->name, e->device)) {
+
                         v = e->absolute_volume;
-                    else if (e->relative_volume_valid) {
-                        pa_cvolume t = new_data->sink->virtual_volume;
-                        pa_sw_cvolume_multiply(&v, &e->relative_volume, pa_cvolume_remap(&t, &new_data->sink->channel_map, &e->channel_map));
+                        new_data->virtual_volume_is_absolute = TRUE;
+                    } else if (e->relative_volume_valid) {
+
+                        v = e->relative_volume;
+                        new_data->virtual_volume_is_absolute = FALSE;
                     }
 
-                } else if (e->relative_volume_valid)
+                } else if (e->relative_volume_valid) {
                     v = e->relative_volume;
+                    new_data->virtual_volume_is_absolute = FALSE;
+                }
 
                 if (v.channels > 0) {
                     pa_log_info("Restoring volume for sink input %s.", name);

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list