added fast and more leight-weight setAutomatedValue() which omits things like journalling - makes things faster and doesn't introduce threading-problems

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1094 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-07 23:05:44 +00:00
parent dfb9395160
commit f9876d4e84
4 changed files with 40 additions and 20 deletions

View File

@@ -1,5 +1,16 @@
2008-06-07 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* 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")

View File

@@ -185,10 +185,9 @@ public:
}
// template<class T>
void setInitValue( const float _value );
// template<class T>
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<class T>
void setRange( const float _min, const float _max,
const float _step = 1 );
// template<class T>
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<float>(
stringToValue<float>( _label ) ) );
case Integer: return( level<int>(
stringToValue<int>( _label ) ) );
case Bool: return( level<bool>(
stringToValue<bool>( _label ) ) );
}
return( 0 );
}*/
virtual QString displayName( void ) const
{

View File

@@ -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<float>() != (*it)->value<float>() &&
(*it)->fittedValue( value<float>() )
!= (*it)->value<float>() )
{
(*it)->setAutomatedValue( value<float>() );
}
}
emit dataChanged();
}
}
void automatableModel::setRange( const float _min, const float _max,
const float _step )
{

View File

@@ -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() );
}
}