From 2dea689fa5bf00adfd36c9afb467bf75ea0be49a Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 11 Jan 2024 22:31:53 +0100 Subject: [PATCH] Make volume control logarithmic again --- src/ui/MxcMediaProxy.cpp | 3 ++- src/ui/MxcMediaProxy.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/MxcMediaProxy.cpp b/src/ui/MxcMediaProxy.cpp index 4127121b..39fdb155 100644 --- a/src/ui/MxcMediaProxy.cpp +++ b/src/ui/MxcMediaProxy.cpp @@ -43,7 +43,8 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent) nhlog::ui()->debug("Set audio output"); auto newOut = new QAudioOutput(this); newOut->setMuted(muted_); - newOut->setVolume(volume_); + newOut->setVolume(QAudio::convertVolume( + volume_, QAudio::LogarithmicVolumeScale, QAudio::LinearVolumeScale)); setAudioOutput(newOut); } }); diff --git a/src/ui/MxcMediaProxy.h b/src/ui/MxcMediaProxy.h index 2e8b2fa1..15606d36 100644 --- a/src/ui/MxcMediaProxy.h +++ b/src/ui/MxcMediaProxy.h @@ -59,7 +59,8 @@ public: { volume_ = val; if (auto output = audioOutput()) { - output->setVolume(val); + output->setVolume(QAudio::convertVolume( + val, QAudio::LogarithmicVolumeScale, QAudio::LinearVolumeScale)); } emit volumeChanged(); }