More peak controller changes:

Add treshold knob to peak controller
This causes the peak controller to react only when the measured peaks are above the set treshold
Might be useful for finetuning your sidechains
This commit is contained in:
Vesa
2014-11-10 22:53:32 +02:00
parent b441bdae15
commit ba05b7523d
7 changed files with 18 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -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();

View File

@@ -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 );

View File

@@ -48,6 +48,7 @@ protected:
knob * m_amountKnob;
knob * m_attackKnob;
knob * m_decayKnob;
knob * m_tresholdKnob;
ledCheckBox * m_muteLed;
ledCheckBox * m_absLed;

View File

@@ -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" );
}

View File

@@ -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;

View File

@@ -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;
}