diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index 363693cc9..6f72c7885 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -1036,6 +1036,11 @@ public: */ bool setAboutToClose() noexcept; + /*! + * TODO. + */ + bool isLoadingProject() const noexcept; + // ------------------------------------------------------------------- // Options diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index e7fdcf0e0..203c0530e 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1301,6 +1301,11 @@ bool CarlaEngine::setAboutToClose() noexcept return (pData->isIdling == 0); } +bool CarlaEngine::isLoadingProject() const noexcept +{ + return pData->loadingProject; +} + // ----------------------------------------------------------------------- // Global options diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index cca618c34..19c7dfeca 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -888,9 +888,10 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) setPanning(stateSave.panning, true, true); setCtrlChannel(stateSave.ctrlChannel, true, true); setActive(stateSave.active, true, true); -#endif - pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0f, nullptr); + if (! pData->engine->isLoadingProject()) + pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0f, nullptr); +#endif } bool CarlaPlugin::saveStateToFile(const char* const filename) diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index e2eef2d13..c133c5c97 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -2085,7 +2085,9 @@ protected: } } - pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0f, nullptr); + if (! fIsInitializing) + pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0f, nullptr); + ret = 1; break;