@@ -811,96 +811,82 @@ void Edit::initialise (const Options& options)
811811 isLoadInProgress = true ;
812812 tempDirectory = juce::File ();
813813
814- auto stateVersion = state[IDs::appVersion].toString ();
815- bool isLegacy = stateVersion.isEmpty () || stateVersion.upToFirstOccurrenceOf (" ." , false , false ).getIntValue () < 6 ;
814+ if (! state.hasProperty (IDs::creationTime))
815+ addValueTreeProperties (state,
816+ IDs::appVersion, engine.getPropertyStorage ().getApplicationVersion (),
817+ IDs::creationTime, juce::Time::getCurrentTime ().toMilliseconds ());
818+
819+ lastSignificantChange.referTo (state, IDs::lastSignificantChange, nullptr ,
820+ juce::String::toHexString (juce::Time::getCurrentTime ().toMilliseconds ()));
821+
822+ globalMacros = std::make_unique<GlobalMacros> (*this );
823+ initialiseTempoAndPitch ();
824+ initialiseTransport ();
825+ initialiseVideo ();
826+ initialiseClickTrack ();
827+ initialiseMasterVolume (options);
828+ initialiseRacks ();
829+ initialiseMasterPlugins ();
830+ initialiseAudioDevices ();
831+ loadTracks ();
816832
817- auto init = [ this , &options, isLegacy]
833+ if (loadContext != nullptr )
818834 {
819- addValueTreeProperties (state, IDs::appVersion, engine.getPropertyStorage ().getApplicationVersion ());
820-
821- if (! state.hasProperty (IDs::creationTime))
822- addValueTreeProperties (state, IDs::creationTime, juce::Time::getCurrentTime ().toMilliseconds ());
835+ assert (loadContext->totalNumTracks == loadContext->numTracksLoaded );
836+ loadContext->progress = 1 .0f ;
837+ }
823838
824- lastSignificantChange.referTo (state, IDs::lastSignificantChange, nullptr ,
825- juce::String::toHexString (juce::Time::getCurrentTime ().toMilliseconds ()));
839+ initialiseTracks (options);
840+ initialiseARA ();
841+ updateMuteSoloStatuses ();
842+ readFrozenTracksFiles ();
826843
827- globalMacros = std::make_unique<GlobalMacros> (*this );
828- initialiseTempoAndPitch ();
829- initialiseTransport ();
830- initialiseVideo ();
831- initialiseClickTrack ();
832- initialiseMasterVolume (options);
833- initialiseRacks ();
834- initialiseMasterPlugins ();
835- initialiseAudioDevices ();
836- loadTracks ();
844+ getLength (); // forcibly update the length before the isLoadInProgress is disabled.
837845
838- if (loadContext != nullptr )
839- {
840- assert (loadContext->totalNumTracks == loadContext->numTracksLoaded || isLegacy);
841- (void ) isLegacy;
842- loadContext->progress = 1 .0f ;
843- }
846+ for (auto t : getAllTracks (*this ))
847+ t->cancelAnyPendingUpdates ();
844848
845- initialiseTracks (options);
846- initialiseARA ();
847- updateMuteSoloStatuses ();
848- readFrozenTracksFiles ();
849+ initialiseControllerMappings ();
849850
850- getLength (); // forcibly update the length before the isLoadInProgress is disabled.
851+ callBlocking ([this ]
852+ {
853+ TemporaryFileManager::purgeOrphanFreezeAndProxyFiles (*this );
851854
852- for (auto t : getAllTracks (*this ))
853- t->cancelAnyPendingUpdates ();
855+ // Must be set to false before curve updates
856+ // but set inside here to give the message loop some time to dispatch async updates
857+ isLoadInProgress = false ;
858+ auto cursorPos = getTransport ().getPosition ();
854859
855- initialiseControllerMappings ();
860+ for (auto mpl : getAllMacroParameterLists (*this ))
861+ for (auto mp : mpl->getMacroParameters ())
862+ mp->initialise ();
856863
857- callBlocking ([ this ]
858- {
859- TemporaryFileManager::purgeOrphanFreezeAndProxyFiles (* this );
864+ for ( auto ap : getAllAutomatableParams ( true ))
865+ {
866+ ap-> updateStream ( );
860867
861- // Must be set to false before curve updates
862- // but set inside here to give the message loop some time to dispatch async updates
863- isLoadInProgress = false ;
864- auto cursorPos = getTransport ().getPosition ();
868+ if (ap->isAutomationActive ())
869+ ap->updateFromAutomationSources (cursorPos);
870+ }
865871
866- for (auto mpl : getAllMacroParameterLists (*this ))
867- for ( auto mp : mpl-> getMacroParameters ())
868- mp-> initialise ( );
872+ for (auto effect : getAllClipEffects (*this ))
873+ effect-> initialise ();
874+ } );
869875
870- for (auto ap : getAllAutomatableParams (true ))
871- {
872- ap->updateStream ();
876+ cancelAnyPendingUpdates ();
873877
874- if (ap->isAutomationActive ())
875- ap->updateFromAutomationSources (cursorPos);
876- }
878+ // reset the change status asynchronously to take into account deferred updates
879+ changeResetterTimer = std::make_unique<EditChangeResetterTimer> (*this );
877880
878- for (auto effect : getAllClipEffects (*this ))
879- effect->initialise ();
880- });
881-
882- cancelAnyPendingUpdates ();
883-
884- // reset the change status asynchronously to take into account deferred updates
885- changeResetterTimer = std::make_unique<EditChangeResetterTimer> (*this );
886-
887- #if TRACKTION_ENABLE_AUTOMAP && TRACKTION_ENABLE_CONTROL_SURFACES
888- if (shouldPlay ())
889- if (auto na = engine.getExternalControllerManager ().getAutomap ())
890- na->load (*this );
891- #endif
892-
893- auxBusses = state.getChildWithName (" AUXBUSNAMES" );
881+ #if TRACKTION_ENABLE_AUTOMAP && TRACKTION_ENABLE_CONTROL_SURFACES
882+ if (shouldPlay ())
883+ if (auto na = engine.getExternalControllerManager ().getAutomap ())
884+ na->load (*this );
885+ #endif
894886
895- getUndoManager ().clearUndoHistory ();
896- };
887+ auxBusses = state.getChildWithName (" AUXBUSNAMES" );
897888
898- // / When loading a legacy edit, we need to do it all on the message thread, because
899- // / it causes all kinds of indirect updates to values.
900- if (isLegacy)
901- callBlocking ([&] { init (); });
902- else
903- init ();
889+ getUndoManager ().clearUndoHistory ();
904890
905891 DBG (" Edit loaded in: " << loadTimer.getDescription ());
906892}
0 commit comments