Eq Gain Faders using dBv scale
This commit is contained in:
@@ -2,5 +2,5 @@ INCLUDE(BuildPlugin)
|
||||
INCLUDE_DIRECTORIES(${FFTW3F_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${FFTW3F_LIBRARY_DIRS})
|
||||
LINK_LIBRARIES(${FFTW3F_LIBRARIES})
|
||||
BUILD_PLUGIN(eq EqEffect.cpp EqControls.cpp EqControlsDialog.cpp EqFilter.h EqParameterWidget.cpp EqFader.h EqSpectrumView.h
|
||||
MOCFILES EqControls.h EqParameterWidget.h EqFader.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
|
||||
BUILD_PLUGIN(eq EqEffect.cpp EqControls.cpp EqControlsDialog.cpp EqFilter.h EqParameterWidget.cpp EqFader.h EqSpectrumView.h DBvModel.cpp DBvModel.h
|
||||
MOCFILES EqControls.h EqParameterWidget.h EqFader.h DBvModel.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
|
||||
|
||||
14
plugins/Eq/DBvModel.cpp
Normal file
14
plugins/Eq/DBvModel.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "DBvModel.h"
|
||||
|
||||
DBvModel::DBvModel(float val, float min, float max, float step,
|
||||
Model *parent, const QString &displayName,
|
||||
bool defaultConstructed) :
|
||||
FloatModel( val, min, max, step, parent, displayName, defaultConstructed )
|
||||
{
|
||||
connect(this, SIGNAL( dataChanged() ), this,SLOT( calcAmp() ) );
|
||||
}
|
||||
|
||||
void DBvModel::calcAmp()
|
||||
{
|
||||
m_amp = dbvToAmp( value() );
|
||||
}
|
||||
31
plugins/Eq/DBvModel.h
Normal file
31
plugins/Eq/DBvModel.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef DBVMODEL
|
||||
#define DBVMODEL
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
|
||||
|
||||
class DBvModel : public FloatModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DBvModel( float val = 0, float min = 0, float max = 0, float step = 0,
|
||||
Model * parent = NULL,
|
||||
const QString& displayName = QString(),
|
||||
bool defaultConstructed = false );
|
||||
inline float getAmp() const
|
||||
{
|
||||
return m_amp;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void calcAmp();
|
||||
|
||||
private:
|
||||
float m_amp;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // DBVMODEL
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
EqControls::EqControls( EqEffect *effect ) :
|
||||
EffectControls( effect ),
|
||||
m_effect( effect ),
|
||||
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_inGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Input gain") ),
|
||||
m_outGainModel( -.0, -60.0, 20.0, 0.01, 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" ) ),
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
#include "EffectControls.h"
|
||||
#include "EqControlsDialog.h"
|
||||
#include "Knob.h"
|
||||
#include "DBvModel.h"
|
||||
|
||||
class EqEffect;
|
||||
|
||||
|
||||
class EqControls : public EffectControls
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -81,8 +83,8 @@ public:
|
||||
private:
|
||||
EqEffect* m_effect;
|
||||
|
||||
FloatModel m_inGainModel;
|
||||
FloatModel m_outGainModel;
|
||||
DBvModel m_inGainModel;
|
||||
DBvModel m_outGainModel;
|
||||
FloatModel m_lowShelfGainModel;
|
||||
FloatModel m_para1GainModel;
|
||||
FloatModel m_para2GainModel;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "interpolation.h"
|
||||
#include "Engine.h"
|
||||
#include "MainWindow.h"
|
||||
#include "EqFader.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -78,7 +79,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 = dbvToAmp( m_eqControls.m_outGainModel.value() );
|
||||
const float outGain = m_eqControls.m_outGainModel.getAmp();
|
||||
const int sampleRate = Engine::mixer()->processingSampleRate();
|
||||
sampleFrame m_inPeak = { 0, 0 };
|
||||
|
||||
@@ -90,7 +91,7 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames)
|
||||
{
|
||||
m_eqControls.m_inFftBands.clear();
|
||||
}
|
||||
gain(buf , frames, dbvToAmp( m_eqControls.m_inGainModel.value() ), &m_inPeak );
|
||||
gain(buf , frames, m_eqControls.m_inGainModel.getAmp() , &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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user