From 9fa643484cad15a9dfd91a39a4787c4c3d310131 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 25 Dec 2021 20:53:11 +1100 Subject: [PATCH] [client] audio/pw: use scaling forumula provided by quantum --- client/audiodevs/PipeWire/pipewire.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/audiodevs/PipeWire/pipewire.c b/client/audiodevs/PipeWire/pipewire.c index e6fe4625..8c9d4380 100644 --- a/client/audiodevs/PipeWire/pipewire.c +++ b/client/audiodevs/PipeWire/pipewire.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "common/debug.h" #include "common/ringbuffer.h" @@ -244,10 +245,7 @@ static void pipewire_volume(int channels, const uint16_t volume[]) float param[channels]; for(int i = 0; i < channels; ++i) - { - //TODO: the scaling here is wrong and needs fixing - param[i] = (1.0f / 65535.0f) * volume[i]; - } + param[i] = 9.3234e-7 * pow(1.000211902, volume[i]) - 0.000172787; pw_thread_loop_lock(pw.thread); pw_stream_set_control(pw.stream, SPA_PROP_channelVolumes, channels, param, 0);