diff --git a/plugins/Eq/CMakeLists.txt b/plugins/Eq/CMakeLists.txt index 3cd4b8885..75c9b2911 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 -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") diff --git a/plugins/Eq/DBvModel.cpp b/plugins/Eq/DBvModel.cpp new file mode 100644 index 000000000..3bd128ea6 --- /dev/null +++ b/plugins/Eq/DBvModel.cpp @@ -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() ); +} diff --git a/plugins/Eq/DBvModel.h b/plugins/Eq/DBvModel.h new file mode 100644 index 000000000..ef6d80a03 --- /dev/null +++ b/plugins/Eq/DBvModel.h @@ -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 + diff --git a/plugins/Eq/EqControls.cpp b/plugins/Eq/EqControls.cpp index 833ea7080..76e5b4a95 100644 --- a/plugins/Eq/EqControls.cpp +++ b/plugins/Eq/EqControls.cpp @@ -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" ) ), diff --git a/plugins/Eq/EqControls.h b/plugins/Eq/EqControls.h index 874d75ea8..dfb75287e 100644 --- a/plugins/Eq/EqControls.h +++ b/plugins/Eq/EqControls.h @@ -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; diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index 9663926f8..3407c7953 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -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;