diff --git a/include/AutomatableModel.h b/include/AutomatableModel.h index e3c4a9859..6bd68187a 100644 --- a/include/AutomatableModel.h +++ b/include/AutomatableModel.h @@ -225,6 +225,9 @@ protected: float fittedValue( float _value ) const; + float m_minValue; + float m_maxValue; + float m_value; private: void linkModel( AutomatableModel * _model ); @@ -232,10 +235,7 @@ private: DataType m_dataType; - float m_value; float m_initValue; - float m_minValue; - float m_maxValue; float m_step; float m_range; @@ -281,7 +281,18 @@ signals: { \ return AutomatableModel::maxValue(); \ } \ - + \ + inline void setMinValue(type val) \ + { \ + m_minValue = val; \ + if( m_value < m_minValue ) m_value = m_minValue; \ + } \ + \ + inline void setMaxValue(type val) \ + { \ + m_maxValue = val; \ + if( m_value > m_maxValue ) m_value = m_maxValue; \ + } // some typed AutomatableModel-definitions diff --git a/include/FxMixerView.h b/include/FxMixerView.h index 736c70615..cff856659 100644 --- a/include/FxMixerView.h +++ b/include/FxMixerView.h @@ -105,6 +105,8 @@ private: QHBoxLayout * chLayout; QWidget * m_channelAreaWidget; EffectRackView * m_rackView; + + void updateMaxChannelSelector(); } ; #endif diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index f2c7ef44d..2b0819791 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -1,9 +1,9 @@ #ifndef SENDBUTTONINDICATOR_H #define SENDBUTTONINDICATOR_H -#include #include -#include +#include +#include #include "FxLine.h" #include "FxMixerView.h" diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index 2864f266c..7762edcb8 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -44,11 +44,11 @@ AutomatableModel::AutomatableModel( DataType _type, const QString & _display_name, bool _default_constructed ) : Model( _parent, _display_name, _default_constructed ), + m_minValue( _min ), + m_maxValue( _max ), m_dataType( _type ), m_value( _val ), m_initValue( _val ), - m_minValue( _min ), - m_maxValue( _max ), m_step( _step ), m_range( _max - _min ), m_journalEntryReady( false ), diff --git a/src/gui/FxLine.cpp b/src/gui/FxLine.cpp index fe92ba66b..5d57a6b0f 100644 --- a/src/gui/FxLine.cpp +++ b/src/gui/FxLine.cpp @@ -1,9 +1,9 @@ #include "FxLine.h" #include -#include -#include -#include +#include +#include +#include #include "FxMixer.h" #include "FxMixerView.h" diff --git a/src/gui/FxMixerView.cpp b/src/gui/FxMixerView.cpp index 70745ef8c..70832c71b 100644 --- a/src/gui/FxMixerView.cpp +++ b/src/gui/FxMixerView.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #include "FxMixerView.h" #include "knob.h" @@ -45,6 +45,9 @@ #include "MainWindow.h" #include "lcd_spinbox.h" #include "gui_templates.h" +#include "InstrumentTrack.h" +#include "song.h" +#include "bb_track_container.h" FxMixerView::FxMixerView() : QWidget(), @@ -90,7 +93,7 @@ FxMixerView::FxMixerView() : } // add the scrolling section to the main layout - // class for scroll area to pass key presses down + // class solely for scroll area to pass key presses down class ChannelArea : public QScrollArea { public: @@ -167,9 +170,33 @@ void FxMixerView::addNewChannel() chLayout->addWidget(m_fxChannelViews[newChannelIndex]->m_fxLine); updateFxLine(newChannelIndex); + + updateMaxChannelSelector(); } +void FxMixerView::updateMaxChannelSelector() +{ + // update the and max. channel number for every instrument + QVector songTrackList = engine::getSong()->tracks(); + QVector bbTrackList = engine::getBBTrackContainer()->tracks(); + + QVector trackLists[] = {songTrackList, bbTrackList}; + for(int tl=0; tl<2; ++tl) + { + QVector trackList = trackLists[tl]; + for(int i=0; itype() == track::InstrumentTrack ) + { + InstrumentTrack * inst = (InstrumentTrack *) trackList[i]; + inst->effectChannelModel()->setMaxValue( + m_fxChannelViews.size()-1); + } + } + } +} + void FxMixerView::saveSettings( QDomDocument & _doc, QDomElement & _this ) { @@ -286,6 +313,7 @@ void FxMixerView::deleteChannel(int index) } setCurrentFxLine(selLine); + updateMaxChannelSelector(); }