From bf1b61023c41588dbf1f82b0bf07eb2012f2c8d8 Mon Sep 17 00:00:00 2001 From: Colin Wallace Date: Tue, 13 Mar 2018 22:00:58 -0700 Subject: [PATCH] Use ampToDbfs instead of 20*log10 x. The function's there (in lmms_math.h) for a reason :) --- src/gui/widgets/Fader.cpp | 2 +- src/gui/widgets/Knob.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index 0f75b8a7c..b634ba819 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -339,7 +339,7 @@ void Fader::updateTextFloat() if( ConfigManager::inst()->value( "app", "displaydbfs" ).toInt() && m_displayConversion ) { s_textFloat->setText( QString("Volume: %1 dBFS"). - arg( 20.0 * log10( model()->value() ), 3, 'f', 2 ) ); + arg( ampToDbfs( model()->value() ), 3, 'f', 2 ) ); } else { diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index bccf3721d..15ecf6e96 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -774,7 +774,7 @@ void Knob::enterValue() this, tr( "Set value" ), tr( "Please enter a new value between " "-96.0 dBFS and 6.0 dBFS:" ), - 20.0 * log10( model()->getRoundedValue() / 100.0 ), + ampToDbfs( model()->getRoundedValue() / 100.0 ), -96.0, 6.0, model()->getDigitCount(), &ok ); if( new_val <= -96.0 ) { @@ -826,7 +826,7 @@ QString Knob::displayValue() const ConfigManager::inst()->value( "app", "displaydbfs" ).toInt() ) { return m_description.trimmed() + QString( " %1 dBFS" ). - arg( 20.0 * log10( model()->getRoundedValue() / volumeRatio() ), + arg( ampToDbfs( model()->getRoundedValue() / volumeRatio() ), 3, 'f', 2 ); } return m_description.trimmed() + QString( " %1" ).