From 382d7d44b0fd4daab296eb539f0a4e0dde444c1f Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 14 Jan 2008 23:10:53 +0000 Subject: [PATCH] split off effectControlDialog into effectControlDialog and effectControls, made work with M/V as well as rewritten effect-framework, fixed bug in songEditor-engine git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@664 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 24 ++++ Makefile.am | 1 + include/dummy_effect.h | 70 +++++---- include/effect.h | 4 +- include/effect_control_dialog.h | 15 +- include/effect_controls.h | 68 +++++++++ plugins/bass_booster/Makefile.am | 4 +- plugins/bass_booster/bass_booster.cpp | 3 +- plugins/bass_booster/bass_booster.h | 20 +-- .../bassbooster_control_dialog.cpp | 133 +++--------------- .../bass_booster/bassbooster_control_dialog.h | 35 +---- plugins/bass_booster/bassbooster_controls.cpp | 103 ++++++++++++++ plugins/bass_booster/bassbooster_controls.h | 79 +++++++++++ src/core/effect.cpp | 11 +- src/core/effect_control_dialog.cpp | 11 +- src/core/song_editor.cpp | 2 + src/widgets/effect_view.cpp | 5 +- 17 files changed, 381 insertions(+), 207 deletions(-) create mode 100644 include/effect_controls.h create mode 100644 plugins/bass_booster/bassbooster_controls.cpp create mode 100644 plugins/bass_booster/bassbooster_controls.h diff --git a/ChangeLog b/ChangeLog index 06f4deedc..311efdd09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,29 @@ 2008-01-14 Tobias Doerffel + * plugins/bass_booster/bassbooster_controls.h: + * plugins/bass_booster/bass_booster.cpp: + * plugins/bass_booster/bassbooster_control_dialog.cpp: + * plugins/bass_booster/Makefile.am: + * plugins/bass_booster/bassbooster_controls.cpp: + * plugins/bass_booster/bass_booster.h: + * plugins/bass_booster/bassbooster_control_dialog.h: + made work with M/V as well as rewritten effect-framework + + * include/effect.h: + * include/effect_control_dialog.h: + * include/dummy_effect.h: + * include/effect_controls.h: + * src/widgets/effect_view.cpp: + * src/core/effect_control_dialog.cpp: + * src/core/effect.cpp: + * Makefile.am: + split off effectControlDialog into effectControlDialog and + effectControls + + * src/core/song_editor.cpp: + also connect to dataUnchanged()-signal of tempo-model in order to + setup everything correct by connected slot + * configure.in: - removed single-source-compile-feature - made FASTCALL-usage optional for the time being diff --git a/Makefile.am b/Makefile.am index 02a96d0aa..ce9e32485 100644 --- a/Makefile.am +++ b/Makefile.am @@ -370,6 +370,7 @@ lmms_SOURCES = \ $(srcdir)/include/engine.h \ $(srcdir)/include/effect.h \ $(srcdir)/include/effect_chain.h \ + $(srcdir)/include/effect_controls.h \ $(srcdir)/include/effect_control_dialog.h \ $(srcdir)/include/effect_label.h \ $(srcdir)/include/effect_rack_view.h \ diff --git a/include/dummy_effect.h b/include/dummy_effect.h index 3e37ab955..3fadf49bc 100644 --- a/include/dummy_effect.h +++ b/include/dummy_effect.h @@ -27,14 +27,30 @@ #define _DUMMY_EFFECT_H #include "effect.h" +#include "effect_controls.h" #include "effect_control_dialog.h" class dummyEffectControlDialog : public effectControlDialog { public: - dummyEffectControlDialog( effect * _eff ) : - effectControlDialog( NULL, _eff ) + dummyEffectControlDialog( effectControls * _controls ) : + effectControlDialog( _controls ) + { + } + +} ; + + +class dummyEffectControls : public effectControls +{ +public: + dummyEffectControls( effect * _eff ) : + effectControls( _eff ) + { + } + + virtual ~dummyEffectControls() { } @@ -43,28 +59,6 @@ public: return( 0 ); } - inline virtual QString nodeName( void ) const - { - return( "dummycontrols" ); - } - -} ; - - - -class dummyEffect : public effect -{ -public: - inline dummyEffect( model * _parent ) : - effect( NULL, _parent, NULL ) - { - } - - inline virtual ~dummyEffect() - { - } - - inline virtual void saveSettings( QDomDocument &, QDomElement & ) { } @@ -75,13 +69,37 @@ public: inline virtual QString nodeName( void ) const { - return( "dummyeffect" ); + return( "dummycontrols" ); } - inline virtual effectControlDialog * createControlDialog( track * ) + virtual effectControlDialog * createView( void ) { return( new dummyEffectControlDialog( this ) ); } +} ; + + + +class dummyEffect : public effect +{ +public: + inline dummyEffect( model * _parent ) : + effect( NULL, _parent, NULL ), + m_controls( this ) + { + } + + inline virtual ~dummyEffect() + { + } + + inline virtual effectControls * getControls( void ) + { + return( &m_controls ); + } + +private: + dummyEffectControls m_controls; } ; diff --git a/include/effect.h b/include/effect.h index e7c51aa88..65d0120bb 100644 --- a/include/effect.h +++ b/include/effect.h @@ -40,7 +40,7 @@ class effectChain; -class effectControlDialog; +class effectControls; class track; @@ -161,7 +161,7 @@ public: return( m_key ); } - virtual effectControlDialog * createControlDialog( track * _track ) = 0; + virtual effectControls * getControls( void ) = 0; static effect * instantiate( const QString & _plugin_name, model * _parent, diff --git a/include/effect_control_dialog.h b/include/effect_control_dialog.h index 1d95eb488..b0a6a4f6d 100644 --- a/include/effect_control_dialog.h +++ b/include/effect_control_dialog.h @@ -29,22 +29,18 @@ #include #include "mv_base.h" -#include "types.h" -class effect; -class track; +class effectControls; class effectControlDialog : public QWidget, public modelView { Q_OBJECT public: - effectControlDialog( QWidget * _parent, effect * _eff ); + effectControlDialog( effectControls * _controls ); virtual ~effectControlDialog(); - virtual ch_cnt_t getControlCount( void ) = 0; - signals: void closed(); @@ -52,15 +48,10 @@ signals: protected: virtual void closeEvent( QCloseEvent * _ce ); - template - T * getEffect( void ) - { - return( dynamic_cast( m_effect ) ); - } private: - effect * m_effect; + effectControls * m_effectControls; } ; diff --git a/include/effect_controls.h b/include/effect_controls.h new file mode 100644 index 000000000..a339b7043 --- /dev/null +++ b/include/effect_controls.h @@ -0,0 +1,68 @@ +/* + * effect_controls.h - model for effect-controls + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _EFFECT_CONTROLS_H +#define _EFFECT_CONTROLS_H + +#include "mv_base.h" +#include "journalling_object.h" +#include "effect.h" + + +class track; +class effectControlDialog; + + +class effectControls : public journallingObject, public model +{ +public: + effectControls( effect * _eff ) : + journallingObject(), + model( _eff ), + m_effect( _eff ) + { + } + + virtual ~effectControls() + { + } + + virtual ch_cnt_t getControlCount( void ) = 0; + virtual effectControlDialog * createView( void ) = 0; + + +// template + effect * getEffect( void ) + { + return( m_effect ); + //return( dynamic_cast( m_effect ) ); + } + + +private: + effect * m_effect; + +} ; + +#endif diff --git a/plugins/bass_booster/Makefile.am b/plugins/bass_booster/Makefile.am index 3d699aeab..8d2efed35 100644 --- a/plugins/bass_booster/Makefile.am +++ b/plugins/bass_booster/Makefile.am @@ -11,7 +11,7 @@ AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="bassbooster" $(MOC) -o $@ $< -MOC_FILES = ./bassbooster_control_dialog.moc +MOC_FILES = ./bassbooster_controls.moc BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h EMBEDDED_RESOURCES = $(wildcard *png) @@ -30,6 +30,8 @@ pkglib_LTLIBRARIES= libbassbooster.la libbassbooster_la_SOURCES = bass_booster.cpp \ bass_booster.h \ + bassbooster_controls.cpp \ + bassbooster_controls.h \ bassbooster_control_dialog.cpp \ bassbooster_control_dialog.h diff --git a/plugins/bass_booster/bass_booster.cpp b/plugins/bass_booster/bass_booster.cpp index e8c9f4bce..1d4ddc22a 100644 --- a/plugins/bass_booster/bass_booster.cpp +++ b/plugins/bass_booster/bass_booster.cpp @@ -54,7 +54,8 @@ plugin::descriptor bassbooster_plugin_descriptor = bassBoosterEffect::bassBoosterEffect( model * _parent, const descriptor::subPluginFeatures::key * _key ) : effect( &bassbooster_plugin_descriptor, _parent, _key ), - m_bbFX( effectLib::fastBassBoost<>( 70.0f, 1.0f, 2.8f ) ) + m_bbFX( effectLib::fastBassBoost<>( 70.0f, 1.0f, 2.8f ) ), + m_bbControls( this ) { } diff --git a/plugins/bass_booster/bass_booster.h b/plugins/bass_booster/bass_booster.h index 108db8fa1..4f71820ea 100644 --- a/plugins/bass_booster/bass_booster.h +++ b/plugins/bass_booster/bass_booster.h @@ -33,7 +33,7 @@ #include "effect_lib.h" #include "engine.h" #include "main_window.h" -#include "bassbooster_control_dialog.h" +#include "bassbooster_controls.h" @@ -45,23 +45,25 @@ public: virtual ~bassBoosterEffect(); virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, const fpp_t _frames ); - inline virtual QString nodeName( void ) const + + virtual effectControls * getControls( void ) { - return( "bassboostereffect" ); + return( &m_bbControls ); } - virtual inline effectControlDialog * createControlDialog( track * ) +/* inline virtual QString nodeName( void ) const { - return( new bassBoosterControlDialog( - NULL /*engine::getMainWindow()->workspace()*/, - this ) ); - } + return( "bassboostereffect" ); + }*/ private: effectLib::monoToStereoAdaptor > m_bbFX; - friend class bassBoosterControlDialog; + bassBoosterControls m_bbControls; + + friend class bassBoosterControls; + } ; diff --git a/plugins/bass_booster/bassbooster_control_dialog.cpp b/plugins/bass_booster/bassbooster_control_dialog.cpp index 93bc8cdb3..072933a12 100644 --- a/plugins/bass_booster/bassbooster_control_dialog.cpp +++ b/plugins/bass_booster/bassbooster_control_dialog.cpp @@ -1,7 +1,7 @@ /* * bassbooster_control_dialog.cpp - control-dialog for bassbooster-effect * - * Copyright (c) 2006-2007 Tobias Doerffel + * Copyright (c) 2006-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -25,126 +25,35 @@ #include -#include "bass_booster.h" -#include "knob.h" +#include "bassbooster_control_dialog.h" +#include "bassbooster_controls.h" -bassBoosterControlDialog::bassBoosterControlDialog( QWidget * _parent, - bassBoosterEffect * _eff ) : - effectControlDialog( _parent, _eff ), - m_effect( _eff ) +bassBoosterControlDialog::bassBoosterControlDialog( + bassBoosterControls * _controls ) : + effectControlDialog( _controls ) { QHBoxLayout * l = new QHBoxLayout( this ); - m_freqKnob = new knob( knobBright_26, this, tr( "Frequency" ), NULL ); - m_freqKnob->setRange( 50.0f, 200.0f, 1.0f ); - m_freqKnob->setInitValue( 100.0f ); - m_freqKnob->setLabel( tr( "FREQ" ) ); - m_freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" ); - connect( m_freqKnob, SIGNAL( valueChanged( float ) ), - this, SLOT( changeFrequency( void ) ) ); + knob * freqKnob = new knob( knobBright_26, this, tr( "Frequency" ) ); + freqKnob->setModel( &_controls->m_freqModel ); + freqKnob->setLabel( tr( "FREQ" ) ); + freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" ); - m_gainKnob = new knob( knobBright_26, this, tr( "Gain" ), NULL ); - m_gainKnob->setRange( 0.1f, 5.0f, 0.1f ); - m_gainKnob->setInitValue( 1.0f ); - m_gainKnob->setLabel( tr( "GAIN" ) ); - m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" ); - connect( m_gainKnob, SIGNAL( valueChanged( float ) ), - this, SLOT( changeGain( void ) ) ); + knob * gainKnob = new knob( knobBright_26, this, tr( "Gain" ) ); + gainKnob->setModel( &_controls->m_gainModel ); + gainKnob->setLabel( tr( "GAIN" ) ); + gainKnob->setHintText( tr( "Gain:" ) + " ", "" ); - m_ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ), NULL ); - m_ratioKnob->setRange( 0.1f, 10.0f, 0.1f ); - m_ratioKnob->setInitValue( 2.0f ); - m_ratioKnob->setLabel( tr( "RATIO" ) ); - m_ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" ); - connect( m_ratioKnob, SIGNAL( valueChanged( float ) ), - this, SLOT( changeRatio( void ) ) ); + knob * ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ) ); + ratioKnob->setModel( &_controls->m_ratioModel ); + ratioKnob->setLabel( tr( "RATIO" ) ); + ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" ); - l->addWidget( m_freqKnob ); - l->addWidget( m_gainKnob ); - l->addWidget( m_ratioKnob ); - - changeFrequency(); - changeGain(); - changeRatio(); + l->addWidget( freqKnob ); + l->addWidget( gainKnob ); + l->addWidget( ratioKnob ); } - - -void bassBoosterControlDialog::changeFrequency( void ) -{ - m_effect->m_bbFX.leftFX().setFrequency( m_freqKnob->value() ); - m_effect->m_bbFX.rightFX().setFrequency( m_freqKnob->value() ); -} - - - - -void bassBoosterControlDialog::changeGain( void ) -{ - m_effect->m_bbFX.leftFX().setGain( m_gainKnob->value() ); - m_effect->m_bbFX.rightFX().setGain( m_gainKnob->value() ); -} - - - - -void bassBoosterControlDialog::changeRatio( void ) -{ - m_effect->m_bbFX.leftFX().setRatio( m_ratioKnob->value() ); - m_effect->m_bbFX.rightFX().setRatio( m_ratioKnob->value() ); -} - - - - -/* -void bassBoosterControlDialog::updateEffect( void ) -{ - //m_effect->m_bbFX = effectLib::bassBoost<>( m_freqKnob->value(), - // m_gainKnob->value(), m_ratioKnob->value() ); - m_effect->m_bbFX = effectLib::monoToStereoAdaptor< - effectLib::bassBoost<> >( - effectLib::bassBoost<>( m_freqKnob->value(), - m_gainKnob->value(), m_ratioKnob->value(), - m_effect->m_bbFX.leftFX() ), - effectLib::bassBoost<>( m_freqKnob->value(), - m_gainKnob->value(), m_ratioKnob->value(), - m_effect->m_bbFX.rightFX() ) - ); - m_effect->m_bbFX.leftFX().setSelectivity( m_freqKnob->value() ); - m_effect->m_bbFX.rightFX().setSelectivity( m_freqKnob->value() ); - m_effect->m_bbFX.leftFX().setGain( m_gainKnob->value() ); - m_effect->m_bbFX.rightFX().setGain( m_gainKnob->value() ); - m_effect->m_bbFX.leftFX().setRatio( m_ratioKnob->value() ); - m_effect->m_bbFX.rightFX().setRatio( m_ratioKnob->value() ); -} -*/ - - - -void FASTCALL bassBoosterControlDialog::loadSettings( - const QDomElement & _this ) -{ - m_freqKnob->setValue( _this.attribute( "freq" ).toFloat() ); - m_gainKnob->setValue( _this.attribute( "gain" ).toFloat() ); - m_ratioKnob->setValue( _this.attribute( "ratio" ).toFloat() ); -} - - - - -void FASTCALL bassBoosterControlDialog::saveSettings( QDomDocument & _doc, - QDomElement & _this ) -{ - _this.setAttribute( "freq", m_freqKnob->value() ); - _this.setAttribute( "gain", m_gainKnob->value() ); - _this.setAttribute( "ratio", m_ratioKnob->value() ); -} - - - -#include "bassbooster_control_dialog.moc" - diff --git a/plugins/bass_booster/bassbooster_control_dialog.h b/plugins/bass_booster/bassbooster_control_dialog.h index 03c94cd7d..7a482302f 100644 --- a/plugins/bass_booster/bassbooster_control_dialog.h +++ b/plugins/bass_booster/bassbooster_control_dialog.h @@ -1,7 +1,7 @@ /* * bassbooster_control_dialog.h - control-dialog for bassbooster-effect * - * Copyright (c) 2006 Tobias Doerffel + * Copyright (c) 2006-2008 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -27,45 +27,18 @@ #include "effect_control_dialog.h" -class knob; -class bassBoosterEffect; + +class bassBoosterControls; class bassBoosterControlDialog : public effectControlDialog { - Q_OBJECT public: - bassBoosterControlDialog( QWidget * _parent, bassBoosterEffect * _eff ); + bassBoosterControlDialog( bassBoosterControls * _controls ); virtual ~bassBoosterControlDialog() { } - virtual void FASTCALL saveSettings( QDomDocument & _doc, - QDomElement & _parent ); - virtual void FASTCALL loadSettings( const QDomElement & _this ); - inline virtual QString nodeName( void ) const - { - return( "bassboostercontrols" ); - } - - virtual ch_cnt_t getControlCount( void ) - { - return( 3 ); - } - - -private slots: - void changeFrequency( void ); - void changeGain( void ); - void changeRatio( void ); - - -private: - bassBoosterEffect * m_effect; - knob * m_freqKnob; - knob * m_gainKnob; - knob * m_ratioKnob; - } ; #endif diff --git a/plugins/bass_booster/bassbooster_controls.cpp b/plugins/bass_booster/bassbooster_controls.cpp new file mode 100644 index 000000000..bb96ecd68 --- /dev/null +++ b/plugins/bass_booster/bassbooster_controls.cpp @@ -0,0 +1,103 @@ +/* + * bassbooster_controls.cpp - controls for bassbooster-effect + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "bassbooster_controls.h" +#include "bass_booster.h" + + + +bassBoosterControls::bassBoosterControls( bassBoosterEffect * _eff ) : + effectControls( _eff ), + m_effect( _eff ), + m_freqModel( 100.0f, 50.0f, 200.0f, 1.0f, this ), + m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this ), + m_ratioModel( 2.0f, 0.1f, 10.0f, 0.1f, this ) +{ + connect( &m_freqModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeFrequency( void ) ) ); + + connect( &m_gainModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeGain( void ) ) ); + + connect( &m_ratioModel, SIGNAL( dataChanged( void ) ), + this, SLOT( changeRatio( void ) ) ); + + changeFrequency(); + changeGain(); + changeRatio(); +} + + + + +void bassBoosterControls::changeFrequency( void ) +{ + m_effect->m_bbFX.leftFX().setFrequency( m_freqModel.value() ); + m_effect->m_bbFX.rightFX().setFrequency( m_freqModel.value() ); +} + + + + +void bassBoosterControls::changeGain( void ) +{ + m_effect->m_bbFX.leftFX().setGain( m_gainModel.value() ); + m_effect->m_bbFX.rightFX().setGain( m_gainModel.value() ); +} + + + + +void bassBoosterControls::changeRatio( void ) +{ + m_effect->m_bbFX.leftFX().setRatio( m_ratioModel.value() ); + m_effect->m_bbFX.rightFX().setRatio( m_ratioModel.value() ); +} + + + + +void bassBoosterControls::loadSettings( const QDomElement & _this ) +{ + m_freqModel.setValue( _this.attribute( "freq" ).toFloat() ); + m_gainModel.setValue( _this.attribute( "gain" ).toFloat() ); + m_ratioModel.setValue( _this.attribute( "ratio" ).toFloat() ); +} + + + + +void bassBoosterControls::saveSettings( QDomDocument & _doc, + QDomElement & _this ) +{ + _this.setAttribute( "freq", m_freqModel.value() ); + _this.setAttribute( "gain", m_gainModel.value() ); + _this.setAttribute( "ratio", m_ratioModel.value() ); +} + + + +#include "bassbooster_controls.moc" + diff --git a/plugins/bass_booster/bassbooster_controls.h b/plugins/bass_booster/bassbooster_controls.h new file mode 100644 index 000000000..6409ca746 --- /dev/null +++ b/plugins/bass_booster/bassbooster_controls.h @@ -0,0 +1,79 @@ +/* + * bassbooster_controls.h - controls for bassbooster-effect + * + * Copyright (c) 2008 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef _BASSBOOSTER_CONTROLS_H +#define _BASSBOOSTER_CONTROLS_H + +#include "effect_controls.h" +#include "bassbooster_control_dialog.h" +#include "knob.h" + + +class bassBoosterEffect; + + +class bassBoosterControls : public effectControls +{ + Q_OBJECT +public: + bassBoosterControls( bassBoosterEffect * _eff ); + virtual ~bassBoosterControls() + { + } + + virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); + virtual void loadSettings( const QDomElement & _this ); + inline virtual QString nodeName( void ) const + { + return( "bassboostercontrols" ); + } + + virtual ch_cnt_t getControlCount( void ) + { + return( 3 ); + } + + virtual effectControlDialog * createView( void ) + { + return( new bassBoosterControlDialog( this ) ); + } + + +private slots: + void changeFrequency( void ); + void changeGain( void ); + void changeRatio( void ); + + +private: + bassBoosterEffect * m_effect; + knobModel m_freqModel; + knobModel m_gainModel; + knobModel m_ratioModel; + + friend class bassBoosterControlDialog; + +} ; + +#endif diff --git a/src/core/effect.cpp b/src/core/effect.cpp index 522414c6e..3a0a9849d 100644 --- a/src/core/effect.cpp +++ b/src/core/effect.cpp @@ -65,7 +65,7 @@ void effect::saveSettings( QDomDocument & _doc, QDomElement & _this ) _this.setAttribute( "wet", m_wetDryModel.value() ); _this.setAttribute( "autoquit", m_autoQuitModel.value() ); _this.setAttribute( "gate", m_gateModel.value() ); -// m_controlView->saveState( _doc, _this ); + getControls()->saveState( _doc, _this ); } @@ -77,20 +77,19 @@ void effect::loadSettings( const QDomElement & _this ) m_wetDryModel.setValue( _this.attribute( "wet" ).toFloat() ); m_autoQuitModel.setValue( _this.attribute( "autoquit" ).toFloat() ); m_gateModel.setValue( _this.attribute( "gate" ).toFloat() ); -/* + QDomNode node = _this.firstChild(); while( !node.isNull() ) { if( node.isElement() ) { - if( m_controlView->nodeName() == node.nodeName() ) + if( getControls()->nodeName() == node.nodeName() ) { - m_controlView->restoreState( - node.toElement() ); + getControls()->restoreState( node.toElement() ); } } node = node.nextSibling(); - }*/ + } } diff --git a/src/core/effect_control_dialog.cpp b/src/core/effect_control_dialog.cpp index 48b7c84e0..980eb631f 100644 --- a/src/core/effect_control_dialog.cpp +++ b/src/core/effect_control_dialog.cpp @@ -30,15 +30,16 @@ #include #include "effect_control_dialog.h" +#include "effect_controls.h" #include "effect.h" -effectControlDialog::effectControlDialog( QWidget * _parent, effect * _eff ) : - QWidget( _parent ), - modelView( _eff ), - m_effect( _eff ) +effectControlDialog::effectControlDialog( effectControls * _controls ) : + QWidget( NULL ), + modelView( _controls ), + m_effectControls( _controls ) { - setWindowTitle( m_effect->publicName() ); + setWindowTitle( m_effectControls->getEffect()->publicName() ); } diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index 5b359348e..389bd0a5e 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -128,6 +128,8 @@ songEditor::songEditor( void ) : connect( &m_tempoModel, SIGNAL( dataChanged() ), this, SLOT( setTempo() ) ); + connect( &m_tempoModel, SIGNAL( dataUnchanged() ), + this, SLOT( setTempo() ) ); connect( m_tempoSpinBox, SIGNAL( manualChange() ), this, SLOT( setModified() ) ); diff --git a/src/widgets/effect_view.cpp b/src/widgets/effect_view.cpp index 50977e600..072ce0c8b 100644 --- a/src/widgets/effect_view.cpp +++ b/src/widgets/effect_view.cpp @@ -35,6 +35,7 @@ #include "audio_port.h" #include "caption_menu.h" +#include "effect_controls.h" #include "effect_control_dialog.h" #include "embed.h" #include "engine.h" @@ -112,7 +113,7 @@ effectView::effectView( effect * _model, QWidget * _parent ) : bg.toImage().copy( 5, 44, 195, 10 ) ) ); m_label->setPalette( pal ); - m_controlView = getEffect()->createControlDialog( NULL ); + m_controlView = getEffect()->getControls()->createView(); m_subWindow = engine::getMainWindow()->workspace()->addSubWindow( m_controlView ); connect( m_controlView, SIGNAL( closed() ), @@ -120,7 +121,7 @@ effectView::effectView( effect * _model, QWidget * _parent ) : m_subWindow->hide(); - if( m_controlView->getControlCount() == 0 ) + if( getEffect()->getControls()->getControlCount() == 0 ) { m_editButton->hide(); }