Browse Source

Be smarter about giving idle time during load, making it faster

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 5 years ago
parent
commit
df042eed76
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 12 additions and 20 deletions
  1. +12
    -20
      source/backend/engine/CarlaEngine.cpp

+ 12
- 20
source/backend/engine/CarlaEngine.cpp View File

@@ -2496,6 +2496,8 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c


bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alwaysLoadConnections) bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alwaysLoadConnections)
{ {
carla_debug("CarlaEngine::loadProjectInternal(%p, %s) - START", &xmlDoc, bool2str(alwaysLoadConnections));

CarlaScopedPointer<XmlElement> xmlElement(xmlDoc.getDocumentElement(true)); CarlaScopedPointer<XmlElement> xmlElement(xmlDoc.getDocumentElement(true));
CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to parse project file"); CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to parse project file");


@@ -2531,8 +2533,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
xmlElement = xmlDoc.getDocumentElement(false); xmlElement = xmlDoc.getDocumentElement(false);
CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to completely parse project file"); CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to completely parse project file");


callback(true, false, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2542,6 +2542,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
return false; return false;
} }


callback(true, false, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

const bool isPlugin(getType() == kEngineTypePlugin); const bool isPlugin(getType() == kEngineTypePlugin);


// load engine settings first of all // load engine settings first of all
@@ -2656,8 +2658,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
setOption(static_cast<EngineOption>(option), value, valueStr); setOption(static_cast<EngineOption>(option), value, valueStr);
} }


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2680,8 +2680,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
if (bpm >= 20.0 && bpm < 400.0) if (bpm >= 20.0 && bpm < 400.0)
pData->time.setBPM(bpm); pData->time.setBPM(bpm);


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2703,8 +2701,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
CarlaStateSave stateSave; CarlaStateSave stateSave;
stateSave.fillFromXmlElement(isPreset ? xmlElement.get() : elem); stateSave.fillFromXmlElement(isPreset ? xmlElement.get() : elem);


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2727,8 +2723,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw


if (const CarlaPluginPtr plugin = pData->plugins[pluginId].plugin) if (const CarlaPluginPtr plugin = pData->plugins[pluginId].plugin)
{ {
callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2774,6 +2768,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
carla_stderr2("Failed to load a linuxsampler LV2 plugin, GIG file won't be loaded"); carla_stderr2("Failed to load a linuxsampler LV2 plugin, GIG file won't be loaded");
} }


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);
continue; continue;
} }
#endif #endif
@@ -2844,6 +2839,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
{ {
carla_stderr("Damn, we failed... :("); carla_stderr("Damn, we failed... :(");
} }

callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);
} }
} }
break; break;
@@ -2877,8 +2874,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw


if (const CarlaPluginPtr plugin = pData->plugins[pluginId].plugin) if (const CarlaPluginPtr plugin = pData->plugins[pluginId].plugin)
{ {
callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2917,6 +2912,9 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
{ {
carla_stderr2("Failed to load a plugin '%s', error was:\n%s", stateSave.name, getLastError()); carla_stderr2("Failed to load a plugin '%s', error was:\n%s", stateSave.name, getLastError());
} }

if (! isPreset)
callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);
} }


if (isPreset) if (isPreset)
@@ -2936,8 +2934,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false); plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
} }


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -2988,8 +2984,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
} }
} }


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -3039,8 +3033,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
} }
} }


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -3097,8 +3089,6 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
} }
} }


callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr);

if (pData->aboutToClose) if (pData->aboutToClose)
return true; return true;


@@ -3204,6 +3194,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw


callback(true, true, ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0, 0.0f, nullptr); callback(true, true, ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0, 0.0f, nullptr);
callback(true, true, ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0, 0.0f, "Loading project"); callback(true, true, ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0, 0.0f, "Loading project");

carla_debug("CarlaEngine::loadProjectInternal(%p, %s) - END", &xmlDoc, bool2str(alwaysLoadConnections));
return true; return true;


#ifdef BUILD_BRIDGE_ALTERNATIVE_ARCH #ifdef BUILD_BRIDGE_ALTERNATIVE_ARCH


Loading…
Cancel
Save