Make volume control logarithmic again

This commit is contained in:
Nicolas Werner 2024-01-11 22:31:53 +01:00
parent 183ac0f63c
commit 2dea689fa5
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 4 additions and 2 deletions

View file

@ -43,7 +43,8 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
nhlog::ui()->debug("Set audio output"); nhlog::ui()->debug("Set audio output");
auto newOut = new QAudioOutput(this); auto newOut = new QAudioOutput(this);
newOut->setMuted(muted_); newOut->setMuted(muted_);
newOut->setVolume(volume_); newOut->setVolume(QAudio::convertVolume(
volume_, QAudio::LogarithmicVolumeScale, QAudio::LinearVolumeScale));
setAudioOutput(newOut); setAudioOutput(newOut);
} }
}); });

View file

@ -59,7 +59,8 @@ public:
{ {
volume_ = val; volume_ = val;
if (auto output = audioOutput()) { if (auto output = audioOutput()) {
output->setVolume(val); output->setVolume(QAudio::convertVolume(
val, QAudio::LogarithmicVolumeScale, QAudio::LinearVolumeScale));
} }
emit volumeChanged(); emit volumeChanged();
} }