bluetooth: Move HSP_MAX_GAIN to header for reuse in n_volume_steps
authorMarijn Suijten <marijns95@gmail.com>
Sat, 27 Mar 2021 10:42:37 +0000 (11:42 +0100)
committerPulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org>
Mon, 17 May 2021 14:50:03 +0000 (14:50 +0000)
Instead of hardcoding the number `16`, use `HSP_MAX_GAIN + 1`.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/239>

src/modules/bluetooth/backend-native.c
src/modules/bluetooth/bluez5-util.h
src/modules/bluetooth/module-bluez5-device.c

index 3ad6bd7..79ab4db 100644 (file)
@@ -37,8 +37,6 @@
 #include "bluez5-util.h"
 #include "bt-codec-msbc.h"
 
-#define HSP_MAX_GAIN 15
-
 struct pa_bluetooth_backend {
   pa_core *core;
   pa_dbus_connection *connection;
index dd1f7bd..7bbfe62 100644 (file)
@@ -52,6 +52,8 @@
 #define PA_BLUETOOTH_UUID_HFP_HF      "0000111e-0000-1000-8000-00805f9b34fb"
 #define PA_BLUETOOTH_UUID_HFP_AG      "0000111f-0000-1000-8000-00805f9b34fb"
 
+#define HSP_MAX_GAIN 15
+
 typedef struct pa_bluetooth_transport pa_bluetooth_transport;
 typedef struct pa_bluetooth_device pa_bluetooth_device;
 typedef struct pa_bluetooth_adapter pa_bluetooth_adapter;
index 85a4191..2f937e6 100644 (file)
@@ -930,7 +930,7 @@ static void source_setup_volume_callback(pa_source *s) {
         pa_source_set_soft_volume(s, NULL);
 
         pa_source_set_set_volume_callback(s, source_set_volume_cb);
-        s->n_volume_steps = 16;
+        s->n_volume_steps = HSP_MAX_GAIN + 1;
     }
 }
 
@@ -1146,7 +1146,7 @@ static void sink_setup_volume_callback(pa_sink *s) {
         pa_sink_set_soft_volume(s, NULL);
 
         pa_sink_set_set_volume_callback(s, sink_set_volume_cb);
-        s->n_volume_steps = 16;
+        s->n_volume_steps = HSP_MAX_GAIN + 1;
     }
 }