From 8b83dad22c45feac47e75193213d2b8489954f35 Mon Sep 17 00:00:00 2001 From: Dave French Date: Sun, 4 Jan 2015 17:19:32 +0000 Subject: [PATCH] EQ Removed DBvModel --- plugins/Eq/CMakeLists.txt | 4 ++-- plugins/Eq/DBvModel.cpp | 14 -------------- plugins/Eq/DBvModel.h | 31 ------------------------------- plugins/Eq/EqControls.h | 6 +++--- plugins/Eq/EqEffect.cpp | 16 +++++++++++++--- plugins/Eq/EqEffect.h | 3 +++ 6 files changed, 21 insertions(+), 53 deletions(-) delete mode 100644 plugins/Eq/DBvModel.cpp delete mode 100644 plugins/Eq/DBvModel.h diff --git a/plugins/Eq/CMakeLists.txt b/plugins/Eq/CMakeLists.txt index 75c9b2911..3cd4b8885 100644 --- a/plugins/Eq/CMakeLists.txt +++ b/plugins/Eq/CMakeLists.txt @@ -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") diff --git a/plugins/Eq/DBvModel.cpp b/plugins/Eq/DBvModel.cpp deleted file mode 100644 index 3bd128ea6..000000000 --- a/plugins/Eq/DBvModel.cpp +++ /dev/null @@ -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() ); -} diff --git a/plugins/Eq/DBvModel.h b/plugins/Eq/DBvModel.h deleted file mode 100644 index ef6d80a03..000000000 --- a/plugins/Eq/DBvModel.h +++ /dev/null @@ -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 - diff --git a/plugins/Eq/EqControls.h b/plugins/Eq/EqControls.h index dfb75287e..5218b6a9f 100644 --- a/plugins/Eq/EqControls.h +++ b/plugins/Eq/EqControls.h @@ -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; diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index 3407c7953..885eebe2a 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -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; diff --git a/plugins/Eq/EqEffect.h b/plugins/Eq/EqEffect.h index 654ae5bd2..63f76f3dd 100644 --- a/plugins/Eq/EqEffect.h +++ b/plugins/Eq/EqEffect.h @@ -85,6 +85,9 @@ private: EqLp12Filter m_lp480; EqLp12Filter m_lp481; + float m_inGain; + float m_outGain; +