From 9c00a93cb87a735e27c25520191e5a80a8a31cea Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 2 May 2023 00:21:34 +0200 Subject: [PATCH] Introduce CARLA_PLUGIN_ONLY_BRIDGE build macro Signed-off-by: falkTX --- source/backend/CarlaPlugin.hpp | 9 +- source/backend/engine/CarlaEngine.cpp | 113 +++++++++++++++----------- source/backend/plugin/CarlaPlugin.cpp | 30 +++---- source/utils/CarlaStateUtils.cpp | 60 +++++++------- source/utils/CarlaStateUtils.hpp | 10 +-- 5 files changed, 122 insertions(+), 100 deletions(-) diff --git a/source/backend/CarlaPlugin.hpp b/source/backend/CarlaPlugin.hpp index 08f61078d..28b64000d 100644 --- a/source/backend/CarlaPlugin.hpp +++ b/source/backend/CarlaPlugin.hpp @@ -1,6 +1,6 @@ /* * Carla Plugin Host - * Copyright (C) 2011-2022 Filipe Coelho + * Copyright (C) 2011-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -451,10 +451,12 @@ public: */ bool loadStateFromFile(const char* filename); + #ifndef CARLA_PLUGIN_ONLY_BRIDGE /*! * Export this plugin as its own LV2 plugin, using a carla wrapper around it for the LV2 functionality. */ bool exportAsLV2(const char* lv2path); + #endif // ------------------------------------------------------------------- // Set data (internal stuff) @@ -967,11 +969,13 @@ public: const uint options; // see PluginOptions }; - static CarlaPluginPtr newNative(const Initializer& init); static CarlaPluginPtr newBridge(const Initializer& init, BinaryType btype, PluginType ptype, const char* binaryArchName, const char* bridgeBinary); + #ifndef CARLA_PLUGIN_ONLY_BRIDGE + static CarlaPluginPtr newNative(const Initializer& init); + static CarlaPluginPtr newLADSPA(const Initializer& init, const LADSPA_RDF_Descriptor* rdfDescriptor); static CarlaPluginPtr newDSSI(const Initializer& init); static CarlaPluginPtr newLV2(const Initializer& init); @@ -986,6 +990,7 @@ public: static CarlaPluginPtr newSFZero(const Initializer& init); static CarlaPluginPtr newJackApp(const Initializer& init); + #endif #endif // ------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index bfae91d03..1f1ede93f 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1,6 +1,6 @@ /* * Carla Plugin Host - * Copyright (C) 2011-2022 Filipe Coelho + * Copyright (C) 2011-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -319,7 +319,7 @@ CarlaEngine* CarlaEngine::newDriverByName(const char* const driverName) return newJack(); #endif -#if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_OS_WASM)) +#if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_OS_WASM) || defined(STATIC_PLUGIN_TARGET)) if (std::strcmp(driverName, "Dummy") == 0) return newDummy(); #endif @@ -574,7 +574,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, uint id; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH CarlaPluginPtr oldPlugin; if (pData->nextPluginId < pData->curPluginCount) @@ -587,7 +587,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, CARLA_SAFE_ASSERT_RETURN_ERR(oldPlugin.get() != nullptr, "Invalid replace plugin Id"); } else -#endif + #endif { id = pData->curPluginCount; @@ -597,9 +597,9 @@ bool CarlaEngine::addPlugin(const BinaryType btype, return false; } -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins[id].plugin.get() == nullptr, "Invalid engine internal data"); -#endif + #endif } CarlaPlugin::Initializer initializer = { @@ -617,13 +617,13 @@ bool CarlaEngine::addPlugin(const BinaryType btype, if (bridgeBinary.isNotEmpty()) { -#ifndef CARLA_OS_WIN + #ifndef CARLA_OS_WIN if (btype == BINARY_NATIVE) { bridgeBinary += CARLA_OS_SEP_STR "carla-bridge-native"; } else -#endif + #endif { switch (btype) { @@ -634,18 +634,18 @@ bool CarlaEngine::addPlugin(const BinaryType btype, bridgeBinary += CARLA_OS_SEP_STR "carla-bridge-posix64"; break; case BINARY_WIN32: -#if defined(CARLA_OS_WIN) && !defined(CARLA_OS_64BIT) + #if defined(CARLA_OS_WIN) && !defined(CARLA_OS_64BIT) bridgeBinary += CARLA_OS_SEP_STR "carla-bridge-native.exe"; -#else + #else bridgeBinary += CARLA_OS_SEP_STR "carla-bridge-win32.exe"; -#endif + #endif break; case BINARY_WIN64: -#if defined(CARLA_OS_WIN) && defined(CARLA_OS_64BIT) + #if defined(CARLA_OS_WIN) && defined(CARLA_OS_64BIT) bridgeBinary += CARLA_OS_SEP_STR "carla-bridge-native.exe"; -#else + #else bridgeBinary += CARLA_OS_SEP_STR "carla-bridge-win64.exe"; -#endif + #endif break; default: bridgeBinary.clear(); @@ -669,16 +669,16 @@ bool CarlaEngine::addPlugin(const BinaryType btype, bool preferBridges = pData->options.preferPluginBridges; const char* needsArchBridge = nullptr; -#ifdef CARLA_OS_MAC + #ifdef CARLA_OS_MAC // Plugin might be in quarentine due to Apple stupid notarization rules, let's remove that if possible if (canBeBridged && ptype != PLUGIN_LV2 && ptype != PLUGIN_AU) removeFileFromQuarantine(filename); -#endif + #endif -#ifndef BUILD_BRIDGE + #ifndef BUILD_BRIDGE if (canBeBridged && ! preferBridges) { -# if 0 + /* if (ptype == PLUGIN_LV2 && label != nullptr) { if (std::strncmp(label, "http://calf.sourceforge.net/plugins/", 36) == 0 || @@ -688,8 +688,8 @@ bool CarlaEngine::addPlugin(const BinaryType btype, preferBridges = true; } } -# endif -# ifdef ADAPT_FOR_APPLE_SILLICON + */ + #ifdef ADAPT_FOR_APPLE_SILLICON // see if this binary needs bridging if (ptype == PLUGIN_VST2 || ptype == PLUGIN_VST3) { @@ -699,13 +699,13 @@ bool CarlaEngine::addPlugin(const BinaryType btype, if (const char* const output = magic.getFileDescription(vst2Binary)) { carla_stdout("VST binary magic output is '%s'", output); -# ifdef __aarch64__ + #ifdef __aarch64__ if (std::strstr(output, "arm64") == nullptr && std::strstr(output, "x86_64") != nullptr) needsArchBridge = "x86_64"; -# else + #else if (std::strstr(output, "x86_64") == nullptr && std::strstr(output, "arm64") != nullptr) needsArchBridge = "arm64"; -# endif + #endif } else { @@ -717,11 +717,21 @@ bool CarlaEngine::addPlugin(const BinaryType btype, carla_stdout("Search for binary in VST bundle failed"); } } -# endif + #endif // ADAPT_FOR_APPLE_SILLICON } -#endif // ! BUILD_BRIDGE + #endif // ! BUILD_BRIDGE -#ifndef CARLA_OS_WASM + #if defined(CARLA_PLUGIN_ONLY_BRIDGE) + if (bridgeBinary.isNotEmpty()) + { + plugin = CarlaPlugin::newBridge(initializer, btype, ptype, needsArchBridge, bridgeBinary); + } + else + { + setLastError("Cannot load plugin, the required plugin bridge is not available"); + return false; + } + #elif !defined(CARLA_OS_WASM) if (canBeBridged && (needsArchBridge || btype != BINARY_NATIVE || (preferBridges && bridgeBinary.isNotEmpty()))) { if (bridgeBinary.isNotEmpty()) @@ -735,11 +745,12 @@ bool CarlaEngine::addPlugin(const BinaryType btype, } } else -#endif + #endif + #ifndef CARLA_PLUGIN_ONLY_BRIDGE { -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH bool use16Outs; -#endif + #endif setLastError("Invalid or unsupported plugin type"); // Some stupid plugins mess up with global signals, err!! @@ -779,7 +790,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, plugin = CarlaPlugin::newCLAP(initializer); break; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH case PLUGIN_INTERNAL: plugin = CarlaPlugin::newNative(initializer); break; @@ -792,7 +803,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, break; case PLUGIN_SFZ: -# ifdef SFZ_FILES_USING_SFIZZ + #ifdef SFZ_FILES_USING_SFIZZ { CarlaPlugin::Initializer sfizzInitializer = { this, @@ -806,9 +817,9 @@ bool CarlaEngine::addPlugin(const BinaryType btype, plugin = CarlaPlugin::newLV2(sfizzInitializer); } -# else + #else plugin = CarlaPlugin::newSFZero(initializer); -# endif + #endif break; case PLUGIN_JSFX: @@ -816,13 +827,13 @@ bool CarlaEngine::addPlugin(const BinaryType btype, break; case PLUGIN_JACK: -# ifdef HAVE_JACK + #ifdef HAVE_JACK plugin = CarlaPlugin::newJackApp(initializer); -# else + #else setLastError("JACK plugin target is not available"); -# endif + #endif break; -#else + #else case PLUGIN_INTERNAL: case PLUGIN_DLS: case PLUGIN_GIG: @@ -832,16 +843,17 @@ bool CarlaEngine::addPlugin(const BinaryType btype, case PLUGIN_JSFX: setLastError("Plugin bridges cannot handle this binary"); break; -#endif + #endif // BUILD_BRIDGE_ALTERNATIVE_ARCH } } + #endif // CARLA_PLUGIN_ONLY_BRIDGE if (plugin.get() == nullptr) return false; plugin->reload(); -#ifdef SFZ_FILES_USING_SFIZZ + #ifdef SFZ_FILES_USING_SFIZZ if (ptype == PLUGIN_SFZ && plugin->getType() == PLUGIN_LV2) { plugin->setCustomData(LV2_ATOM__Path, @@ -851,7 +863,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, plugin->restoreLV2State(true); } -#endif + #endif bool canRun = true; @@ -873,7 +885,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, pluginData.plugin = plugin; carla_zeroFloats(pluginData.peaks, 4); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH if (oldPlugin.get() != nullptr) { CARLA_SAFE_ASSERT(! pData->loadingProject); @@ -905,7 +917,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, callback(true, true, ENGINE_CALLBACK_RELOAD_ALL, id, 0, 0, 0, 0.0f, nullptr); } else if (! pData->loadingProject) -#endif + #endif { plugin->setEnabled(true); @@ -915,13 +927,18 @@ bool CarlaEngine::addPlugin(const BinaryType btype, if (getType() != kEngineTypeBridge) plugin->setActive(true, true, true); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) pData->graph.addPlugin(plugin); -#endif + #endif } return true; + + #if defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE) + // unused + (void)extra; + #endif } bool CarlaEngine::addPlugin(const PluginType ptype, @@ -2947,7 +2964,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw CARLA_SAFE_ASSERT_CONTINUE(stateSave.type != nullptr); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) // compatibility code to load projects with GIG files // FIXME Remove on 2.1 release if (std::strcmp(stateSave.type, "GIG") == 0) @@ -3008,7 +3025,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); continue; } -# ifdef SFZ_FILES_USING_SFIZZ + #ifdef SFZ_FILES_USING_SFIZZ if (std::strcmp(stateSave.type, "SFZ") == 0) { if (addPlugin(PLUGIN_LV2, "", stateSave.name, "http://sfztools.github.io/sfizz", 0, nullptr)) @@ -3063,8 +3080,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw callback(true, true, ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); continue; } -# endif -#endif + #endif + #endif const void* extraStuff = nullptr; static const char kTrue[] = "true"; diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 3b6ad0376..0330d74d5 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -1,6 +1,6 @@ /* * Carla Plugin - * Copyright (C) 2011-2022 Filipe Coelho + * Copyright (C) 2011-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -536,14 +536,14 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) pData->stateSave.name = carla_strdup(pData->name); pData->stateSave.label = carla_strdup(strBuf); pData->stateSave.uniqueId = getUniqueId(); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH +// #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH pData->stateSave.options = pData->options; -#endif +// #endif if (pData->filename != nullptr) pData->stateSave.binary = carla_strdup(pData->filename); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) // --------------------------------------------------------------- // Internals @@ -554,7 +554,7 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) pData->stateSave.balanceRight = pData->postProc.balanceRight; pData->stateSave.panning = pData->postProc.panning; pData->stateSave.ctrlChannel = pData->ctrlChannel; -#endif + #endif if (pData->hints & PLUGIN_IS_BRIDGE) waitForBridgeSaveSignal(); @@ -621,7 +621,7 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) stateParameter->dummy = dummy; stateParameter->index = paramData.index; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) if (paramData.mappedControlIndex != CONTROL_INDEX_MIDI_LEARN) { stateParameter->mappedControlIndex = paramData.mappedControlIndex; @@ -640,7 +640,7 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) } } } -#endif + #endif if (! getParameterName(i, strBuf)) strBuf[0] = '\0'; @@ -859,7 +859,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) setParameterValue(static_cast(index), stateParameter->value, true, true, true); } -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) if (stateParameter->mappedRangeValid) { if (pData->param.data[index].hints & PARAMETER_USES_SAMPLERATE) @@ -876,7 +876,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) setParameterMappedControlIndex(static_cast(index), stateParameter->mappedControlIndex, true, true, false); setParameterMidiChannel(static_cast(index), stateParameter->midiChannel, true, true); -#endif + #endif } else carla_stderr("Could not set parameter '%s' value for '%s'", @@ -939,14 +939,14 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) if (stateSave.chunk != nullptr && (pData->options & PLUGIN_OPTION_USE_CHUNKS) != 0) { std::vector chunk(carla_getChunkFromBase64String(stateSave.chunk)); -#ifdef CARLA_PROPER_CPP11_SUPPORT + #ifdef CARLA_PROPER_CPP11_SUPPORT setChunkData(chunk.data(), chunk.size()); -#else + #else setChunkData(&chunk.front(), chunk.size()); -#endif + #endif } -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) // --------------------------------------------------------------- // Part 6 - set internal stuff @@ -970,7 +970,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) if (! pData->engine->isLoadingProject()) pData->engine->callback(true, true, ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0, 0.0f, nullptr); -#endif + #endif } bool CarlaPlugin::saveStateToFile(const char* const filename) @@ -1026,6 +1026,7 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename) return false; } +#ifndef CARLA_PLUGIN_ONLY_BRIDGE bool CarlaPlugin::exportAsLV2(const char* const lv2path) { CARLA_SAFE_ASSERT_RETURN(lv2path != nullptr && lv2path[0] != '\0', false); @@ -1343,6 +1344,7 @@ bool CarlaPlugin::exportAsLV2(const char* const lv2path) return true; } +#endif // ------------------------------------------------------------------- // Set data (internal stuff) diff --git a/source/utils/CarlaStateUtils.cpp b/source/utils/CarlaStateUtils.cpp index fed5481e9..293fab59c 100644 --- a/source/utils/CarlaStateUtils.cpp +++ b/source/utils/CarlaStateUtils.cpp @@ -1,6 +1,6 @@ /* * Carla State utils - * Copyright (C) 2012-2022 Filipe Coelho + * Copyright (C) 2012-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -122,16 +122,16 @@ CarlaStateSave::Parameter::Parameter() noexcept index(-1), name(nullptr), symbol(nullptr), -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) value(0.0f), mappedControlIndex(CONTROL_INDEX_NONE), midiChannel(0), mappedRangeValid(false), mappedMinimum(0.0f), mappedMaximum(1.0f) {} -#else + #else value(0.0f) {} -#endif + #endif CarlaStateSave::Parameter::~Parameter() noexcept { @@ -191,9 +191,9 @@ CarlaStateSave::CarlaStateSave() noexcept label(nullptr), binary(nullptr), uniqueId(0), - options(0x0), + options(PLUGIN_OPTIONS_NULL), temporary(false), -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) active(false), dryWet(1.0f), volume(1.0f), @@ -201,7 +201,7 @@ CarlaStateSave::CarlaStateSave() noexcept balanceRight(1.0f), panning(0.0f), ctrlChannel(-1), -#endif + #endif currentProgramIndex(-1), currentProgramName(nullptr), currentMidiBank(-1), @@ -249,9 +249,9 @@ void CarlaStateSave::clear() noexcept } uniqueId = 0; - options = 0x0; + options = PLUGIN_OPTIONS_NULL; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) active = false; dryWet = 1.0f; volume = 1.0f; @@ -259,7 +259,7 @@ void CarlaStateSave::clear() noexcept balanceRight = 1.0f; panning = 0.0f; ctrlChannel = -1; -#endif + #endif currentProgramIndex = -1; currentMidiBank = -1; @@ -327,11 +327,17 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement) const String& tag(xmlData->getTagName()); const String text(xmlData->getAllSubText().trim()); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH // ------------------------------------------------------- // Internal Data - /**/ if (tag == "Active") + /**/ if (tag == "Options") + { + const int value(text.getHexValue32()); + if (value > 0) + options = static_cast(value); + } + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) + else if (tag == "Active") { active = (text == "Yes"); } @@ -364,15 +370,7 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement) ctrlChannel = static_cast(value-1); } } - else if (tag == "Options") - { - const int value(text.getHexValue32()); - if (value > 0) - options = static_cast(value); - } -#else - if (false) {} -#endif + #endif // ------------------------------------------------------- // Program (current) @@ -410,9 +408,9 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement) else if (tag == "Parameter") { Parameter* const stateParameter(new Parameter()); -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) bool hasMappedMinimum = false, hasMappedMaximum = false; -#endif + #endif for (XmlElement* xmlSubData = xmlData->getFirstChildElement(); xmlSubData != nullptr; xmlSubData = xmlSubData->getNextElement()) { @@ -438,7 +436,7 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement) stateParameter->dummy = false; stateParameter->value = pText.getFloatValue(); } -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) else if (pTag == "MidiChannel") { const int channel(pText.getIntValue()); @@ -468,13 +466,13 @@ bool CarlaStateSave::fillFromXmlElement(const XmlElement* const xmlElement) hasMappedMaximum = true; stateParameter->mappedMaximum = pText.getFloatValue(); } -#endif + #endif } -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) if (hasMappedMinimum && hasMappedMaximum) stateParameter->mappedRangeValid = true; -#endif + #endif parameters.append(stateParameter); } @@ -627,7 +625,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const content << " \n"; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) { MemoryOutputStream dataXml; @@ -653,7 +651,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const content << dataXml; } -#endif + #endif for (ParameterItenerator it = parameters.begin2(); it.valid(); it.next()) { @@ -675,7 +673,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const parameterXml << " " << xmlSafeString(stateParameter->symbol, true) << "\n"; } -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) if (stateParameter->mappedControlIndex > CONTROL_INDEX_NONE && stateParameter->mappedControlIndex <= CONTROL_INDEX_MAX_ALLOWED) { parameterXml << " " << stateParameter->midiChannel+1 << "\n"; @@ -691,7 +689,7 @@ void CarlaStateSave::dumpToMemoryStream(MemoryOutputStream& content) const if (stateParameter->mappedControlIndex > 0 && stateParameter->mappedControlIndex < MAX_MIDI_CONTROL) parameterXml << " " << stateParameter->mappedControlIndex << "\n"; } -#endif + #endif if (! stateParameter->dummy) parameterXml << " " << String(stateParameter->value, 15) << "\n"; diff --git a/source/utils/CarlaStateUtils.hpp b/source/utils/CarlaStateUtils.hpp index 13bbd825c..318de8572 100644 --- a/source/utils/CarlaStateUtils.hpp +++ b/source/utils/CarlaStateUtils.hpp @@ -1,6 +1,6 @@ /* * Carla State utils - * Copyright (C) 2012-2022 Filipe Coelho + * Copyright (C) 2012-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,13 +34,13 @@ struct CarlaStateSave { const char* name; const char* symbol; float value; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) int16_t mappedControlIndex; uint8_t midiChannel; bool mappedRangeValid; float mappedMinimum; float mappedMaximum; -#endif + #endif Parameter() noexcept; ~Parameter() noexcept; @@ -76,7 +76,7 @@ struct CarlaStateSave { // saved during clone, rename or similar bool temporary; -#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH + #if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE)) bool active; float dryWet; float volume; @@ -84,7 +84,7 @@ struct CarlaStateSave { float balanceRight; float panning; int8_t ctrlChannel; -#endif + #endif int32_t currentProgramIndex; const char* currentProgramName;