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

Lennart Poettering gitmailer-noreply at 0pointer.de
Mon Feb 2 19:07:00 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  273926184709423443831dc53b11c3cf68b0cdad (commit)

- Log -----------------------------------------------------------------
fc31d21... when moving a sink between sinks make volume relative
554c818... before applying balance/fade check it actually makes sense
f9696c0... add a macro definition for each error code
-----------------------------------------------------------------------

Summary of changes:
 src/pulse/def.h            |   28 ++++++++++++++++++++++++++++
 src/pulse/volume.c         |   12 ++++++++++++
 src/pulse/volume.h         |   21 ++++++++++++++-------
 src/pulsecore/sink-input.c |   16 ++++++++++++++--
 4 files changed, 68 insertions(+), 9 deletions(-)

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

commit f9696c0e7fb38b77dedeafb0e3c4dbdf6df6c4ff
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Feb 3 03:38:40 2009 +0100

    add a macro definition for each error code

diff --git a/src/pulse/def.h b/src/pulse/def.h
index 1acf19a..6149888 100644
--- a/src/pulse/def.h
+++ b/src/pulse/def.h
@@ -368,6 +368,34 @@ enum {
     PA_ERR_MAX                     /**< Not really an error but the first invalid error code */
 };
 
+/** \cond fulldocs */
+#define PA_OK PA_OK
+#define PA_ERR_ACCESS PA_ERR_ACCESS
+#define PA_ERR_COMMAND PA_ERR_COMMAND
+#define PA_ERR_INVALID PA_ERR_INVALID
+#define PA_ERR_EXIST PA_ERR_EXIST
+#define PA_ERR_NOENTITY PA_ERR_NOENTITY
+#define PA_ERR_CONNECTIONREFUSED PA_ERR_CONNECTIONREFUSED
+#define PA_ERR_PROTOCOL PA_ERR_PROTOCOL
+#define PA_ERR_TIMEOUT PA_ERR_TIMEOUT
+#define PA_ERR_AUTHKEY PA_ERR_AUTHKEY
+#define PA_ERR_INTERNAL PA_ERR_INTERNAL
+#define PA_ERR_CONNECTIONTERMINATED PA_ERR_CONNECTIONTERMINATED
+#define PA_ERR_KILLED PA_ERR_KILLED
+#define PA_ERR_INVALIDSERVER PA_ERR_INVALIDSERVER
+#define PA_ERR_MODINITFAILED PA_ERR_MODINITFAILED
+#define PA_ERR_BADSTATE PA_ERR_BADSTATE
+#define PA_ERR_NODATA PA_ERR_NODATA
+#define PA_ERR_VERSION PA_ERR_VERSION
+#define PA_ERR_TOOLARGE PA_ERR_TOOLARGE
+#define PA_ERR_NOTSUPPORTED PA_ERR_NOTSUPPORTED
+#define PA_ERR_UNKNOWN PA_ERR_UNKNOWN
+#define PA_ERR_NOEXTENSION PA_ERR_NOEXTENSION
+#define PA_ERR_OBSOLETE PA_ERR_OBSOLETE
+#define PA_ERR_NOTIMPLEMENTED PA_ERR_NOTIMPLEMENTED
+#define PA_ERR_MAX PA_ERR_MAX
+/** \endcond */
+
 /** Subscription event mask, as used by pa_context_subscribe() */
 typedef enum pa_subscription_mask {
     PA_SUBSCRIPTION_MASK_NULL = 0x0000U,

commit 554c818d21acb66dbfdd477165f6a25f88c334f1
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Feb 3 04:05:41 2009 +0100

    before applying balance/fade check it actually makes sense

diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index ba2ee8f..01a28e8 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -467,6 +467,9 @@ float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) {
     pa_assert(map);
     pa_assert(map->channels == v->channels);
 
+    if (!pa_channel_map_can_balance(map))
+        return 0.0f;
+
     get_avg_lr(map, v, &left, &right);
 
     if (left == right)
@@ -497,6 +500,9 @@ pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, flo
     pa_assert(new_balance >= -1.0f);
     pa_assert(new_balance <= 1.0f);
 
+    if (!pa_channel_map_can_balance(map))
+        return v;
+
     get_avg_lr(map, v, &left, &right);
 
     m = PA_MAX(left, right);
@@ -584,6 +590,9 @@ float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) {
     pa_assert(map);
     pa_assert(map->channels == v->channels);
 
+    if (!pa_channel_map_can_fade(map))
+        return 0.0f;
+
     get_avg_fr(map, v, &front, &rear);
 
     if (front == rear)
@@ -605,6 +614,9 @@ pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float
     pa_assert(new_fade >= -1.0f);
     pa_assert(new_fade <= 1.0f);
 
+    if (!pa_channel_map_can_fade(map))
+        return v;
+
     get_avg_fr(map, v, &front, &rear);
 
     m = PA_MAX(front, rear);
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 8eef467..9ad3e9b 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -236,7 +236,9 @@ int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_
 
 /** Calculate a 'balance' value for the specified volume with the
  * specified channel map. The return value will range from -1.0f
- * (left) to +1.0f (right) \since 0.9.15 */
+ * (left) to +1.0f (right). If no balance value is applicable to this
+ * channel map the return value will always be 0.0f. See
+ * pa_channel_map_can_balance(). \since 0.9.15 */
 float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
 
 /** Adjust the 'balance' value for the specified volume with the
@@ -245,22 +247,27 @@ float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) PA_
  * operation might not be reversible! Also, after this call
  * pa_cvolume_get_balance() is not guaranteed to actually return the
  * requested balance value (e.g. when the input volume was zero anyway for
- * all channels) \since 0.9.15 */
+ * all channels). If no balance value is applicable to
+ * this channel map the volume will not be modified. See
+ * pa_channel_map_can_balance(). \since 0.9.15 */
 pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, float new_balance);
 
 /** Calculate a 'fade' value (i.e. 'balance' between front and rear)
  * for the specified volume with the specified channel map. The return
- * value will range from -1.0f (rear) to +1.0f (left) \since
- * 0.9.15 */
+ * value will range from -1.0f (rear) to +1.0f (left). If no fade
+ * value is applicable to this channel map the return value will
+ * always be 0.0f. See pa_channel_map_can_fade(). \since 0.9.15 */
 float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
 
 /** Adjust the 'fade' value (i.e. 'balance' between front and rear)
  * for the specified volume with the specified channel map. v will be
  * modified in place and returned. The balance is a value between
  * -1.0f and +1.0f. This operation might not be reversible! Also,
- * after this call pa_cvolume_get_fade() is not guaranteed to
- * actually return the requested fade value (e.g. when the input volume
- * was zero anyway for all channels) \since 0.9.15 */
+ * after this call pa_cvolume_get_fade() is not guaranteed to actually
+ * return the requested fade value (e.g. when the input volume was
+ * zero anyway for all channels). If no fade value is applicable to
+ * this channel map the volume will not be modified. See
+ * pa_channel_map_can_fade(). \since 0.9.15 */
 pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float new_fade);
 
 /** Scale the passed pa_cvolume structure so that the maximum volume

commit fc31d21353ef3b50c6b47371b8cb10c173bc3a14
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Feb 3 04:06:52 2009 +0100

    when moving a sink between sinks make volume relative

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index a3a29e9..fc87d5d 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1073,9 +1073,15 @@ int pa_sink_input_start_move(pa_sink_input *i) {
     if (pa_sink_input_get_state(i) == PA_SINK_INPUT_CORKED)
         pa_assert_se(i->sink->n_corked-- >= 1);
 
-    /* We might need to update the sink's volume if we are in flat volume mode. */
     if (i->sink->flags & PA_SINK_FLAT_VOLUME) {
         pa_cvolume new_volume;
+
+        /* Make the absolute volume relative */
+        i->virtual_volume = i->soft_volume;
+        pa_cvolume_reset(&i->soft_volume, i->sample_spec.channels);
+
+        /* We might need to update the sink's volume if we are in flat
+         * volume mode. */
         pa_sink_update_flat_volume(i->sink, &new_volume);
         pa_sink_set_volume(i->sink, &new_volume, FALSE, FALSE);
     }
@@ -1156,9 +1162,15 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
 
     pa_sink_update_status(dest);
 
-    /* We might need to update the sink's volume if we are in flat volume mode. */
     if (i->sink->flags & PA_SINK_FLAT_VOLUME) {
         pa_cvolume new_volume;
+
+        /* Make relative volume absolute again */
+        pa_cvolume t = dest->virtual_volume;
+        pa_cvolume_remap(&t, &dest->channel_map, &i->channel_map);
+        pa_sw_cvolume_multiply(&i->virtual_volume, &i->virtual_volume, &t);
+
+        /* We might need to update the sink's volume if we are in flat volume mode. */
         pa_sink_update_flat_volume(i->sink, &new_volume);
         pa_sink_set_volume(i->sink, &new_volume, FALSE, FALSE);
     }

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list