From 76eba6456ea8db28a2ca439bd79148ed974f5961 Mon Sep 17 00:00:00 2001 From: Dave French Date: Mon, 29 Dec 2014 18:11:16 +0000 Subject: [PATCH] EQ Seperate in out analysing toggle --- plugins/Eq/EqControls.cpp | 5 ++--- plugins/Eq/EqControls.h | 4 ++-- plugins/Eq/EqControlsDialog.cpp | 9 +-------- plugins/Eq/EqEffect.cpp | 4 ++-- plugins/Eq/EqParameterWidget.cpp | 23 ++++++++++++++++++++++- plugins/Eq/EqParameterWidget.h | 7 +++++-- 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/plugins/Eq/EqControls.cpp b/plugins/Eq/EqControls.cpp index 7921ba4be..8dc62243b 100644 --- a/plugins/Eq/EqControls.cpp +++ b/plugins/Eq/EqControls.cpp @@ -70,7 +70,6 @@ EqControls::EqControls( EqEffect *effect ) : m_hp12Model( false, this , tr( "HP 12" ) ), m_hp24Model( false, this , tr( "HP 24" ) ), m_hp48Model( false, this , tr( "HP 48" ) ), - m_analyzeModel( true, this , tr( "Analyze enable" ) ), m_lpTypeModel( 0,0,2,this, tr( "low pass type") ) , m_hpTypeModel( 0,0,2,this, tr( "high pass type") ) { @@ -94,6 +93,8 @@ EqControls::EqControls( EqEffect *effect ) : m_para4PeakL = 0; m_para4PeakR = 0; m_highShelfPeakL = 0; m_highShelfPeakR = 0; m_inProgress = false; + m_analyseIn = true; + m_analyseOut = true; } @@ -139,7 +140,6 @@ void EqControls::loadSettings( const QDomElement &_this ) m_hp12Model.loadSettings( _this , "HP12" ); m_hp24Model.loadSettings( _this , "HP24" ); m_hp48Model.loadSettings( _this , "HP48" ); - m_analyzeModel.loadSettings( _this, "Analyzeenable"); m_lpTypeModel.loadSettings( _this, "LP" ); m_hpTypeModel.loadSettings( _this, "HP" ); } @@ -188,7 +188,6 @@ void EqControls::saveSettings( QDomDocument &doc, QDomElement &parent ) m_hp12Model.saveSettings( doc, parent, "HP12" ); m_hp24Model.saveSettings( doc, parent, "HP24" ); m_hp48Model.saveSettings( doc, parent, "HP48" ); - m_analyzeModel.saveSettings( doc, parent, "Analyzeenable"); m_lpTypeModel.saveSettings( doc, parent, "LP" ); m_hpTypeModel.saveSettings( doc, parent, "HP" ); } diff --git a/plugins/Eq/EqControls.h b/plugins/Eq/EqControls.h index ed3f6aab7..cfec04c23 100644 --- a/plugins/Eq/EqControls.h +++ b/plugins/Eq/EqControls.h @@ -64,6 +64,8 @@ public: float m_para3PeakL, m_para3PeakR; float m_para4PeakL, m_para4PeakR; float m_highShelfPeakL, m_highShelfPeakR; + bool m_analyseIn; + bool m_analyseOut; EqAnalyser m_inFftBands; EqAnalyser m_outFftBands; @@ -123,8 +125,6 @@ private: BoolModel m_hp24Model; BoolModel m_hp48Model; - BoolModel m_analyzeModel; - IntModel m_lpTypeModel; IntModel m_hpTypeModel; diff --git a/plugins/Eq/EqControlsDialog.cpp b/plugins/Eq/EqControlsDialog.cpp index bfcbde45e..f74245f65 100644 --- a/plugins/Eq/EqControlsDialog.cpp +++ b/plugins/Eq/EqControlsDialog.cpp @@ -54,7 +54,7 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) : m_outSpec = new EqSpectrumView( &controls->m_outFftBands, this); m_outSpec->move( 51, 2 ); m_outSpec->color = QColor(145, 205, 22, 80); - m_parameterWidget = new EqParameterWidget( this ); + m_parameterWidget = new EqParameterWidget( this , controls ); m_parameterWidget->move( 51, 2 ); setBand( 0, &controls->m_hpActiveModel, &controls->m_hpFeqModel, &controls->m_hpResModel, 0, QColor(255 ,255, 255), tr( "HP" ) ,0,0); @@ -156,13 +156,6 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) : hpBtnGrp->addButton( m_hp48Box ); hpBtnGrp->setModel( &m_controls->m_hpTypeModel,false); - //Analize Box - m_analyzeBox = new LedCheckBox( tr( "Analyze" ), this , "" , LedCheckBox::Green ); - m_analyzeBox->move( cw*1 + ko + 5, 15 ); - m_analyzeBox->setModel( &controls->m_analyzeModel ); - - - } void EqControlsDialog::mouseDoubleClickEvent(QMouseEvent *event) diff --git a/plugins/Eq/EqEffect.cpp b/plugins/Eq/EqEffect.cpp index b130db02f..f968615f4 100644 --- a/plugins/Eq/EqEffect.cpp +++ b/plugins/Eq/EqEffect.cpp @@ -82,7 +82,7 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames) const int sampleRate = Engine::mixer()->processingSampleRate(); sampleFrame m_inPeak = { 0, 0 }; - if(m_eqControls.m_analyzeModel.value() ) + if(m_eqControls.m_analyseIn ) { m_eqControls.m_inFftBands.analyze( buf, frames ); } @@ -177,7 +177,7 @@ bool EqEffect::processAudioBuffer(sampleFrame *buf, const fpp_t frames) m_eqControls.m_outPeakR = m_eqControls.m_outPeakR < outPeak[1] ? outPeak[1] : m_eqControls.m_outPeakR; checkGate( outSum / frames ); - if(m_eqControls.m_analyzeModel.value() ) + if(m_eqControls.m_analyseOut ) { m_eqControls.m_outFftBands.analyze( buf, frames ); setBandPeaks( &m_eqControls.m_outFftBands , ( int )( sampleRate * 0.5 ) ); diff --git a/plugins/Eq/EqParameterWidget.cpp b/plugins/Eq/EqParameterWidget.cpp index 31c74a7f0..e65dc9c3d 100644 --- a/plugins/Eq/EqParameterWidget.cpp +++ b/plugins/Eq/EqParameterWidget.cpp @@ -28,8 +28,9 @@ #include "lmms_math.h" #include "MainWindow.h" #include "QMouseEvent" +#include "EqControls.h" -EqParameterWidget::EqParameterWidget( QWidget *parent ) : +EqParameterWidget::EqParameterWidget( QWidget *parent, EqControls * controls ) : QWidget( parent ), m_bands ( 0 ), m_selectedBand ( 0 ) @@ -46,6 +47,7 @@ EqParameterWidget::EqParameterWidget( QWidget *parent ) : m_pixelsPerUnitHeight = (height() - 4) / ( totalHeight ); m_scale = 1.5; m_pixelsPerOctave = freqToXPixel( 10000 ) - freqToXPixel( 5000 ); + m_controls = controls; } @@ -133,6 +135,25 @@ void EqParameterWidget::mouseReleaseEvent( QMouseEvent *event ) { m_selectedBand = 0; m_mouseAction = none; + const int inXmin = 228; + const int inXmax = 250; + const int inYmin = 20; + const int inYmax = 30; + + const int outXmin = 228; + const int outXmax = 250; + const int outYmin = 30; + const int outYmax = 40; + + if(event->x() > inXmin && event->x() < inXmax && event->y() > inYmin && event->y() < inYmax ) + { + m_controls->m_analyseIn = !m_controls->m_analyseIn; + } + + if(event->x() > outXmin && event->x() < outXmax && event->y() > outYmin && event->y() < outYmax ) + { + m_controls->m_analyseOut = !m_controls->m_analyseOut; + } } diff --git a/plugins/Eq/EqParameterWidget.h b/plugins/Eq/EqParameterWidget.h index 6cc7f1a89..b553ce6f2 100644 --- a/plugins/Eq/EqParameterWidget.h +++ b/plugins/Eq/EqParameterWidget.h @@ -28,6 +28,8 @@ #include #include "EffectControls.h" +class EqControls; + class EqBand { @@ -51,9 +53,9 @@ public : class EqParameterWidget : public QWidget { - + Q_OBJECT public: - explicit EqParameterWidget( QWidget *parent = 0 ); + explicit EqParameterWidget( QWidget *parent = 0, EqControls * controls = 0); ~EqParameterWidget(); const int bandCount() { @@ -113,6 +115,7 @@ protected: private: EqBand *m_bands; + EqControls *m_controls; float m_pixelsPerUnitWidth; float m_pixelsPerUnitHeight; float m_pixelsPerOctave;