diff --git a/ChangeLog b/ChangeLog index 34377a10c..1c0fc5ad2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-04 Tobias Doerffel + + * include/automatable_model.h: + * include/automatable_model_templates.h: + cleanups and optimizations in value( int ) + 2008-04-04 Paul Giblock * include/controller.h: diff --git a/include/automatable_model.h b/include/automatable_model.h index c9de3d564..248b41e20 100644 --- a/include/automatable_model.h +++ b/include/automatable_model.h @@ -104,19 +104,12 @@ public: return( static_cast( _v ) ); } - inline virtual T value( void ) const - { - return value( 0 ); - } - - - inline virtual T value( int _frameOffset ) const + inline virtual T value( int _frameOffset = 0 ) const { if( m_controller != NULL ) { - return minValue() + - ( maxValue() - minValue() ) * - castValue( m_controller->currentValue( _frameOffset ) ); + return minValue() + castValue( m_range * + m_controller->currentValue( _frameOffset ) ); } return m_value; @@ -235,6 +228,7 @@ private: T m_initValue; T m_minValue; T m_maxValue; + T m_range; T m_step; int m_curLevel; diff --git a/include/automatable_model_templates.h b/include/automatable_model_templates.h index 8742de78f..d33c8e1f5 100644 --- a/include/automatable_model_templates.h +++ b/include/automatable_model_templates.h @@ -50,6 +50,7 @@ automatableModel::automatableModel( m_initValue( _val ), m_minValue( _min ), m_maxValue( _max ), + m_range( _max-_min ), m_step( _step ), m_automationPattern( NULL ), m_track( NULL ), @@ -183,6 +184,7 @@ void automatableModel::setRange( const T _min, const T _max, { qSwap( m_minValue, m_maxValue ); } + m_range = m_maxValue - m_minValue; setStep( _step ); // re-adjust value autoModel::setInitValue( value() );