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

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