Browse Source

Cleanup use of CarlaString

Signed-off-by: falkTX <falktx@falktx.com>
pull/1961/merge
falkTX 3 months ago
parent
commit
7eaf104d3d
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
17 changed files with 148 additions and 277 deletions
  1. +30
    -31
      source/backend/engine/CarlaEngine.cpp
  2. +5
    -6
      source/backend/engine/CarlaEngineBridge.cpp
  3. +1
    -2
      source/backend/engine/CarlaEngineNative.cpp
  4. +9
    -10
      source/backend/plugin/CarlaPlugin.cpp
  5. +21
    -23
      source/backend/plugin/CarlaPluginBridge.cpp
  6. +4
    -21
      source/backend/plugin/CarlaPluginFluidSynth.cpp
  7. +3
    -5
      source/backend/plugin/CarlaPluginJack.cpp
  8. +4
    -7
      source/backend/plugin/CarlaPluginLADSPADSSI.cpp
  9. +4
    -21
      source/backend/plugin/CarlaPluginNative.cpp
  10. +3
    -18
      source/backend/plugin/CarlaPluginSFZero.cpp
  11. +4
    -4
      source/backend/utils/PluginDiscovery.cpp
  12. +4
    -5
      source/bridges-plugin/CarlaBridgePlugin.cpp
  13. +12
    -26
      source/bridges-plugin/CarlaBridgeSingleLV2.cpp
  14. +8
    -20
      source/utils/CarlaBackendUtils.hpp
  15. +8
    -21
      source/utils/CarlaBridgeUtils.hpp
  16. +26
    -41
      source/utils/CarlaStateUtils.cpp
  17. +2
    -16
      source/utils/CarlaStateUtils.hpp

+ 30
- 31
source/backend/engine/CarlaEngine.cpp View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

/* TODO:
@@ -46,7 +46,6 @@ using water::Array;
using water::CharPointer_UTF8;
using water::File;
using water::MemoryOutputStream;
using water::String;
using water::StringArray;
using water::XmlDocument;
using water::XmlElement;
@@ -2367,8 +2366,8 @@ void CarlaEngine::saveProjectInternal(water::MemoryOutputStream& outStream) cons
outSettings << " <PreferUiBridges>" << bool2str(options.preferUiBridges) << "</PreferUiBridges>\n";
outSettings << " <UIsAlwaysOnTop>" << bool2str(options.uisAlwaysOnTop) << "</UIsAlwaysOnTop>\n";

outSettings << " <MaxParameters>" << String(options.maxParameters) << "</MaxParameters>\n";
outSettings << " <UIBridgesTimeout>" << String(options.uiBridgesTimeout) << "</UIBridgesTimeout>\n";
outSettings << " <MaxParameters>" << water::String(options.maxParameters) << "</MaxParameters>\n";
outSettings << " <UIBridgesTimeout>" << water::String(options.uiBridgesTimeout) << "</UIBridgesTimeout>\n";

if (isPlugin)
{
@@ -2585,12 +2584,12 @@ void CarlaEngine::saveProjectInternal(water::MemoryOutputStream& outStream) cons
outStream << "</CARLA-PROJECT>\n";
}

static String findBinaryInCustomPath(const char* const searchPath, const char* const binary)
static water::String findBinaryInCustomPath(const char* const searchPath, const char* const binary)
{
const StringArray searchPaths(StringArray::fromTokens(searchPath, CARLA_OS_SPLIT_STR, ""));

// try direct filename first
String jbinary(binary);
water::String jbinary(binary);

// adjust for current platform
#ifdef CARLA_OS_WIN
@@ -2601,7 +2600,7 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c
jbinary = jbinary.substring(2).replaceCharacter('\\', '/');
#endif

String filename = File(jbinary.toRawUTF8()).getFileName();
water::String filename = File(jbinary.toRawUTF8()).getFileName();

int searchFlags = File::findFiles|File::ignoreHiddenFiles;

@@ -2613,7 +2612,7 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c
#endif

std::vector<File> results;
for (const String *it=searchPaths.begin(), *end=searchPaths.end(); it != end; ++it)
for (const water::String *it=searchPaths.begin(), *end=searchPaths.end(); it != end; ++it)
{
const File path(it->toRawUTF8());

@@ -2636,9 +2635,9 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c
filename = File(jbinary.toRawUTF8()).getFileNameWithoutExtension() + ".so";
#endif
else
return String();
return {};

for (const String *it=searchPaths.begin(), *end=searchPaths.end(); it != end; ++it)
for (const water::String *it=searchPaths.begin(), *end=searchPaths.end(); it != end; ++it)
{
const File path(it->toRawUTF8());

@@ -2649,7 +2648,7 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c
return results.front().getFullPathName();
}

return String();
return {};
}

bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alwaysLoadConnections)
@@ -2659,7 +2658,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
CarlaScopedPointer<XmlElement> xmlElement(xmlDoc.getDocumentElement(true));
CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to parse project file");

const String& xmlType(xmlElement->getTagName());
const water::String& xmlType(xmlElement->getTagName());
const bool isPreset(xmlType.equalsIgnoreCase("carla-preset"));

if (! (xmlType.equalsIgnoreCase("carla-project") || isPreset))
@@ -2713,8 +2712,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
{
for (XmlElement* settElem = elem->getFirstChildElement(); settElem != nullptr; settElem = settElem->getNextElement())
{
const String& tag(settElem->getTagName());
const String text(settElem->getAllSubText().trim());
const water::String& tag(settElem->getTagName());
const water::String text(settElem->getAllSubText().trim());

/** some settings might be incorrect or require extra work,
so we call setOption rather than modifying them direly */
@@ -2847,7 +2846,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
{
if (XmlElement* const bpmElem = elem->getChildByName("BeatsPerMinute"))
{
const String bpmText(bpmElem->getAllSubText().trim());
const water::String bpmText(bpmElem->getAllSubText().trim());
const double bpm = bpmText.getDoubleValue();

// some sane limits
@@ -2868,7 +2867,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
// and we handle plugins
for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement())
{
const String& tagName(elem->getTagName());
const water::String& tagName(elem->getTagName());

if (isPreset || tagName == "Plugin")
{
@@ -2906,7 +2905,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
return false;
}

String lsState;
water::String lsState;
lsState << "0.35\n";
lsState << "18 0 Chromatic\n";
lsState << "18 1 Drum Kits\n";
@@ -3046,7 +3045,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
carla_stderr("Plugin binary '%s' doesn't exist on this filesystem, let's look for it...",
stateSave.binary);

String result = findBinaryInCustomPath(searchPath, stateSave.binary);
water::String result = findBinaryInCustomPath(searchPath, stateSave.binary);

if (result.isEmpty())
{
@@ -3198,12 +3197,12 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw

if (XmlElement* const elemPositions = elemPatchbay->getChildByName("Positions"))
{
String name;
water::String name;
PatchbayPosition ppos = { nullptr, -1, 0, 0, 0, 0, false };

for (XmlElement* patchElem = elemPositions->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement())
{
const String& patchTag(patchElem->getTagName());
const water::String& patchTag(patchElem->getTagName());

if (patchTag != "Position")
continue;
@@ -3211,7 +3210,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
XmlElement* const patchName = patchElem->getChildByName("Name");
CARLA_SAFE_ASSERT_CONTINUE(patchName != nullptr);

const String nameText(patchName->getAllSubText().trim());
const water::String nameText(patchName->getAllSubText().trim());
name = xmlSafeString(nameText, false);

ppos.name = name.toRawUTF8();
@@ -3256,12 +3255,12 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
{
if (XmlElement* const elemPositions = elemPatchbay->getChildByName("Positions"))
{
String name;
water::String name;
PatchbayPosition ppos = { nullptr, -1, 0, 0, 0, 0, false };

for (XmlElement* patchElem = elemPositions->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement())
{
const String& patchTag(patchElem->getTagName());
const water::String& patchTag(patchElem->getTagName());

if (patchTag != "Position")
continue;
@@ -3269,7 +3268,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
XmlElement* const patchName = patchElem->getChildByName("Name");
CARLA_SAFE_ASSERT_CONTINUE(patchName != nullptr);

const String nameText(patchName->getAllSubText().trim());
const water::String nameText(patchName->getAllSubText().trim());
name = xmlSafeString(nameText, false);

ppos.name = name.toRawUTF8();
@@ -3327,7 +3326,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw

for (XmlElement* patchElem = elem->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement())
{
const String& patchTag(patchElem->getTagName());
const water::String& patchTag(patchElem->getTagName());

if (patchTag != "Connection")
continue;
@@ -3337,8 +3336,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw

for (XmlElement* connElem = patchElem->getFirstChildElement(); connElem != nullptr; connElem = connElem->getNextElement())
{
const String& tag(connElem->getTagName());
const String text(connElem->getAllSubText().trim());
const water::String& tag(connElem->getTagName());
const water::String text(connElem->getAllSubText().trim());

/**/ if (tag == "Source")
sourcePort = xmlSafeString(text, false);
@@ -3401,7 +3400,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw

for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement())
{
const String& tagName(elem->getTagName());
const water::String& tagName(elem->getTagName());

// check if we want to load patchbay-mode connections into an external (multi-client) graph
if (tagName == "Patchbay")
@@ -3427,7 +3426,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw

for (XmlElement* patchElem = elem->getFirstChildElement(); patchElem != nullptr; patchElem = patchElem->getNextElement())
{
const String& patchTag(patchElem->getTagName());
const water::String& patchTag(patchElem->getTagName());

if (patchTag != "Connection")
continue;
@@ -3437,8 +3436,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw

for (XmlElement* connElem = patchElem->getFirstChildElement(); connElem != nullptr; connElem = connElem->getNextElement())
{
const String& tag(connElem->getTagName());
const String text(connElem->getAllSubText().trim());
const water::String& tag(connElem->getTagName());
const water::String text(connElem->getAllSubText().trim());

/**/ if (tag == "Source")
sourcePort = xmlSafeString(text, false);


+ 5
- 6
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -34,7 +34,6 @@

using water::File;
using water::MemoryBlock;
using water::String;

CARLA_BACKEND_START_NAMESPACE

@@ -926,7 +925,7 @@ public:
CARLA_SAFE_ASSERT_BREAK(bigValueFilePathTry.text[0] != '\0');
if (! plugin->isEnabled()) break;

String bigValueFilePath(bigValueFilePathTry.text);
water::String bigValueFilePath(bigValueFilePathTry.text);

#ifdef CARLA_OS_WIN
// check if running under Wine
@@ -967,7 +966,7 @@ public:
CARLA_SAFE_ASSERT_BREAK(chunkFilePathTry.text[0] != '\0');
if (! plugin->isEnabled()) break;

String chunkFilePath(chunkFilePathTry.text);
water::String chunkFilePath(chunkFilePathTry.text);

#ifdef CARLA_OS_WIN
// check if running under Wine
@@ -978,7 +977,7 @@ public:
File chunkFile(chunkFilePath.toRawUTF8());
CARLA_SAFE_ASSERT_BREAK(chunkFile.existsAsFile());

String chunkDataBase64(chunkFile.loadFileAsString());
water::String chunkDataBase64(chunkFile.loadFileAsString());
chunkFile.deleteFile();
CARLA_SAFE_ASSERT_BREAK(chunkDataBase64.isNotEmpty());

@@ -1105,7 +1104,7 @@ public:
{
if (valueLen > maxLocalValueLen)
{
String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());
water::String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());

filePath += CARLA_OS_SEP_STR ".CarlaCustomData_";
filePath += fShmAudioPool.getFilenameSuffix();
@@ -1143,7 +1142,7 @@ public:
CarlaString dataBase64 = CarlaString::asBase64(data, dataSize);
CARLA_SAFE_ASSERT_BREAK(dataBase64.length() > 0);

String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());
water::String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());

filePath += CARLA_OS_SEP_STR ".CarlaChunk_";
filePath += fShmAudioPool.getFilenameSuffix();


+ 1
- 2
source/backend/engine/CarlaEngineNative.cpp View File

@@ -38,7 +38,6 @@

using water::File;
using water::MemoryOutputStream;
using water::String;
using water::XmlDocument;
using water::XmlElement;

@@ -1520,7 +1519,7 @@ protected:
pData->runner.start();

fOptionsForced = true;
const String state(data);
const water::String state(data);
XmlDocument xml(state);
loadProjectInternal(xml, true);



+ 9
- 10
source/backend/plugin/CarlaPlugin.cpp View File

@@ -24,7 +24,6 @@ using water::CharPointer_UTF8;
using water::File;
using water::MemoryOutputStream;
using water::Result;
using water::String;
using water::XmlDocument;
using water::XmlElement;

@@ -1126,8 +1125,8 @@ bool CarlaPlugin::exportAsLV2(const char* const lv2path)

for (uint32_t i=1; i<midiIns; ++i)
{
const String portIndexNum(portIndex++);
const String portIndexLabel(portIndex);
const water::String portIndexNum(portIndex++);
const water::String portIndexLabel(portIndex);

mainStream << " lv2:port [\n";
mainStream << " a lv2:InputPort, atom:AtomPort ;\n";
@@ -1152,8 +1151,8 @@ bool CarlaPlugin::exportAsLV2(const char* const lv2path)

for (uint32_t i=0; i<midiOuts; ++i)
{
const String portIndexNum(portIndex++);
const String portIndexLabel(portIndex);
const water::String portIndexNum(portIndex++);
const water::String portIndexLabel(portIndex);

mainStream << " lv2:port [\n";
mainStream << " a lv2:InputPort, atom:AtomPort ;\n";
@@ -1180,8 +1179,8 @@ bool CarlaPlugin::exportAsLV2(const char* const lv2path)

for (uint32_t i=0; i<pData->audioIn.count; ++i)
{
const String portIndexNum(portIndex++);
const String portIndexLabel(i+1);
const water::String portIndexNum(portIndex++);
const water::String portIndexLabel(i+1);

mainStream << " lv2:port [\n";
mainStream << " a lv2:InputPort, lv2:AudioPort ;\n";
@@ -1193,8 +1192,8 @@ bool CarlaPlugin::exportAsLV2(const char* const lv2path)

for (uint32_t i=0; i<pData->audioOut.count; ++i)
{
const String portIndexNum(portIndex++);
const String portIndexLabel(i+1);
const water::String portIndexNum(portIndex++);
const water::String portIndexLabel(i+1);

mainStream << " lv2:port [\n";
mainStream << " a lv2:OutputPort, lv2:AudioPort ;\n";
@@ -1216,7 +1215,7 @@ bool CarlaPlugin::exportAsLV2(const char* const lv2path)
const ParameterData& paramData(pData->param.data[i]);
const ParameterRanges& paramRanges(pData->param.ranges[i]);

const String portIndexNum(portIndex++);
const water::String portIndexNum(portIndex++);

mainStream << " lv2:port [\n";



+ 21
- 23
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -27,8 +27,6 @@

using water::ChildProcess;
using water::File;
using water::String;
using water::StringArray;

CARLA_BACKEND_START_NAMESPACE

@@ -40,17 +38,17 @@ static const ExternalMidiNote kExternalMidiNoteFallback = { -1, 0, 0 };
// --------------------------------------------------------------------------------------------------------------------

#ifndef CARLA_OS_WIN
static String findWinePrefix(const String filename, const int recursionLimit = 10)
static water::String findWinePrefix(const water::String filename, const int recursionLimit = 10)
{
if (recursionLimit == 0 || filename.length() < 5 || ! filename.contains("/"))
return "";
return {};

const String path(filename.upToLastOccurrenceOf("/", false, false));
const water::String path(filename.upToLastOccurrenceOf("/", false, false));

if (File(String(path + "/dosdevices").toRawUTF8()).isDirectory())
if (File(water::String(path + "/dosdevices").toRawUTF8()).isDirectory())
return path;

return findWinePrefix(path, recursionLimit-1);
return findWinePrefix(path, recursionLimit - 1);
}
#endif

@@ -172,18 +170,18 @@ protected:

const EngineOptions& options(kEngine->getOptions());

String filename(kPlugin->getFilename());
water::String filename(kPlugin->getFilename());

if (filename.isEmpty())
filename = "(none)";

StringArray arguments;
water::StringArray arguments;

#ifndef CARLA_OS_WIN
// start with "wine" if needed
if (fBridgeBinary.endsWithIgnoreCase(".exe"))
{
String wineCMD;
water::String wineCMD;

if (options.wine.executable != nullptr && options.wine.executable[0] != '\0')
{
@@ -191,7 +189,7 @@ protected:

if (fBridgeBinary.endsWithIgnoreCase("64.exe")
&& options.wine.executable[0] == CARLA_OS_SEP
&& File(String(wineCMD + "64").toRawUTF8()).existsAsFile())
&& File(water::String(wineCMD + "64").toRawUTF8()).existsAsFile())
wineCMD += "64";
}
else
@@ -227,7 +225,7 @@ protected:
arguments.add(fLabel);

// uniqueId
arguments.add(String(static_cast<water::int64>(kPlugin->getUniqueId())));
arguments.add(water::String(static_cast<water::int64>(kPlugin->getUniqueId())));

bool started;

@@ -412,10 +410,10 @@ private:
CarlaEngine* const kEngine;
CarlaPlugin* const kPlugin;

String fBinaryArchName;
String fBridgeBinary;
String fLabel;
String fShmIds;
water::String fBinaryArchName;
water::String fBridgeBinary;
water::String fLabel;
water::String fShmIds;
#ifndef CARLA_OS_WIN
CarlaString fWinePrefix;
#endif
@@ -978,7 +976,7 @@ public:
{
if (valueLen > maxLocalValueLen)
{
String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());
water::String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());

filePath += CARLA_OS_SEP_STR ".CarlaCustomData_";
filePath += fShmAudioPool.getFilenameSuffix();
@@ -1016,7 +1014,7 @@ public:
CarlaString dataBase64(CarlaString::asBase64(data, dataSize));
CARLA_SAFE_ASSERT_RETURN(dataBase64.length() > 0,);

String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());
water::String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());

filePath += CARLA_OS_SEP_STR ".CarlaChunk_";
filePath += fShmAudioPool.getFilenameSuffix();
@@ -2518,13 +2516,13 @@ public:
{
const BridgeTextReader bigValueFilePath(fShmNonRtServerControl);

String realBigValueFilePath(bigValueFilePath.text);
water::String realBigValueFilePath(bigValueFilePath.text);

#ifndef CARLA_OS_WIN
// Using Wine, fix temp dir
if (fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64)
{
const StringArray driveLetterSplit(StringArray::fromTokens(realBigValueFilePath, ":/", ""));
const water::StringArray driveLetterSplit(water::StringArray::fromTokens(realBigValueFilePath, ":/", ""));
carla_stdout("big value save path BEFORE => '%s' | using wineprefix '%s'", realBigValueFilePath.toRawUTF8(), fWinePrefix.buffer());

realBigValueFilePath = fWinePrefix.buffer();
@@ -2559,13 +2557,13 @@ public:
// chunkFilePath
const BridgeTextReader chunkFilePath(fShmNonRtServerControl);

String realChunkFilePath(chunkFilePath.text);
water::String realChunkFilePath(chunkFilePath.text);

#ifndef CARLA_OS_WIN
// Using Wine, fix temp dir
if (fBinaryType == BINARY_WIN32 || fBinaryType == BINARY_WIN64)
{
const StringArray driveLetterSplit(StringArray::fromTokens(realChunkFilePath, ":/", ""));
const water::StringArray driveLetterSplit(water::StringArray::fromTokens(realChunkFilePath, ":/", ""));
carla_stdout("chunk save path BEFORE => '%s' | using wineprefix '%s'", realChunkFilePath.toRawUTF8(), fWinePrefix.buffer());

realChunkFilePath = fWinePrefix.buffer();
@@ -3227,7 +3225,7 @@ private:
CarlaString dataBase64(CarlaString::asBase64(data, dataSize));
CARLA_SAFE_ASSERT_RETURN(dataBase64.length() > 0, true);

String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());
water::String filePath(File::getSpecialLocation(File::tempDirectory).getFullPathName());

filePath += CARLA_OS_SEP_STR ".CarlaChunk_";
filePath += fShmAudioPool.getFilenameSuffix();


+ 4
- 21
source/backend/plugin/CarlaPluginFluidSynth.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla FluidSynth Plugin
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaPluginInternal.hpp"
#include "CarlaEngine.hpp"
@@ -29,9 +15,6 @@

#define FLUID_DEFAULT_POLYPHONY 64

using water::String;
using water::StringArray;

CARLA_BACKEND_START_NAMESPACE

// -------------------------------------------------------------------------------------------------------------------
@@ -519,12 +502,12 @@ public:
if (std::strcmp(key, "midiPrograms") != 0)
return carla_stderr2("CarlaPluginFluidSynth::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is not string", type, key, value, bool2str(sendGui));

StringArray midiProgramList(StringArray::fromTokens(value, ":", ""));
water::StringArray midiProgramList(water::StringArray::fromTokens(value, ":", ""));

if (midiProgramList.size() == MAX_MIDI_CHANNELS)
{
uint8_t channel = 0;
for (String *it=midiProgramList.begin(), *end=midiProgramList.end(); it != end; ++it)
for (water::String *it=midiProgramList.begin(), *end=midiProgramList.end(); it != end; ++it)
{
const int index(it->getIntValue());



+ 3
- 5
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -36,8 +36,6 @@

using water::ChildProcess;
using water::File;
using water::String;
using water::StringArray;

CARLA_BACKEND_START_NAMESPACE

@@ -333,15 +331,15 @@ protected:
carla_stderr("CarlaPluginJackThread::run() - already running");
}

String name(kPlugin->getName());
String filename(kPlugin->getFilename());
water::String name(kPlugin->getName());
water::String filename(kPlugin->getFilename());

if (name.isEmpty())
name = "(none)";

CARLA_SAFE_ASSERT_RETURN(filename.isNotEmpty(),);

StringArray arguments;
water::StringArray arguments;

// binary
arguments.addTokens(filename, true);


+ 4
- 7
source/backend/plugin/CarlaPluginLADSPADSSI.cpp View File

@@ -18,9 +18,6 @@
using water::ChildProcess;
#endif

using water::String;
using water::StringArray;

#define CARLA_PLUGIN_DSSI_OSC_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \
/* check argument count */ \
if (argc != argcToCompare) \
@@ -121,8 +118,8 @@ public:
return;
}

String name(kPlugin->getName());
String filename(kPlugin->getFilename());
water::String name(kPlugin->getName());
water::String filename(kPlugin->getFilename());

if (name.isEmpty())
name = "(none)";
@@ -130,13 +127,13 @@ public:
if (filename.isEmpty())
filename = "\"\"";

StringArray arguments;
water::StringArray arguments;

// binary
arguments.add(fBinary.buffer());

// osc-url
arguments.add(String(kEngine->getOscServerPathUDP()) + String("/") + String(kPlugin->getId()));
arguments.add(String(kEngine->getOscServerPathUDP()) + water::String("/") + water::String(kPlugin->getId()));

// filename
arguments.add(filename);


+ 4
- 21
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla Native Plugin
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaPluginInternal.hpp"
#include "CarlaEngine.hpp"
@@ -25,9 +11,6 @@
#include "water/misc/Time.h"
#include "water/text/StringArray.h"

using water::String;
using water::StringArray;

// -----------------------------------------------------------------------
// used in carla-base.cpp

@@ -819,12 +802,12 @@ public:
}
else if (std::strcmp(key, "midiPrograms") == 0 && fDescriptor->set_midi_program != nullptr)
{
StringArray midiProgramList(StringArray::fromTokens(value, ":", ""));
water::StringArray midiProgramList(water::StringArray::fromTokens(value, ":", ""));

if (midiProgramList.size() == MAX_MIDI_CHANNELS)
{
uint8_t channel = 0;
for (String *it=midiProgramList.begin(), *end=midiProgramList.end(); it != end; ++it)
for (water::String *it=midiProgramList.begin(), *end=midiProgramList.end(); it != end; ++it)
{
const int index(it->getIntValue());



+ 3
- 18
source/backend/plugin/CarlaPluginSFZero.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla SFZero Plugin
* Copyright (C) 2018-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaPluginInternal.hpp"
#include "CarlaEngine.hpp"
@@ -35,7 +21,6 @@
using water::AudioSampleBuffer;
using water::File;
using water::MidiMessage;
using water::String;

// -----------------------------------------------------------------------

@@ -713,7 +698,7 @@ public:

// ---------------------------------------------------------------

const String basename(File(filename).getFileNameWithoutExtension());
const water::String basename(File(filename).getFileNameWithoutExtension());

CarlaString label2(label != nullptr ? label : basename.toRawUTF8());



+ 4
- 4
source/backend/utils/PluginDiscovery.cpp View File

@@ -69,8 +69,8 @@ struct CarlaPluginDiscoveryOptions {
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
struct {
bool autoPrefix;
CarlaString executable;
CarlaString fallbackPrefix;
String executable;
String fallbackPrefix;
} wine;
#endif

@@ -382,12 +382,12 @@ private:
uint fBinaryIndex;
const uint fBinaryCount;
const std::vector<water::File> fBinaries;
const CarlaString fDiscoveryTool;
const String fDiscoveryTool;

uint32_t fLastMessageTime;

CarlaPluginDiscoveryInfo fNextInfo;
CarlaString fNextSha1Sum;
String fNextSha1Sum;
char* fNextLabel;
char* fNextMaker;
char* fNextName;


+ 4
- 5
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -52,7 +52,6 @@ using CARLA_BACKEND_NAMESPACE::runMainLoopOnce;

using water::CharPointer_UTF8;
using water::File;
using water::String;

// -------------------------------------------------------------------------

@@ -113,7 +112,7 @@ static void initSignalHandler()
// -------------------------------------------------------------------------

static CarlaHostHandle gHostHandle;
static CarlaString gProjectFilename;
static String gProjectFilename;

static void gIdle()
{
@@ -419,7 +418,7 @@ int main(int argc, char* argv[])
// ---------------------------------------------------------------------
// Set client name

CarlaString clientName;
String clientName;

if (name != nullptr)
{
@@ -431,7 +430,7 @@ int main(int argc, char* argv[])
CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0', 1);

// LV2 URI is not usable as client name, create a usable name from URI
CarlaString label2(label);
String label2(label);

// truncate until last valid char
for (std::size_t i=label2.length()-1; i != 0; --i)
@@ -545,7 +544,7 @@ int main(int argc, char* argv[])
{
if (sched_setscheduler(0, SCHED_RR|SCHED_RESET_ON_FORK, &sparam) < 0)
{
CarlaString error(std::strerror(errno));
String error(std::strerror(errno));
carla_stderr("Failed to set high priority, error %i: %s", errno, error.buffer());
}
}


+ 12
- 26
source/bridges-plugin/CarlaBridgeSingleLV2.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla LV2 Single Plugin
* Copyright (C) 2017-2024 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#ifndef BUILD_BRIDGE
# error This file should not be compiled if not building bridge
@@ -57,10 +43,10 @@ public:
return;

// xxxxx
CarlaString binaryDir(bundlePath);
String binaryDir(bundlePath);
binaryDir += CARLA_OS_SEP_STR "bin" CARLA_OS_SEP_STR;

CarlaString resourceDir(bundlePath);
String resourceDir(bundlePath);
resourceDir += CARLA_OS_SEP_STR "res" CARLA_OS_SEP_STR;

pData->bufferSize = fBufferSize;
@@ -79,8 +65,8 @@ public:
if (pData->options.binaryDir != nullptr)
delete[] pData->options.binaryDir;

pData->options.binaryDir = binaryDir.dup();
pData->options.resourceDir = resourceDir.dup();
pData->options.binaryDir = carla_strdup(binaryDir);
pData->options.resourceDir = carla_strdup(resourceDir);

setCallback(_engine_callback, this);

@@ -695,17 +681,17 @@ const LV2_Descriptor* lv2_descriptor(uint32_t index)
if (index != 0)
return nullptr;

static CarlaString ret;
static String ret;

if (ret.isEmpty())
{
using namespace water;
const File file(File::getSpecialLocation(File::currentExecutableFile).withFileExtension("ttl"));
#ifdef CARLA_OS_WIN
ret = String("file:///" + file.getFullPathName()).toRawUTF8();
ret = water::String("file:///" + file.getFullPathName()).toRawUTF8();
ret.replace('\\','/');
#else
ret = String("file://" + file.getFullPathName()).toRawUTF8();
ret = water::String("file://" + file.getFullPathName()).toRawUTF8();
#endif
}

@@ -730,16 +716,16 @@ const LV2UI_Descriptor* lv2ui_descriptor(uint32_t index)
{
carla_debug("lv2ui_descriptor(%i)", index);

static CarlaString ret;
static String ret;

{
using namespace water;
const File file(File::getSpecialLocation(File::currentExecutableFile).getSiblingFile("ext-ui"));
#ifdef CARLA_OS_WIN
ret = String("file:///" + file.getFullPathName()).toRawUTF8();
ret = water::String("file:///" + file.getFullPathName()).toRawUTF8();
ret.replace('\\','/');
#else
ret = String("file://" + file.getFullPathName()).toRawUTF8();
ret = water::String("file://" + file.getFullPathName()).toRawUTF8();
#endif
}



+ 8
- 20
source/utils/CarlaBackendUtils.hpp View File

@@ -1,26 +1,14 @@
/*
* Carla Backend utils
* Copyright (C) 2011-2024 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#ifndef CARLA_BACKEND_UTILS_HPP_INCLUDED
#define CARLA_BACKEND_UTILS_HPP_INCLUDED

#include "CarlaBackend.h"
#include "CarlaNative.h"
#include "CarlaString.hpp"
#include "CarlaUtils.hpp"

#include "distrho/extra/String.hpp"

CARLA_BACKEND_START_NAMESPACE

@@ -613,7 +601,7 @@ BinaryType getBinaryTypeFromString(const char* const ctype) noexcept
CARLA_SAFE_ASSERT_RETURN(ctype != nullptr && ctype[0] != '\0', BINARY_NONE);
carla_debug("CarlaBackend::getBinaryTypeFromString(\"%s\")", ctype);

CarlaString stype(ctype);
String stype(ctype);

if (stype.isEmpty())
return BINARY_NONE;
@@ -758,7 +746,7 @@ PluginType getPluginTypeFromString(const char* const ctype) noexcept
CARLA_SAFE_ASSERT_RETURN(ctype != nullptr && ctype[0] != '\0', PLUGIN_NONE);
carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", ctype);

CarlaString stype(ctype);
String stype(ctype);

if (stype.isEmpty())
return PLUGIN_NONE;
@@ -808,7 +796,7 @@ PluginCategory getPluginCategoryFromName(const char* const name) noexcept
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', PLUGIN_CATEGORY_NONE);
carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name);

CarlaString sname(name);
String sname(name);

if (sname.isEmpty())
return PLUGIN_CATEGORY_NONE;


+ 8
- 21
source/utils/CarlaBridgeUtils.hpp View File

@@ -1,19 +1,5 @@
/*
* Carla Bridge utils
* Copyright (C) 2013-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#ifndef CARLA_BRIDGE_UTILS_HPP_INCLUDED
#define CARLA_BRIDGE_UTILS_HPP_INCLUDED
@@ -21,7 +7,8 @@
#include "CarlaBridgeDefines.hpp"
#include "CarlaMutex.hpp"
#include "CarlaRingBuffer.hpp"
#include "CarlaString.hpp"

#include "distrho/extra/String.hpp"

// -------------------------------------------------------------------------------------------------------------------

@@ -243,7 +230,7 @@ struct BridgeNonRtServerData {
struct CARLA_API BridgeAudioPool {
float* data;
std::size_t dataSize;
CarlaString filename;
String filename;
char shm[64];
bool isServer;

@@ -265,7 +252,7 @@ struct CARLA_API BridgeAudioPool {

struct CARLA_API BridgeRtClientControl : public CarlaRingBufferControl<SmallStackBuffer> {
BridgeRtClientData* data;
CarlaString filename;
String filename;
bool needsSemDestroy; // client only
char shm[64];
bool isServer;
@@ -305,7 +292,7 @@ struct CARLA_API BridgeRtClientControl : public CarlaRingBufferControl<SmallStac

struct CARLA_API BridgeNonRtClientControl : public CarlaRingBufferControl<BigStackBuffer> {
BridgeNonRtClientData* data;
CarlaString filename;
String filename;
CarlaMutex mutex;
char shm[64];
bool isServer;
@@ -334,7 +321,7 @@ struct CARLA_API BridgeNonRtClientControl : public CarlaRingBufferControl<BigSta

struct CARLA_API BridgeNonRtServerControl : public CarlaRingBufferControl<HugeStackBuffer> {
BridgeNonRtServerData* data;
CarlaString filename;
String filename;
CarlaMutex mutex;
char shm[64];
bool isServer;


+ 26
- 41
source/utils/CarlaStateUtils.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla State utils
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaStateUtils.hpp"

@@ -27,7 +13,6 @@
#include <string>

using water::MemoryOutputStream;
using water::String;
using water::XmlElement;

CARLA_BACKEND_START_NAMESPACE
@@ -35,7 +20,7 @@ CARLA_BACKEND_START_NAMESPACE
// -----------------------------------------------------------------------
// getNewLineSplittedString

static void getNewLineSplittedString(MemoryOutputStream& stream, const String& string)
static void getNewLineSplittedString(MemoryOutputStream& stream, const water::String& string)
{
static const int kLineWidth = 120;

@@ -109,7 +94,7 @@ static const char* xmlSafeStringCharDup(const char* const cstring, const bool to
}
*/

static const char* xmlSafeStringCharDup(const String& string, const bool toXml)
static const char* xmlSafeStringCharDup(const water::String& string, const bool toXml)
{
return carla_strdup(xmlSafeString(string, toXml).toRawUTF8());
}
@@ -292,7 +277,7 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)

for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement())
{
const String& tagName(elem->getTagName());
const water::String& tagName(elem->getTagName());

// ---------------------------------------------------------------
// Info
@@ -301,8 +286,8 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)
{
for (XmlElement* xmlInfo = elem->getFirstChildElement(); xmlInfo != nullptr; xmlInfo = xmlInfo->getNextElement())
{
const String& tag(xmlInfo->getTagName());
const String text(xmlInfo->getAllSubText().trim());
const water::String& tag(xmlInfo->getTagName());
const water::String text(xmlInfo->getAllSubText().trim());

/**/ if (tag == "Type")
type = xmlSafeStringCharDup(text, false);
@@ -324,8 +309,8 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)
{
for (XmlElement* xmlData = elem->getFirstChildElement(); xmlData != nullptr; xmlData = xmlData->getNextElement())
{
const String& tag(xmlData->getTagName());
const String text(xmlData->getAllSubText().trim());
const water::String& tag(xmlData->getTagName());
const water::String text(xmlData->getAllSubText().trim());

// -------------------------------------------------------
// Internal Data
@@ -414,8 +399,8 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)

for (XmlElement* xmlSubData = xmlData->getFirstChildElement(); xmlSubData != nullptr; xmlSubData = xmlSubData->getNextElement())
{
const String& pTag(xmlSubData->getTagName());
const String pText(xmlSubData->getAllSubText().trim());
const water::String& pTag(xmlSubData->getTagName());
const water::String pText(xmlSubData->getAllSubText().trim());

/**/ if (pTag == "Index")
{
@@ -487,7 +472,7 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)
// find type first
for (XmlElement* xmlSubData = xmlData->getFirstChildElement(); xmlSubData != nullptr; xmlSubData = xmlSubData->getNextElement())
{
const String& cTag(xmlSubData->getTagName());
const water::String& cTag(xmlSubData->getTagName());

if (cTag != "Type")
continue;
@@ -506,8 +491,8 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement)
// now fill in key and value, knowing what the type is
for (XmlElement* xmlSubData = xmlData->getFirstChildElement(); xmlSubData != nullptr; xmlSubData = xmlSubData->getNextElement())
{
const String& cTag(xmlSubData->getTagName());
String cText(xmlSubData->getAllSubText());
const water::String& cTag(xmlSubData->getTagName());
water::String cText(xmlSubData->getAllSubText());

/**/ if (cTag == "Key")
{
@@ -563,7 +548,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const
MemoryOutputStream infoXml;

infoXml << " <Info>\n";
infoXml << " <Type>" << String(type != nullptr ? type : "") << "</Type>\n";
infoXml << " <Type>" << water::String(type != nullptr ? type : "") << "</Type>\n";
infoXml << " <Name>" << xmlSafeString(name, true) << "</Name>\n";

switch (pluginType)
@@ -633,22 +618,22 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const
dataXml << " <Active>" << (active ? "Yes" : "No") << "</Active>\n";

if (carla_isNotEqual(dryWet, 1.0f))
dataXml << " <DryWet>" << String(dryWet, 7) << "</DryWet>\n";
dataXml << " <DryWet>" << water::String(dryWet, 7) << "</DryWet>\n";
if (carla_isNotEqual(volume, 1.0f))
dataXml << " <Volume>" << String(volume, 7) << "</Volume>\n";
dataXml << " <Volume>" << water::String(volume, 7) << "</Volume>\n";
if (carla_isNotEqual(balanceLeft, -1.0f))
dataXml << " <Balance-Left>" << String(balanceLeft, 7) << "</Balance-Left>\n";
dataXml << " <Balance-Left>" << water::String(balanceLeft, 7) << "</Balance-Left>\n";
if (carla_isNotEqual(balanceRight, 1.0f))
dataXml << " <Balance-Right>" << String(balanceRight, 7) << "</Balance-Right>\n";
dataXml << " <Balance-Right>" << water::String(balanceRight, 7) << "</Balance-Right>\n";
if (carla_isNotEqual(panning, 0.0f))
dataXml << " <Panning>" << String(panning, 7) << "</Panning>\n";
dataXml << " <Panning>" << water::String(panning, 7) << "</Panning>\n";

if (ctrlChannel < 0)
dataXml << " <ControlChannel>N</ControlChannel>\n";
else
dataXml << " <ControlChannel>" << int(ctrlChannel+1) << "</ControlChannel>\n";

dataXml << " <Options>0x" << String::toHexString(static_cast<int>(options)) << "</Options>\n";
dataXml << " <Options>0x" << water::String::toHexString(static_cast<int>(options)) << "</Options>\n";

content << dataXml;
}
@@ -663,7 +648,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const

parameterXml << "\n";
parameterXml << " <Parameter>\n";
parameterXml << " <Index>" << String(stateParameter->index) << "</Index>\n";
parameterXml << " <Index>" << water::String(stateParameter->index) << "</Index>\n";
parameterXml << " <Name>" << xmlSafeString(stateParameter->name, true) << "</Name>\n";

if (stateParameter->symbol != nullptr && stateParameter->symbol[0] != '\0')
@@ -682,8 +667,8 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const

if (stateParameter->mappedRangeValid)
{
parameterXml << " <MappedMinimum>" << String(stateParameter->mappedMinimum, 15) << "</MappedMinimum>\n";
parameterXml << " <MappedMaximum>" << String(stateParameter->mappedMaximum, 15) << "</MappedMaximum>\n";
parameterXml << " <MappedMinimum>" << water::String(stateParameter->mappedMinimum, 15) << "</MappedMinimum>\n";
parameterXml << " <MappedMaximum>" << water::String(stateParameter->mappedMaximum, 15) << "</MappedMaximum>\n";
}

// backwards compatibility for older carla versions
@@ -693,7 +678,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const
#endif

if (! stateParameter->dummy)
parameterXml << " <Value>" << String(stateParameter->value, 15) << "</Value>\n";
parameterXml << " <Value>" << water::String(stateParameter->value, 15) << "</Value>\n";

parameterXml << " </Parameter>\n";

@@ -703,7 +688,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const
if (currentProgramIndex >= 0 && currentProgramName != nullptr && currentProgramName[0] != '\0')
{
// ignore 'default' program
if (currentProgramIndex > 0 || ! String(currentProgramName).equalsIgnoreCase("default"))
if (currentProgramIndex > 0 || ! water::String(currentProgramName).equalsIgnoreCase("default"))
{
MemoryOutputStream programXml;



+ 2
- 16
source/utils/CarlaStateUtils.hpp View File

@@ -1,19 +1,5 @@
/*
* Carla State utils
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/
// SPDX-FileCopyrightText: 2011-2025 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#ifndef CARLA_STATE_UTILS_HPP_INCLUDED
#define CARLA_STATE_UTILS_HPP_INCLUDED


Loading…
Cancel
Save