Browse Source

Make the previous changes backwards compatible

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
ccb52ad79c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
7 changed files with 40 additions and 5 deletions
  1. +1
    -0
      source/backend/CarlaEngine.hpp
  2. +0
    -2
      source/backend/CarlaHostImpl.hpp
  3. +7
    -2
      source/backend/CarlaStandalone.cpp
  4. +24
    -1
      source/backend/engine/CarlaEngine.cpp
  5. +6
    -0
      source/backend/engine/CarlaEngineData.cpp
  6. +1
    -0
      source/backend/engine/CarlaEngineInternal.cpp
  7. +1
    -0
      source/backend/engine/CarlaEngineInternal.hpp

+ 1
- 0
source/backend/CarlaEngine.hpp View File

@@ -271,6 +271,7 @@ struct CARLA_API EngineOptions {

const char* binaryDir;
const char* resourceDir;
const char* clientNamePrefix;

bool preventBadBehaviour;
uintptr_t frontendWinId;


+ 0
- 2
source/backend/CarlaHostImpl.hpp View File

@@ -58,7 +58,6 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
void* fileCallbackPtr;

#ifndef BUILD_BRIDGE
CarlaString clientNamePrefix;
EngineOptions engineOptions;
CarlaLogThread logThread;
bool logThreadEnabled;
@@ -73,7 +72,6 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
fileCallback(nullptr),
fileCallbackPtr(nullptr),
#ifndef BUILD_BRIDGE
clientNamePrefix(),
engineOptions(),
logThread(),
logThreadEnabled(false),


+ 7
- 2
source/backend/CarlaStandalone.cpp View File

@@ -299,7 +299,7 @@ static void carla_engine_init_common(const CarlaHostStandalone& standalone, Carl
engine->setOption(CB::ENGINE_OPTION_WINE_SERVER_RT_PRIO, standalone.engineOptions.wine.serverRtPrio, nullptr);
# endif

engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.clientNamePrefix);
engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.engineOptions.clientNamePrefix);
#endif // BUILD_BRIDGE
}

@@ -891,7 +891,12 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
break;

case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX:
shandle.clientNamePrefix = valueStr;
if (shandle.engineOptions.clientNamePrefix != nullptr)
delete[] shandle.engineOptions.clientNamePrefix;

shandle.engineOptions.clientNamePrefix = valueStr != nullptr && valueStr[0] != '\0'
? carla_strdup_safe(valueStr)
: nullptr;
break;
}
}


+ 24
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -2032,7 +2032,15 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
#endif

case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
break;

case ENGINE_OPTION_CLIENT_NAME_PREFIX:
if (pData->options.clientNamePrefix != nullptr)
delete[] pData->options.clientNamePrefix;

pData->options.clientNamePrefix = valueStr != nullptr && valueStr[0] != '\0'
? carla_strdup_safe(valueStr)
: nullptr;
break;
}
}
@@ -2181,7 +2189,12 @@ void CarlaEngine::saveProjectInternal(water::MemoryOutputStream& outStream) cons

outStream << "<?xml version='1.0' encoding='UTF-8'?>\n";
outStream << "<!DOCTYPE CARLA-PROJECT>\n";
outStream << "<CARLA-PROJECT VERSION='2.0'>\n";
outStream << "<CARLA-PROJECT VERSION='2.2'";

if (pData->ignoreClientPrefix)
outStream << " IgnoreClientPrefix='true'";

outStream << ">\n";

const bool isPlugin(getType() == kEngineTypePlugin);
const EngineOptions& options(pData->options);
@@ -2502,6 +2515,16 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc)
pData->actionCanceled = false;
callback(true, true, ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 1, 0, 0, 0.0f, "Loading project");

if (pData->options.clientNamePrefix != nullptr)
{
if (carla_isEqual(xmlElement->getDoubleAttribute("VERSION", 0.0), 2.0) ||
xmlElement->getBoolAttribute("IgnoreClientPrefix", false))
{
pData->ignoreClientPrefix = true;
setOption(ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, "");
}
}

#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
const CarlaScopedValueSetter<bool> csvs(pData->loadingProject, true, false);
#endif


+ 6
- 0
source/backend/engine/CarlaEngineData.cpp View File

@@ -222,6 +222,7 @@ EngineOptions::EngineOptions() noexcept
pathSFZ(nullptr),
binaryDir(nullptr),
resourceDir(nullptr),
clientNamePrefix(nullptr),
preventBadBehaviour(false),
frontendWinId(0)
#ifndef CARLA_OS_WIN
@@ -297,6 +298,11 @@ EngineOptions::~EngineOptions() noexcept
delete[] resourceDir;
resourceDir = nullptr;
}
if (clientNamePrefix != nullptr)
{
delete[] clientNamePrefix;
clientNamePrefix = nullptr;
}
}

#ifndef CARLA_OS_WIN


+ 1
- 0
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -385,6 +385,7 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine)
actionCanceled(false),
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
loadingProject(false),
ignoreClientPrefix(false),
currentProjectFilename(),
currentProjectFolder(),
#endif


+ 1
- 0
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -246,6 +246,7 @@ struct CarlaEngine::ProtectedData {

#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
bool loadingProject;
bool ignoreClientPrefix; // backwards compat only
CarlaString currentProjectFilename;
CarlaString currentProjectFolder;
#endif


Loading…
Cancel
Save