From f67eaaced7f82765a26273702611b51762cfbcd8 Mon Sep 17 00:00:00 2001 From: Dave French Date: Wed, 31 Dec 2014 00:14:44 +0000 Subject: [PATCH] EQ changed gain faders to use dB --- plugins/Eq/EqControls.cpp | 6 ++++-- plugins/Eq/EqControlsDialog.cpp | 5 +++++ plugins/Eq/EqEffect.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/Eq/EqControls.cpp b/plugins/Eq/EqControls.cpp index 0de83a3ba..833ea7080 100644 --- a/plugins/Eq/EqControls.cpp +++ b/plugins/Eq/EqControls.cpp @@ -32,8 +32,8 @@ EqControls::EqControls( EqEffect *effect ) : EffectControls( effect ), m_effect( effect ), - m_inGainModel( 1.0, 0.0, 2.0, 0.001, this, tr( "Input gain") ), - m_outGainModel( 1.0, 0.0, 2.0, 0.001, this, tr( "Output gain" ) ), + m_inGainModel( 0.0, -60.0, 6.0, 0.01, this, tr( "Input gain") ), + m_outGainModel( -.0, -60.0, 6.0, 0.1, this, tr( "Output gain" ) ), m_lowShelfGainModel( 0.0 , -40, 40, 0.001, this, tr( "Low shelf gain" ) ), m_para1GainModel( 0.0 , -40, 40, 0.001, this, tr( "Peak 1 gain" ) ), m_para2GainModel( 0.0 , -40, 40, 0.001, this, tr( "Peak 2 gain" ) ), @@ -95,6 +95,8 @@ EqControls::EqControls( EqEffect *effect ) : m_inProgress = false; m_analyseIn = true; m_analyseOut = true; + + m_inGainModel.setScaleLogarithmic( true ); } diff --git a/plugins/Eq/EqControlsDialog.cpp b/plugins/Eq/EqControlsDialog.cpp index f53801967..ee91ca8f4 100644 --- a/plugins/Eq/EqControlsDialog.cpp +++ b/plugins/Eq/EqControlsDialog.cpp @@ -70,10 +70,15 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) : m_inGainFader = new EqFader( &controls->m_inGainModel, tr( "In Gain" ), this, &controls->m_inPeakL, &controls->m_inPeakR); m_inGainFader->move( 10, 5 ); + m_inGainFader->setDisplayConversion( false ); + m_inGainFader->setHintText( tr( "Gain" ), "dBv"); + m_outGainFader = new EqFader( &controls->m_outGainModel, tr( "Out Gain" ), this, &controls->m_outPeakL, &controls->m_outPeakR ); m_outGainFader->move( 315, 5 ); + m_outGainFader->setDisplayConversion( false ); + m_outGainFader->setHintText( tr( "Gain" ), "dBv"); //gain faders int fo = (cw * 0.5) - (m_outGainFader->width() * 0.5 ); diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index 6df5b2a33..9663926f8 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -78,7 +78,7 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames) { outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; } - const float outGain = m_eqControls.m_outGainModel.value(); + const float outGain = dbvToAmp( m_eqControls.m_outGainModel.value() ); const int sampleRate = Engine::mixer()->processingSampleRate(); sampleFrame m_inPeak = { 0, 0 }; @@ -90,7 +90,7 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames) { m_eqControls.m_inFftBands.clear(); } - gain(buf , frames, m_eqControls.m_inGainModel.value(), &m_inPeak ); + gain(buf , frames, dbvToAmp( m_eqControls.m_inGainModel.value() ), &m_inPeak ); m_eqControls.m_inPeakL = m_eqControls.m_inPeakL < m_inPeak[0] ? m_inPeak[0] : m_eqControls.m_inPeakL; m_eqControls.m_inPeakR = m_eqControls.m_inPeakR < m_inPeak[1] ? m_inPeak[1] : m_eqControls.m_inPeakR;