diff --git a/plugins/peak_controller_effect/artwork.png b/plugins/peak_controller_effect/artwork.png index 31296ca90..66fe2c952 100644 Binary files a/plugins/peak_controller_effect/artwork.png and b/plugins/peak_controller_effect/artwork.png differ diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index aeb3677ad..136f22cbe 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -130,7 +130,9 @@ bool PeakControllerEffect::processAudioBuffer( sampleFrame * _buf, } float curRMS = sqrt_neg( sum / _frames ); + const float tres = c.m_tresholdModel.value(); const float amount = c.m_amountModel.value() * c.m_amountMultModel.value(); + curRMS = qAbs( curRMS ) < tres ? 0.0f : curRMS; m_lastSample = qBound( 0.0f, c.m_baseModel.value() + amount * curRMS, 1.0f ); return isRunning(); diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp index 7ea9448e8..359b23b9b 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.cpp @@ -46,7 +46,7 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog( setPalette( pal ); QVBoxLayout * tl = new QVBoxLayout( this ); - tl->setContentsMargins( 5, 30, 8, 8 ); + tl->setContentsMargins( 5, 30, 5, 8 ); QHBoxLayout * l = new QHBoxLayout; l->setSpacing( 4 ); @@ -74,12 +74,18 @@ PeakControllerEffectControlDialog::PeakControllerEffectControlDialog( m_decayKnob->setLabel( tr( "DCAY" ) ); m_decayKnob->setModel( &_controls->m_decayModel ); m_decayKnob->setHintText( tr( "Release:" ) + " ", "" ); + + m_tresholdKnob = new knob( knobBright_26, this ); + m_tresholdKnob->setLabel( tr( "TRES" ) ); + m_tresholdKnob->setModel( &_controls->m_tresholdModel ); + m_tresholdKnob->setHintText( tr( "Treshold:" ) + " ", "" ); l->addWidget( m_baseKnob ); l->addWidget( m_amountKnob ); l->addWidget( m_amountMultKnob ); l->addWidget( m_attackKnob ); l->addWidget( m_decayKnob ); + l->addWidget( m_tresholdKnob ); l->addStretch(); // expand, so other widgets have minimum width tl->addLayout( l ); diff --git a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h index b161a64c5..64e876e37 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h +++ b/plugins/peak_controller_effect/peak_controller_effect_control_dialog.h @@ -48,6 +48,7 @@ protected: knob * m_amountKnob; knob * m_attackKnob; knob * m_decayKnob; + knob * m_tresholdKnob; ledCheckBox * m_muteLed; ledCheckBox * m_absLed; diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp index 3fdeecc34..78109366b 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp @@ -41,6 +41,7 @@ PeakControllerEffectControls( PeakControllerEffect * _eff ) : m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Modulation amount" ) ), m_attackModel( 0, 0, 0.999, 0.001, this, tr( "Attack" ) ), m_decayModel( 0, 0, 0.999, 0.001, this, tr( "Release" ) ), + m_tresholdModel( 0, 0, 1.0, 0.001, this, tr( "Treshold" ) ), m_muteModel( false, this, tr( "Mute output" ) ), m_absModel( true, this, tr("Abs Value") ), m_amountMultModel( 1.0, 0, 32, 0.2, this, tr("Amount Multiplicator") ) @@ -61,6 +62,8 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this ) m_absModel.loadSettings( _this, "abs" ); m_amountMultModel.loadSettings( _this, "amountmult" ); + + m_tresholdModel.loadSettings( _this, "treshold" ); /*If the peak controller effect is NOT loaded from project, * m_effectId stored is useless. @@ -102,6 +105,8 @@ void PeakControllerEffectControls::saveSettings( QDomDocument & _doc, m_absModel.saveSettings( _doc, _this, "abs" ); m_amountMultModel.saveSettings( _doc, _this, "amountmult" ); + + m_tresholdModel.saveSettings( _doc, _this, "treshold" ); } diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.h b/plugins/peak_controller_effect/peak_controller_effect_controls.h index 6f9cca92e..ad56fa99a 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.h +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.h @@ -65,6 +65,7 @@ private: FloatModel m_amountModel; FloatModel m_attackModel; FloatModel m_decayModel; + FloatModel m_tresholdModel; BoolModel m_muteModel; BoolModel m_absModel; FloatModel m_amountMultModel; diff --git a/src/core/PeakController.cpp b/src/core/PeakController.cpp index 25aaec456..87ea7a948 100644 --- a/src/core/PeakController.cpp +++ b/src/core/PeakController.cpp @@ -87,8 +87,8 @@ void PeakController::updateValueBuffer() if( m_coeffNeedsUpdate ) { const float ratio = 44100.0f / engine::mixer()->processingSampleRate(); - m_attackCoeff = 1.0f - powf( 10.0f, -0.5f * ( 1.0f - m_peakEffect->attackModel()->value() ) * ratio ); - m_decayCoeff = 1.0f - powf( 10.0f, -0.5f * ( 1.0f - m_peakEffect->decayModel()->value() ) * ratio ); + m_attackCoeff = 1.0f - powf( 2.0f, -0.3f * ( 1.0f - m_peakEffect->attackModel()->value() ) * ratio ); + m_decayCoeff = 1.0f - powf( 2.0f, -0.3f * ( 1.0f - m_peakEffect->decayModel()->value() ) * ratio ); m_coeffNeedsUpdate = false; }