diff --git a/ChangeLog b/ChangeLog index 44d73f466f..61b1fb8c0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2008-06-07 Tobias Doerffel + * src/core/song.cpp: + in song::setModified() only call mainWindow::resetWindowTitle() when + being called with GUI-thread affinity + + * include/automatable_model.h: + * src/core/automatable_model.cpp: + * src/core/automation_pattern.cpp: + added fast and more leight-weight setAutomatedValue() which omits + things like journalling - makes things faster and doesn't introduce + threading-problems + * src/core/mmp.cpp: handle renamed midi-node ("midi" -> "midiport") diff --git a/include/automatable_model.h b/include/automatable_model.h index 62c63f94db..88824f58be 100644 --- a/include/automatable_model.h +++ b/include/automatable_model.h @@ -185,10 +185,9 @@ public: } -// template void setInitValue( const float _value ); -// template + void setAutomatedValue( const float _value ); void setValue( const float _value ); inline void incValue( int _steps ) @@ -196,11 +195,9 @@ public: setValue( m_value + _steps * m_step ); } -// template void setRange( const float _min, const float _max, const float _step = 1 ); -// template void setStep( const float _step ); static void linkModels( automatableModel * _m1, @@ -241,19 +238,6 @@ public: return( "0" ); } -/* int labelToLevel( QString _label ) const - { - switch( m_dataType ) - { - case Float: return( level( - stringToValue( _label ) ) ); - case Integer: return( level( - stringToValue( _label ) ) ); - case Bool: return( level( - stringToValue( _label ) ) ); - } - return( 0 ); - }*/ virtual QString displayName( void ) const { diff --git a/src/core/automatable_model.cpp b/src/core/automatable_model.cpp index 922477d569..e9559cf11b 100644 --- a/src/core/automatable_model.cpp +++ b/src/core/automatable_model.cpp @@ -182,8 +182,6 @@ void automatableModel::setValue( const float _value ) addJournalEntry( journalEntry( 0, m_value - old_val ) ); // notify linked models - - // doesn't work because of implicit typename T for( autoModelVector::iterator it = m_linkedModels.begin(); it != m_linkedModels.end(); ++it ) @@ -210,6 +208,32 @@ void automatableModel::setValue( const float _value ) +void automatableModel::setAutomatedValue( const float _value ) +{ + const float old_val = m_value; + + m_value = fittedValue( _value ); + if( old_val != m_value ) + { + // notify linked models + for( autoModelVector::iterator it = + m_linkedModels.begin(); + it != m_linkedModels.end(); ++it ) + { + if( value() != (*it)->value() && + (*it)->fittedValue( value() ) + != (*it)->value() ) + { + (*it)->setAutomatedValue( value() ); + } + } + emit dataChanged(); + } +} + + + + void automatableModel::setRange( const float _min, const float _max, const float _step ) { diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index dccca526a4..254610f522 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -278,7 +278,8 @@ void automationPattern::processMidiTime( const midiTime & _time ) { if( _time >= 0 ) { - m_object->setValue( m_time_map.lowerBound( -_time ).value() ); + m_object->setAutomatedValue( + m_time_map.lowerBound( -_time ).value() ); } }