[pulseaudio-commits] 2 commits - src/modules src/pulse

Tanu Kaskinen tanuk at kemper.freedesktop.org
Thu Oct 19 20:14:25 UTC 2017


 src/modules/bluetooth/module-bluez5-device.c |    8 ++---
 src/pulse/volume.h                           |   39 ++++++++++++---------------
 2 files changed, 22 insertions(+), 25 deletions(-)

New commits:
commit 2f5429604675d7866c60c0531cb20a384be9d387
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Oct 15 16:56:45 2017 +0300

    volume: improve documentation
    
    Changes:
     - Mention that source outputs have volume too.
     - Don't claim that most distributions have flat volumes enabled.
     - Volumes use a cubic scale, not logarithmic.
     - Reword the warning about using the conversion functions on hardware
       volumes. The old wording gave the incorrect impression that hardware
       volumes could never be converted to dB or linear scale.

diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 8cf4fa45..03497f74 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -34,9 +34,9 @@
  *
  * \section overv_sec Overview
  *
- * Sinks, sources, sink inputs and samples can all have their own volumes.
- * To deal with these, The PulseAudio library contains a number of functions
- * that ease handling.
+ * Sinks, sources, sink inputs, source outputs and samples can all have their
+ * own volumes. To deal with these, The PulseAudio library contains a number of
+ * functions that ease handling.
  *
  * The basic volume type in PulseAudio is the \ref pa_volume_t type. Most of
  * the time, applications will use the aggregated pa_cvolume structure that
@@ -47,13 +47,12 @@
  *
  * There is no single well-defined meaning attached to the 100% volume for a
  * sink input. In fact, it depends on the server configuration. With flat
- * volumes enabled (the default in most Linux distributions), it means the
- * maximum volume that the sound hardware is capable of, which is usually so
- * high that you absolutely must not set sink input volume to 100% unless the
- * the user explicitly requests that (note that usually you shouldn't set the
- * volume anyway if the user doesn't explicitly request it, instead, let
- * PulseAudio decide the volume for the sink input). With flat volumes disabled
- * (the default in Ubuntu), the sink input volume is relative to the sink
+ * volumes enabled, it means the maximum volume that the sound hardware is
+ * capable of, which is usually so high that you absolutely must not set sink
+ * input volume to 100% unless the the user explicitly requests that (note that
+ * usually you shouldn't set the volume anyway if the user doesn't explicitly
+ * request it, instead, let PulseAudio decide the volume for the sink input).
+ * With flat volumes disabled the sink input volume is relative to the sink
  * volume, so 100% sink input volume means that the sink input is played at the
  * current sink volume level. In this case 100% is often a good default volume
  * for a sink input, although you still should let PulseAudio decide the
@@ -62,9 +61,9 @@
  *
  * \section calc_sec Calculations
  *
- * The volumes in PulseAudio are logarithmic in nature and applications
- * shouldn't perform calculations with them directly. Instead, they should
- * be converted to and from either dB or a linear scale:
+ * The volumes in PulseAudio are cubic in nature and applications shouldn't
+ * perform calculations with them directly. Instead, they should be converted
+ * to and from either dB or a linear scale:
  *
  * \li dB - pa_sw_volume_from_dB() / pa_sw_volume_to_dB()
  * \li Linear - pa_sw_volume_from_linear() / pa_sw_volume_to_linear()
@@ -72,14 +71,12 @@
  * For simple multiplication, pa_sw_volume_multiply() and
  * pa_sw_cvolume_multiply() can be used.
  *
- * Calculations can only be reliably performed on software volumes
- * as it is commonly unknown what scale hardware volumes relate to.
- *
- * The functions described above are only valid when used with
- * software volumes. Hence it is usually a better idea to treat all
- * volume values as opaque with a range from PA_VOLUME_MUTED (0%) to
- * PA_VOLUME_NORM (100%) and to refrain from any calculations with
- * them.
+ * It's often unknown what scale hardware volumes relate to. Don't use the
+ * above functions on sink and source volumes, unless the sink or source in
+ * question has the PA_SINK_DECIBEL_VOLUME or PA_SOURCE_DECIBEL_VOLUME flag
+ * set. The conversion functions are rarely needed anyway, most of the time
+ * it's sufficient to treat all volumes as opaque with a range from
+ * PA_VOLUME_MUTED (0%) to PA_VOLUME_NORM (100%).
  *
  * \section conv_sec Convenience Functions
  *

commit 85daab2725c8964d5e3d07089c4056435022d12e
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Sun Oct 15 13:29:42 2017 +0300

    bluetooth: set better priorities for profiles
    
    Since HSP had higher priority than A2DP, the default profile when
    connecting a new headset was HSP. To me it makes more sense to default
    to high-quality output. We already have some automatic policies to
    switch to HSP when it's needed.
    
    I also made the A2DP source and HSP/HFP gateway profiles have lower
    priority than the A2DP sink and HSP headset profiles. The A2DP source
    and HSP/HFP gateway profiles should only be activated if the remote
    device initiates audio streaming, so it makes sense to have lower
    priority for those profiles.
    
    BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103058

diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index 8a906393..fb991472 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1861,7 +1861,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
     switch (profile) {
     case PA_BLUETOOTH_PROFILE_A2DP_SINK:
         cp = pa_card_profile_new(name, _("High Fidelity Playback (A2DP Sink)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 10;
+        cp->priority = 40;
         cp->n_sinks = 1;
         cp->n_sources = 0;
         cp->max_sink_channels = 2;
@@ -1873,7 +1873,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
 
     case PA_BLUETOOTH_PROFILE_A2DP_SOURCE:
         cp = pa_card_profile_new(name, _("High Fidelity Capture (A2DP Source)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 10;
+        cp->priority = 20;
         cp->n_sinks = 0;
         cp->n_sources = 1;
         cp->max_sink_channels = 0;
@@ -1885,7 +1885,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
 
     case PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT:
         cp = pa_card_profile_new(name, _("Headset Head Unit (HSP/HFP)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 20;
+        cp->priority = 30;
         cp->n_sinks = 1;
         cp->n_sources = 1;
         cp->max_sink_channels = 1;
@@ -1898,7 +1898,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
 
     case PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY:
         cp = pa_card_profile_new(name, _("Headset Audio Gateway (HSP/HFP)"), sizeof(pa_bluetooth_profile_t));
-        cp->priority = 20;
+        cp->priority = 10;
         cp->n_sinks = 1;
         cp->n_sources = 1;
         cp->max_sink_channels = 1;



More information about the pulseaudio-commits mailing list