mirror of
https://github.com/LMMS/lmms.git
synced 2026-01-31 09:43:32 -05:00
optimized track::length()-method
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@879 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -106,6 +106,7 @@ void trackContentObject::movePosition( const midiTime & _pos )
|
||||
{
|
||||
addJournalEntry( journalEntry( Move, m_startPosition - _pos ) );
|
||||
m_startPosition = _pos;
|
||||
engine::getSong()->updateLength();
|
||||
}
|
||||
emit positionChanged();
|
||||
}
|
||||
@@ -119,6 +120,7 @@ void trackContentObject::changeLength( const midiTime & _length )
|
||||
{
|
||||
addJournalEntry( journalEntry( Resize, m_length - _length ) );
|
||||
m_length = _length;
|
||||
engine::getSong()->updateLength();
|
||||
}
|
||||
emit lengthChanged();
|
||||
}
|
||||
@@ -1615,13 +1617,17 @@ void track::removeTact( const midiTime & _pos )
|
||||
tact track::length( void ) const
|
||||
{
|
||||
// find last end-position
|
||||
midiTime last = 0;
|
||||
Sint32 last = 0;
|
||||
for( tcoVector::const_iterator it = m_trackContentObjects.begin();
|
||||
it != m_trackContentObjects.end(); ++it )
|
||||
{
|
||||
last = tMax( ( *it )->endPosition(), last );
|
||||
const Sint32 cur = ( *it )->endPosition();
|
||||
if( cur > last )
|
||||
{
|
||||
last = cur;
|
||||
}
|
||||
}
|
||||
return( last.getTact() + ( ( last.getTact64th() != 0 ) ? 1 : 0 ) );
|
||||
return( last/64 + 1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user