Don't recalculate the song length for every added TCO while loading (#5236)
Don't make LMMS calculate the song length for every added TCO when a new project is created or a project is loaded. Instead do it only once afterwards. This is accomplished by preventing any calculations in `Song::updateLength` if a song is currently loaded. `Song::updateLength` is then called immediately after the loading flag has been set to `false` in both cases. --------- Co-authored-by: IanCaio <iancaio_dev@hotmail.com>
This commit is contained in:
@@ -562,6 +562,8 @@ void Song::playMidiClip( const MidiClip* midiClipToPlay, bool loop )
|
||||
|
||||
void Song::updateLength()
|
||||
{
|
||||
if (m_loadingProject) { return; }
|
||||
|
||||
m_length = 0;
|
||||
m_tracksMutex.lockForRead();
|
||||
for (auto track : tracks())
|
||||
@@ -963,7 +965,7 @@ void Song::createNewProject()
|
||||
QCoreApplication::instance()->processEvents();
|
||||
|
||||
m_loadingProject = false;
|
||||
|
||||
updateLength();
|
||||
Engine::patternStore()->updateAfterTrackAdd();
|
||||
|
||||
Engine::projectJournal()->setJournalling( true );
|
||||
@@ -1206,6 +1208,7 @@ void Song::loadProject( const QString & fileName )
|
||||
}
|
||||
|
||||
m_loadingProject = false;
|
||||
updateLength();
|
||||
setModified(false);
|
||||
m_loadOnLaunch = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user