Skip to content

Commit

Permalink
More peak controller changes:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
diizy committed Nov 18, 2014
1 parent b441bda commit ba05b75
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
Binary file modified plugins/peak_controller_effect/artwork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions plugins/peak_controller_effect/peak_controller_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class PeakControllerEffectControlDialog : public EffectControlDialog
knob * m_amountKnob;
knob * m_attackKnob;
knob * m_decayKnob;
knob * m_tresholdKnob;
ledCheckBox * m_muteLed;

ledCheckBox * m_absLed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") )
Expand All @@ -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.
Expand Down Expand Up @@ -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" );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class PeakControllerEffectControls : public EffectControls
FloatModel m_amountModel;
FloatModel m_attackModel;
FloatModel m_decayModel;
FloatModel m_tresholdModel;
BoolModel m_muteModel;
BoolModel m_absModel;
FloatModel m_amountMultModel;
Expand Down
4 changes: 2 additions & 2 deletions src/core/PeakController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ba05b75

Please sign in to comment.