EQ Removed DBvModel

This commit is contained in:
Dave French
2015-01-04 17:19:32 +00:00
parent 420bc1b7ed
commit 8b83dad22c
6 changed files with 21 additions and 53 deletions

View File

@@ -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 DBvModel.cpp DBvModel.h
MOCFILES EqControls.h EqParameterWidget.h EqFader.h DBvModel.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
MOCFILES EqControls.h EqParameterWidget.h EqFader.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")

View File

@@ -1,14 +0,0 @@
#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() );
}

View File

@@ -1,31 +0,0 @@
#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

View File

@@ -28,7 +28,7 @@
#include "EffectControls.h"
#include "EqControlsDialog.h"
#include "Knob.h"
#include "DBvModel.h"
class EqEffect;
@@ -83,8 +83,8 @@ public:
private:
EqEffect* m_effect;
DBvModel m_inGainModel;
DBvModel m_outGainModel;
FloatModel m_inGainModel;
FloatModel m_outGainModel;
FloatModel m_lowShelfGainModel;
FloatModel m_para1GainModel;
FloatModel m_para2GainModel;

View File

@@ -52,7 +52,9 @@ Plugin::Descriptor PLUGIN_EXPORT eq_plugin_descriptor =
EqEffect::EqEffect(Model *parent, const Plugin::Descriptor::SubPluginFeatures::Key *key) :
Effect( &eq_plugin_descriptor, parent, key ),
m_eqControls( this )
m_eqControls( this ),
m_inGain( 1.0 ),
m_outGain( 1.0 )
{
}
@@ -73,13 +75,21 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames)
{
return( false );
}
if( m_eqControls.m_outGainModel.isValueChanged() )
{
m_outGain = dbvToAmp(m_eqControls.m_outGainModel.value());
}
if( m_eqControls.m_inGainModel.isValueChanged() )
{
m_inGain = dbvToAmp(m_eqControls.m_inGainModel.value());
}
m_eqControls.m_inProgress = true;
double outSum = 0.0;
for( fpp_t f = 0; f < frames; ++f )
{
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];
}
const float outGain = m_eqControls.m_outGainModel.getAmp();
const float outGain = m_outGain;
const int sampleRate = Engine::mixer()->processingSampleRate();
sampleFrame m_inPeak = { 0, 0 };
@@ -91,7 +101,7 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames)
{
m_eqControls.m_inFftBands.clear();
}
gain(buf , frames, m_eqControls.m_inGainModel.getAmp() , &m_inPeak );
gain(buf , frames, m_inGain , &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;

View File

@@ -85,6 +85,9 @@ private:
EqLp12Filter m_lp480;
EqLp12Filter m_lp481;
float m_inGain;
float m_outGain;