diff --git a/source/Makefile.mk b/source/Makefile.mk index 3fe08e25e..3e9e018dc 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -80,15 +80,17 @@ endif # -------------------------------------------------------------- # Check for required libs -# liblo always required ifneq ($(shell pkg-config --exists liblo && echo true),true) $(error liblo missing, cannot continue) endif -# Qt always required -# ifneq ($(shell pkg-config --exists QtCore QtGui QtXml && echo true),true) -# $(error Qt4 missing, cannot continue) -# endif +ifneq ($(shell pkg-config --exists QtCore && echo true),true) +$(error QtCore missing, cannot continue) +endif + +ifneq ($(shell pkg-config --exists QtXml && echo true),true) +$(error QtXml missing, cannot continue) +endif # -------------------------------------------------------------- # Check for optional libs (required by backend or bridges) @@ -101,8 +103,8 @@ HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true) HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true) HAVE_OPENGL = $(shell pkg-config --exists gl && echo true) HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true) -HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui QtXml && echo true) -HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets Qt5Xml && echo true) +HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true) +HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true) else HAVE_OPENGL = true endif diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index 9bdc6db84..36767d664 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -440,9 +440,7 @@ public: /*! * Initialize the port's internal buffer. */ - virtual void initBuffer() override - { - } + virtual void initBuffer() override; /*! * Direct access to the port's audio buffer. @@ -490,6 +488,8 @@ public: */ virtual void initBuffer() override; +#if 0 + // TESTING: I should remove this /*! * Write buffer back into the engine. */ @@ -499,6 +499,7 @@ public: * Set a new buffer size. */ void setBufferSize(const uint32_t bufferSize); +#endif /*! * Direct access to the port's buffer. @@ -1167,7 +1168,7 @@ private: static const char* const* getRtAudioApiDeviceNames(const unsigned int index); static const EngineDriverDeviceInfo* getRtAudioDeviceInfo(const unsigned int index, const char* const deviceName); -# ifdef USE_JUCE +# ifdef HAVE_JUCE static CarlaEngine* newJuce(const AudioApi api); static size_t getJuceApiCount(); static const char* getJuceApiName(const unsigned int index); diff --git a/source/backend/CarlaPlugin.hpp b/source/backend/CarlaPlugin.hpp index ca34df18f..22287d42c 100644 --- a/source/backend/CarlaPlugin.hpp +++ b/source/backend/CarlaPlugin.hpp @@ -837,6 +837,7 @@ public: static CarlaPlugin* newGIG(const Initializer& init, const bool use16Outs); static CarlaPlugin* newSF2(const Initializer& init, const bool use16Outs); static CarlaPlugin* newSFZ(const Initializer& init, const bool use16Outs); + static CarlaPlugin* newJuce(const Initializer& init); #endif // ------------------------------------------------------------------- diff --git a/source/backend/Makefile.mk b/source/backend/Makefile.mk index 8dd8a4e39..e3b49f594 100644 --- a/source/backend/Makefile.mk +++ b/source/backend/Makefile.mk @@ -9,15 +9,18 @@ include ../../Makefile.mk # -------------------------------------------------------------- BUILD_CXX_FLAGS += -I. -I.. -I../../includes -I../../modules -I../../utils +BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) + BUILD_CXX_FLAGS += $(QTCORE_FLAGS) +BUILD_CXX_FLAGS += $(QTXML_FLAGS) ifeq ($(HAVE_FFMPEG),true) BUILD_CXX_FLAGS += -DHAVE_FFMPEG endif -ifeq ($(HAVE_JUCE),true) +# ifeq ($(HAVE_JUCE),true) # BUILD_CXX_FLAGS += -DHAVE_JUCE -endif +# endif # -------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 825abf59f..253def303 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -30,9 +30,15 @@ #include "CarlaStateUtils.hpp" #include "CarlaMIDI.h" -#ifdef USE_JUCE -#include "juce_audio_basics.h" +#include +#include +#include + +#ifdef HAVE_JUCE +# include "juce_audio_basics.h" using juce::FloatVectorOperations; +#else +# include #endif CARLA_BACKEND_START_NAMESPACE @@ -48,7 +54,7 @@ CARLA_BACKEND_START_NAMESPACE // ----------------------------------------------------------------------- // Fallback data -static const EngineEvent kFallbackEngineEvent; +static EngineEvent kFallbackEngineEvent; // ----------------------------------------------------------------------- // Carla Engine port (Abstract) @@ -57,7 +63,7 @@ CarlaEnginePort::CarlaEnginePort(const CarlaEngine& engine, const bool isInput) : fEngine(engine), fIsInput(isInput) { - carla_debug("CarlaEnginePort::CarlaEnginePort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); + carla_debug("CarlaEnginePort::CarlaEnginePort(%s)", bool2str(isInput)); } CarlaEnginePort::~CarlaEnginePort() @@ -72,7 +78,7 @@ CarlaEngineAudioPort::CarlaEngineAudioPort(const CarlaEngine& engine, const bool : CarlaEnginePort(engine, isInput), fBuffer(nullptr) { - carla_debug("CarlaEngineAudioPort::CarlaEngineAudioPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); + carla_debug("CarlaEngineAudioPort::CarlaEngineAudioPort(%s)", bool2str(isInput)); } CarlaEngineAudioPort::~CarlaEngineAudioPort() @@ -80,6 +86,10 @@ CarlaEngineAudioPort::~CarlaEngineAudioPort() carla_debug("CarlaEngineAudioPort::~CarlaEngineAudioPort()"); } +void CarlaEngineAudioPort::initBuffer() +{ +} + // ----------------------------------------------------------------------- // Carla Engine CV port @@ -87,7 +97,7 @@ CarlaEngineCVPort::CarlaEngineCVPort(const CarlaEngine& engine, const bool isInp : CarlaEnginePort(engine, isInput), fBuffer(new float[engine.getBufferSize()]) { - carla_debug("CarlaEngineCVPort::CarlaEngineCVPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); + carla_debug("CarlaEngineCVPort::CarlaEngineCVPort(%s)", bool2str(isInput)); } CarlaEngineCVPort::~CarlaEngineCVPort() @@ -103,14 +113,17 @@ void CarlaEngineCVPort::initBuffer() { CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); -#ifdef USE_JUCE +#ifdef HAVE_JUCE FloatVectorOperations::clear(fBuffer, fEngine.getBufferSize()); +#else + carla_zeroFloat(fBuffer, fEngine.getBufferSize()); #endif } +#if 0 void CarlaEngineCVPort::writeBuffer(const uint32_t, const uint32_t) { - CARLA_ASSERT(! fIsInput); + CARLA_SAFE_ASSERT_RETURN(! fIsInput,); } void CarlaEngineCVPort::setBufferSize(const uint32_t bufferSize) @@ -120,6 +133,7 @@ void CarlaEngineCVPort::setBufferSize(const uint32_t bufferSize) fBuffer = new float[bufferSize]; } +#endif // ----------------------------------------------------------------------- // Carla Engine Event port @@ -128,7 +142,15 @@ CarlaEngineEventPort::CarlaEngineEventPort(const CarlaEngine& engine, const bool : CarlaEnginePort(engine, isInput), fBuffer(nullptr) { - carla_debug("CarlaEngineEventPort::CarlaEngineEventPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); + carla_debug("CarlaEngineEventPort::CarlaEngineEventPort(%s)", bool2str(isInput)); + + static bool sFallbackEngineEventNeedsInit = true; + + if (sFallbackEngineEventNeedsInit) + { + kFallbackEngineEvent.clear(); + sFallbackEngineEventNeedsInit = false; + } if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_PATCHBAY) fBuffer = new EngineEvent[kEngineMaxInternalEventCount]; @@ -268,7 +290,7 @@ CarlaEngineClient::CarlaEngineClient(const CarlaEngine& engine) fActive(false), fLatency(0) { - carla_debug("CarlaEngineClient::CarlaEngineClient(name:\"%s\")", engine.getName()); + carla_debug("CarlaEngineClient::CarlaEngineClient()"); } CarlaEngineClient::~CarlaEngineClient() @@ -361,7 +383,7 @@ unsigned int CarlaEngine::getDriverCount() #ifndef BUILD_BRIDGE count += getRtAudioApiCount(); -# ifdef USE_JUCE +# ifdef HAVE_JUCE count += getJuceApiCount(); # endif #endif @@ -382,7 +404,7 @@ const char* CarlaEngine::getDriverName(const unsigned int index) if (rtAudioIndex < getRtAudioApiCount()) return getRtAudioApiName(rtAudioIndex); -# ifdef USE_JUCE +# ifdef HAVE_JUCE const unsigned int juceIndex(index-rtAudioIndex-1); if (juceIndex < getJuceApiCount()) @@ -410,7 +432,7 @@ const char* const* CarlaEngine::getDriverDeviceNames(const unsigned int index) if (rtAudioIndex < getRtAudioApiCount()) return getRtAudioApiDeviceNames(rtAudioIndex); -# ifdef USE_JUCE +# ifdef HAVE_JUCE const unsigned int juceIndex(index-rtAudioIndex-1); if (juceIndex < getJuceApiCount()) @@ -442,7 +464,7 @@ const EngineDriverDeviceInfo* CarlaEngine::getDriverDeviceInfo(const unsigned in if (rtAudioIndex < getRtAudioApiCount()) return getRtAudioDeviceInfo(rtAudioIndex, deviceName); -# ifdef USE_JUCE +# ifdef HAVE_JUCE const unsigned int juceIndex(index-rtAudioIndex-1); if (juceIndex < getJuceApiCount()) @@ -729,7 +751,9 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons else if (btype == BINARY_WIN32) { // fallback to dssi-vst - CarlaString label2("filename"); + QFileInfo fileInfo(filename); + + CarlaString label2(fileInfo.fileName().toUtf8().constData()); label2.replace(' ', '*'); CarlaPlugin::Initializer init2 = { @@ -740,7 +764,13 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons (const char*)label2 }; + char* const oldVstPath(getenv("VST_PATH")); + carla_setenv("VST_PATH", fileInfo.absoluteDir().absolutePath().toUtf8().constData()); + plugin = CarlaPlugin::newDSSI(init2); + + if (oldVstPath != nullptr) + carla_setenv("VST_PATH", oldVstPath); } # endif else @@ -1110,22 +1140,29 @@ bool CarlaEngine::loadFile(const char* const filename) CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #1)"); carla_debug("CarlaEngine::loadFile(\"%s\")", filename); -#ifdef USE_JUCE - using namespace juce; + QFileInfo fileInfo(filename); - File file(filename); - - if (! file.existsAsFile()) + if (! fileInfo.exists()) { setLastError("File does not exist"); return false; } - CarlaString baseName(file.getFileNameWithoutExtension().toRawUTF8()); - CarlaString extension(file.getFileExtension().toRawUTF8()+1); - extension.toLower(); + if (! fileInfo.isFile()) + { + setLastError("Not a file"); + return false; + } - carla_stdout("load filename with extension %s", (const char*)extension); + if (! fileInfo.isReadable()) + { + setLastError("File is not readable"); + return false; + } + + CarlaString baseName(fileInfo.baseName().toUtf8().constData()); + CarlaString extension(fileInfo.suffix().toLower().toUtf8().constData()); + extension.toLower(); // ------------------------------------------------------------------- @@ -1134,6 +1171,9 @@ bool CarlaEngine::loadFile(const char* const filename) // ------------------------------------------------------------------- + if (extension == "csd") + return addPlugin(PLUGIN_CSOUND, filename, baseName, baseName); + if (extension == "gig") return addPlugin(PLUGIN_GIG, filename, baseName, baseName); @@ -1219,7 +1259,6 @@ bool CarlaEngine::loadFile(const char* const filename) return false; #endif } -#endif // ------------------------------------------------------------------- @@ -1227,90 +1266,64 @@ bool CarlaEngine::loadFile(const char* const filename) return false; } -bool charEndsWith(const char* const str, const char* const suffix) -{ - if (str == nullptr || suffix == nullptr) - return false; - - const size_t strLen(std::strlen(str)); - const size_t suffixLen(std::strlen(suffix)); - - if (strLen < suffixLen) - return false; - - return (std::strncmp(str + (strLen-suffixLen), suffix, suffixLen) == 0); -} - bool CarlaEngine::loadProject(const char* const filename) { CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #2)"); carla_debug("CarlaEngine::loadProject(\"%s\")", filename); -#ifdef USE_JUCE - using namespace juce; + QFile file(filename); - File file(filename); + if (! file.open(QIODevice::ReadOnly | QIODevice::Text)) + return false; - XmlDocument xml(file); + QDomDocument xml; + xml.setContent(file.readAll()); + file.close(); - if (XmlElement* const xmlCheck = xml.getDocumentElement(true)) + QDomNode xmlNode(xml.documentElement()); + + const bool isPreset(xmlNode.toElement().tagName().compare("carla-preset", Qt::CaseInsensitive) == 0); + + if (xmlNode.toElement().tagName().compare("carla-project", Qt::CaseInsensitive) != 0 && ! isPreset) { - const String& tagNameTest(xmlCheck->getTagName()); - const bool isPreset(tagNameTest.equalsIgnoreCase("carla-preset")); + setLastError("Not a valid Carla project or preset file"); + return false; + } - if (tagNameTest.equalsIgnoreCase("carla-project") || isPreset) + for (QDomNode node = xmlNode.firstChild(); ! node.isNull(); node = node.nextSibling()) + { + if (isPreset || node.toElement().tagName().compare("plugin", Qt::CaseInsensitive) == 0) { - if (XmlElement* const xmlElem = xml.getDocumentElement(false)) - { - for (XmlElement* subElem = xmlElem->getFirstChildElement(); subElem != nullptr; subElem = subElem->getNextElement()) - { - if (isPreset || subElem->getTagName().equalsIgnoreCase("Plugin")) - { - SaveState saveState; - fillSaveStateFromXmlElement(saveState, isPreset ? xmlElem : subElem); - - CARLA_SAFE_ASSERT_CONTINUE(saveState.type != nullptr); + SaveState saveState; + fillSaveStateFromXmlNode(saveState, isPreset ? xmlNode : node); - const void* extraStuff = nullptr; + CARLA_SAFE_ASSERT_CONTINUE(saveState.type != nullptr); - if (std::strcmp(saveState.type, "SF2") == 0) - { - const char* const use16OutsSuffix = " (16 outs)"; + const void* extraStuff = nullptr; - if (charEndsWith(saveState.label, use16OutsSuffix)) - extraStuff = (void*)0x1; // non-null - } + // check if using GIG, SF2 or SFZ 16outs + static const char kUse16OutsSuffix[] = " (16 outs)"; - // TODO - proper find&load plugins + if (CarlaString(saveState.label).endsWith(kUse16OutsSuffix)) + { + if (std::strcmp(saveState.type, "GIG") == 0 || std::strcmp(saveState.type, "SF2") == 0 || std::strcmp(saveState.type, "SFZ") == 0) + extraStuff = (void*)0x1; // non-null + } - if (addPlugin(getPluginTypeFromString(saveState.type), saveState.binary, saveState.name, saveState.label, extraStuff)) - { - if (CarlaPlugin* plugin = getPlugin(pData->curPluginCount-1)) - plugin->loadSaveState(saveState); - } - } + // TODO - proper find&load plugins - if (isPreset) - break; - } - - delete xmlElem; - delete xmlCheck; - return true; + if (addPlugin(getPluginTypeFromString(saveState.type), saveState.binary, saveState.name, saveState.label, extraStuff)) + { + if (CarlaPlugin* plugin = getPlugin(pData->curPluginCount-1)) + plugin->loadSaveState(saveState); } - else - setLastError("Failed to parse file"); } - else - setLastError("Not a valid Carla project or preset file"); - delete xmlCheck; - return false; + if (isPreset) + break; } -#endif - setLastError("Not a valid file"); - return false; + return true; } bool CarlaEngine::saveProject(const char* const filename) @@ -1318,12 +1331,12 @@ bool CarlaEngine::saveProject(const char* const filename) CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #3)"); carla_debug("CarlaEngine::saveProject(\"%s\")", filename); -#ifdef USE_JUCE - using namespace juce; + QFile file(filename); - File file(filename); + if (! file.open(QIODevice::WriteOnly | QIODevice::Text)) + return false; - MemoryOutputStream out; + QTextStream out(&file); out << "\n"; out << "\n"; out << "\n"; @@ -1345,13 +1358,9 @@ bool CarlaEngine::saveProject(const char* const filename) plugin->getRealName(strBuf); if (strBuf[0] != '\0') - { - out << " \n"; - } + out << QString(" \n").arg(xmlSafeString(strBuf, true)); - String content; + QString content; fillXmlStringFromSaveState(content, plugin->getSaveState()); out << " \n"; @@ -1364,10 +1373,8 @@ bool CarlaEngine::saveProject(const char* const filename) out << "\n"; - return file.replaceWithData(out.getData(), out.getDataSize()); -#endif - - return false; + file.close(); + return true; } // ----------------------------------------------------------------------- @@ -1758,7 +1765,7 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 float inBuf1[frames]; float* inBuf[2] = { inBuf0, inBuf1 }; -#ifdef USE_JUCE +#ifdef HAVE_JUCE // initialize audio inputs FloatVectorOperations::copy(inBuf0, inBufReal[0], frames); FloatVectorOperations::copy(inBuf1, inBufReal[1], frames); @@ -1777,7 +1784,7 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 #endif // initialize event outputs (zero) - carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); + carla_zeroStruct(pData->bufEvents.out, kEngineMaxInternalEventCount); bool processed = false; @@ -1794,7 +1801,7 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 if (processed) { -#ifdef USE_JUCE +#ifdef HAVE_JUCE // initialize audio inputs (from previous outputs) FloatVectorOperations::copy(inBuf0, outBuf[0], frames); FloatVectorOperations::copy(inBuf1, outBuf[1], frames); @@ -1842,7 +1849,7 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 // if plugin has no audio inputs, add input buffer if (oldAudioInCount == 0) { -#ifdef USE_JUCE +#ifdef HAVE_JUCE FloatVectorOperations::add(outBuf[0], inBuf0, frames); FloatVectorOperations::add(outBuf[1], inBuf1, frames); #else @@ -1855,23 +1862,76 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 { EnginePluginData& pluginData(pData->plugins[i]); -#ifdef USE_JUCE +#ifdef HAVE_JUCE float tmpMin, tmpMax; - FloatVectorOperations::findMinAndMax(inBuf0, frames, tmpMin, tmpMax); - pluginData.insPeak[0] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); + if (oldAudioInCount > 0) + { + FloatVectorOperations::findMinAndMax(inBuf0, frames, tmpMin, tmpMax); + pluginData.insPeak[0] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); - FloatVectorOperations::findMinAndMax(inBuf1, frames, tmpMin, tmpMax); - pluginData.insPeak[1] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); + FloatVectorOperations::findMinAndMax(inBuf1, frames, tmpMin, tmpMax); + pluginData.insPeak[1] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); + } + else + { + pluginData.insPeak[0] = 0.0f; + pluginData.insPeak[1] = 0.0f; + } - FloatVectorOperations::findMinAndMax(outBuf[0], frames, tmpMin, tmpMax); - pluginData.outsPeak[0] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); + if (oldMidiOutCount > 0) + { + FloatVectorOperations::findMinAndMax(outBuf[0], frames, tmpMin, tmpMax); + pluginData.outsPeak[0] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); - FloatVectorOperations::findMinAndMax(outBuf[1], frames, tmpMin, tmpMax); - pluginData.outsPeak[1] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); + FloatVectorOperations::findMinAndMax(outBuf[1], frames, tmpMin, tmpMax); + pluginData.outsPeak[1] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); + } + else + { + pluginData.outsPeak[0] = 0.0f; + pluginData.outsPeak[1] = 0.0f; + } #else - // TODO - (void)pluginData; + float peak1, peak2; + + if (oldAudioInCount > 0) + { + peak1 = peak2 = 0.0f; + + for (uint32_t k=0; k < frames; ++k) + { + peak1 = carla_max(peak1, std::fabs(inBuf0[k]), 1.0f); + peak2 = carla_max(peak2, std::fabs(inBuf1[k]), 1.0f); + } + + pluginData.insPeak[0] = peak1; + pluginData.insPeak[1] = peak2; + } + else + { + pluginData.insPeak[0] = 0.0f; + pluginData.insPeak[1] = 0.0f; + } + + if (oldMidiOutCount > 0) + { + peak1 = peak2 = 0.0f; + + for (uint32_t k=0; k < frames; ++k) + { + peak1 = carla_max(peak1, std::fabs(outBuf[0][k]), 1.0f); + peak2 = carla_max(peak2, std::fabs(outBuf[1][k]), 1.0f); + } + + pluginData.outsPeak[0] = peak1; + pluginData.outsPeak[1] = peak2; + } + else + { + pluginData.outsPeak[0] = 0.0f; + pluginData.outsPeak[1] = 0.0f; + } #endif } diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 7baa34b69..6244fb444 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -15,7 +15,9 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ -#ifdef BUILD_BRIDGE +#ifndef BUILD_BRIDGE +# error This file should not be compiled if not building bridge +#endif #include "CarlaEngineInternal.hpp" #include "CarlaBackendUtils.hpp" @@ -424,5 +426,3 @@ CarlaEngine* CarlaEngine::newBridge(const char* const audioBaseName, const char* } CARLA_BACKEND_END_NAMESPACE - -#endif // BUILD_BRIDGE diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index 7a6173fd7..199acad38 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -24,7 +24,6 @@ #include "CarlaPlugin.hpp" #include "CarlaMutex.hpp" -#include "RtList.hpp" CARLA_BACKEND_START_NAMESPACE @@ -131,6 +130,13 @@ struct EnginePluginData { CarlaPlugin* plugin; float insPeak[2]; float outsPeak[2]; + + void clear() + { + plugin = nullptr; + insPeak[0] = insPeak[1] = 0.0f; + outsPeak[0] = outsPeak[1] = 0.0f; + } }; // ----------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index 87e6f909c..8ce2d3219 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -19,18 +19,19 @@ #include "CarlaBackendUtils.hpp" #include "CarlaMIDI.h" +#include "List.hpp" #include "jackbridge/JackBridge.hpp" #include +#include -#define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" - -#ifdef USE_JUCE -#include "juce_audio_basics.h" - +#ifdef HAVE_JUCE +# include "juce_audio_basics.h" using juce::FloatVectorOperations; #endif +#define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" + CARLA_BACKEND_START_NAMESPACE #if 0 @@ -40,7 +41,7 @@ CARLA_BACKEND_START_NAMESPACE // ----------------------------------------------------------------------- // Fallback data -static const EngineEvent kFallbackJackEngineEvent; +static EngineEvent kFallbackJackEngineEvent; // ----------------------------------------------------------------------- // Carla Engine JACK-Audio port @@ -53,7 +54,7 @@ public: fClient(client), fPort(port) { - carla_debug("CarlaEngineJackAudioPort::CarlaEngineJackAudioPort(name:\"%s\", %s, %p, %p)", engine.getName(), bool2str(isInput), client, port); + carla_debug("CarlaEngineJackAudioPort::CarlaEngineJackAudioPort(%s, %p, %p)", bool2str(isInput), client, port); if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) { @@ -84,7 +85,7 @@ public: if (! fIsInput) { -#ifdef USE_JUCE +#ifdef HAVE_JUCE FloatVectorOperations::clear(fBuffer, bufferSize); #else carla_zeroFloat(fBuffer, bufferSize); @@ -112,7 +113,7 @@ public: fClient(client), fPort(port) { - carla_debug("CarlaEngineJackCVPort::CarlaEngineJackCVPort(name:\"%s\", %s, %p, %p)", engine.getName(), bool2str(isInput), client, port); + carla_debug("CarlaEngineJackCVPort::CarlaEngineJackCVPort(%s, %p, %p)", bool2str(isInput), client, port); if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) { @@ -142,7 +143,7 @@ public: if (fIsInput) { float* const jackBuffer((float*)jackbridge_port_get_buffer(fPort, bufferSize)); -#ifdef USE_JUCE +#ifdef HAVE_JUCE FloatVectorOperations::copy(fBuffer, jackBuffer, bufferSize); #else carla_copyFloat(fBuffer, jackBuffer, bufferSize); @@ -150,7 +151,7 @@ public: } else { -#ifdef USE_JUCE +#ifdef HAVE_JUCE FloatVectorOperations::clear(fBuffer, bufferSize); #else carla_zeroFloat(fBuffer, bufferSize); @@ -158,18 +159,20 @@ public: } } +#if 0 void writeBuffer(const uint32_t frames, const uint32_t timeOffset) override { CARLA_SAFE_ASSERT_RETURN(! fIsInput,); float* const jackBuffer((float*)jackbridge_port_get_buffer(fPort, fEngine.getBufferSize())); -#ifdef USE_JUCE +#ifdef HAVE_JUCE FloatVectorOperations::copy(jackBuffer+timeOffset, fBuffer, frames); #else carla_copyFloat(jackBuffer+timeOffset, fBuffer, frames); #endif } +#endif private: jack_client_t* fClient; @@ -192,7 +195,15 @@ public: fPort(port), fJackBuffer(nullptr) { - carla_debug("CarlaEngineJackEventPort::CarlaEngineJackEventPort(name:\"%s\", %s, %p, %p)", engine.getName(), bool2str(isInput), client, port); + carla_debug("CarlaEngineJackEventPort::CarlaEngineJackEventPort(%s, %p, %p)", bool2str(isInput), client, port); + + static bool sFallbackJackEngineEventNeedsInit = true; + + if (sFallbackJackEngineEventNeedsInit) + { + kFallbackJackEngineEvent.clear(); + sFallbackJackEngineEventNeedsInit = false; + } if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) { @@ -437,7 +448,7 @@ public: fClient(client), fUseClient(engine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || engine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) { - carla_debug("CarlaEngineJackClient::CarlaEngineJackClient(name:\"%s\", %p)", engine.getName(), client); + carla_debug("CarlaEngineJackClient::CarlaEngineJackClient(%p)", client); if (fUseClient) { @@ -1169,13 +1180,13 @@ protected: float* const audioOut2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut2], nframes); void* const eventOut = jackbridge_port_get_buffer(fRackPorts[kRackPortEventOut], nframes); -#ifdef USE_JUCE +# ifdef HAVE_JUCE FloatVectorOperations::copy(audioOut1, audioIn1, nframes); FloatVectorOperations::copy(audioOut2, audioIn2, nframes); -#else +# else carla_copyFloat(audioOut1, audioIn1, nframes); carla_copyFloat(audioOut2, audioIn2, nframes); -#endif +# endif jackbridge_midi_clear_buffer(eventOut); } #endif @@ -1875,7 +1886,7 @@ private: CARLA_ASSERT(fLastConnectionId == 0); CARLA_ASSERT(ourName != nullptr); -#ifdef USE_JUCE +#ifdef HAVE_JUCE using namespace juce; // query initial jack ports diff --git a/source/backend/engine/CarlaEngineJuce.cpp b/source/backend/engine/CarlaEngineJuce.cpp index 32f3ade71..0bc537ee2 100644 --- a/source/backend/engine/CarlaEngineJuce.cpp +++ b/source/backend/engine/CarlaEngineJuce.cpp @@ -15,7 +15,7 @@ * For a full copy of the GNU General Public License see the GPL.txt file */ -#ifndef USE_JUCE +#ifndef HAVE_JUCE # error This file should not be compiled if Juce is disabled #endif diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index 500d8c6b2..9877328d1 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -15,7 +15,9 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ -#ifndef BUILD_BRIDGE +#ifdef BUILD_BRIDGE +# error This file should not be compiled if building bridge +#endif #include "CarlaEngineInternal.hpp" #include "CarlaStateUtils.hpp" @@ -761,5 +763,3 @@ void carla_register_native_plugin_carla() CARLA_BACKEND_END_NAMESPACE // ----------------------------------------------------------------------- - -#endif // ! BUILD_BRIDGE diff --git a/source/backend/engine/CarlaEngineOsc.cpp b/source/backend/engine/CarlaEngineOsc.cpp index 08c2be8ef..a126bb077 100644 --- a/source/backend/engine/CarlaEngineOsc.cpp +++ b/source/backend/engine/CarlaEngineOsc.cpp @@ -415,11 +415,11 @@ int CarlaEngineOsc::handleMsgRegister(const bool isTCP, const int argc, const lo std::free(port); } - for (unsigned short i=0; i < fEngine->getCurrentPluginCount(); ++i) + for (unsigned short i=0, count=fEngine->getCurrentPluginCount(); i < count; ++i) { - CarlaPlugin* const plugin = fEngine->getPluginUnchecked(i); + CarlaPlugin* const plugin(fEngine->getPluginUnchecked(i)); - if (plugin && plugin->isEnabled()) + if (plugin != nullptr && plugin->isEnabled()) plugin->registerToOscClient(); } diff --git a/source/backend/engine/CarlaEngineRtAudio.cpp b/source/backend/engine/CarlaEngineRtAudio.cpp index ceb8a0f36..9e73e7335 100644 --- a/source/backend/engine/CarlaEngineRtAudio.cpp +++ b/source/backend/engine/CarlaEngineRtAudio.cpp @@ -824,6 +824,8 @@ public: fUsedConnections.append(connectionToId); fLastConnectionId++; } + + return true; } // ------------------------------------------------------------------- diff --git a/source/backend/engine/CarlaEngineThread.cpp b/source/backend/engine/CarlaEngineThread.cpp index 634cea9fe..83b3e0442 100644 --- a/source/backend/engine/CarlaEngineThread.cpp +++ b/source/backend/engine/CarlaEngineThread.cpp @@ -48,7 +48,7 @@ void CarlaEngineThread::run() bool oscRegisted, needsSingleThread; float value; - while (fEngine->isRunning() && ! shouldExit()) + for (; fEngine->isRunning() && ! shouldExit();) { #ifdef BUILD_BRIDGE oscRegisted = fEngine->isOscBridgeRegistered(); @@ -60,8 +60,7 @@ void CarlaEngineThread::run() { CarlaPlugin* const plugin(fEngine->getPluginUnchecked(i)); - if (plugin == nullptr || ! plugin->isEnabled()) - continue; + CARLA_SAFE_ASSERT_CONTINUE(plugin != nullptr && plugin->isEnabled()); CARLA_SAFE_ASSERT_INT2(i == plugin->getId(), i, plugin->getId()); diff --git a/source/backend/engine/Makefile b/source/backend/engine/Makefile index 91bd449c2..6bf11c93f 100644 --- a/source/backend/engine/Makefile +++ b/source/backend/engine/Makefile @@ -8,8 +8,6 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) - BUILD_CXX_FLAGS += $(RTAUDIO_FLAGS) BUILD_CXX_FLAGS += $(RTMIDI_FLAGS) @@ -22,12 +20,13 @@ OBJSp = \ CarlaEngineNative.cpp.o OBJS = $(OBJSp) \ - CarlaEngineBridge.cpp.o \ CarlaEngineJack.cpp.o \ CarlaEngineRtAudio.cpp.o +# ifeq ($(HAVE_JUCE),true) # OBJS += \ # CarlaEngineJuce.cpp.o +# endif HEADERS = \ ../CarlaBackend.h ../CarlaEngine.hpp ../CarlaPlugin.hpp \ diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 4fd3eac52..6bc8e49c5 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -29,10 +29,10 @@ CARLA_BACKEND_START_NAMESPACE // ------------------------------------------------------------------- // Fallback data -static const ParameterData kParameterDataNull; -static const ParameterRanges kParameterRangesNull; -static const MidiProgramData kMidiProgramDataNull; -static const CustomData kCustomDataNull; +static ParameterData kParameterDataNull; +static ParameterRanges kParameterRangesNull; +static MidiProgramData kMidiProgramDataNull; +static CustomData kCustomDataNull; static bool gIsLoadingProject = false; @@ -229,6 +229,17 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned int id) CARLA_ASSERT(id == engine->getCurrentPluginCount()); carla_debug("CarlaPlugin::CarlaPlugin(%p, %i)", engine, id); + static bool sFallbackDataNeedsInit = true; + + if (sFallbackDataNeedsInit) + { + kParameterDataNull.clear(); + kParameterRangesNull.clear(); + kMidiProgramDataNull.clear(); + kCustomDataNull.clear(); + sFallbackDataNeedsInit = false; + } + switch (engine->getProccessMode()) { case ENGINE_PROCESS_MODE_SINGLE_CLIENT: diff --git a/source/backend/plugin/JucePlugin.cpp b/source/backend/plugin/JucePlugin.cpp index a0fc73b27..7da02dddb 100644 --- a/source/backend/plugin/JucePlugin.cpp +++ b/source/backend/plugin/JucePlugin.cpp @@ -17,6 +17,8 @@ #include "CarlaPluginInternal.hpp" +#ifdef HAVE_JUCE + #include "JuceHeader.h" using juce::VSTPluginFormat; @@ -57,12 +59,17 @@ private: CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(JucePlugin) }; -// ----------------------------------------------------------------------- +CARLA_BACKEND_END_NAMESPACE + +#endif + +CARLA_BACKEND_START_NAMESPACE -CarlaPlugin* CarlaPlugin::newCsound(const Initializer& init) +CarlaPlugin* CarlaPlugin::newJuce(const Initializer& init) { - carla_debug("CarlaPlugin::newCsound({%p, \"%s\", \"%s\", \"%s\"})", init.engine, init.filename, init.name, init.label); + carla_debug("CarlaPlugin::newJuce({%p, \"%s\", \"%s\", \"%s\"})", init.engine, init.filename, init.name, init.label); +#ifdef HAVE_JUCE JucePlugin* const plugin(new JucePlugin(init.engine, init.id)); //if (! plugin->init(init.filename, init.name, init.label)) @@ -81,6 +88,10 @@ CarlaPlugin* CarlaPlugin::newCsound(const Initializer& init) } return plugin; +#else + init.engine->setLastError("Juce support not available"); + return nullptr; +#endif } CARLA_BACKEND_END_NAMESPACE diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index b7449d9a0..4f4f9aea3 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -3294,7 +3294,9 @@ public: const uint32_t cvIndex(fCvOut.ports[i].param); const float cvValue(fCvOut.ports[i].port->getBuffer()[0]); +#if 0 fCvOut.ports[i].port->writeBuffer(frames, timeOffset); +#endif fParamBuffers[cvIndex] = cvValue; } @@ -3327,7 +3329,7 @@ public: { if (CarlaEngineCVPort* const port = fCvIn.ports[i].port) { - port->setBufferSize(newBufferSize); + //port->setBufferSize(newBufferSize); fDescriptor->connect_port(fHandle, fCvIn.ports[i].rindex, port->getBuffer()); @@ -3340,7 +3342,7 @@ public: { if (CarlaEngineCVPort* const port = fCvOut.ports[i].port) { - port->setBufferSize(newBufferSize); + //port->setBufferSize(newBufferSize); fDescriptor->connect_port(fHandle, fCvOut.ports[i].rindex, port->getBuffer()); diff --git a/source/backend/plugin/Makefile b/source/backend/plugin/Makefile index 746ff3649..35140d777 100644 --- a/source/backend/plugin/Makefile +++ b/source/backend/plugin/Makefile @@ -8,8 +8,6 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) - ifeq ($(HAVE_FLUIDSYNTH),true) BUILD_CXX_FLAGS += $(shell pkg-config --cflags fluidsynth) endif @@ -29,9 +27,10 @@ OBJS = \ DssiPlugin.cpp.o \ Lv2Plugin.cpp.o \ VstPlugin.cpp.o \ - Vst3Plugin.cpp.o \ + CsoundPlugin.cpp.o \ FluidSynthPlugin.cpp.o \ - LinuxSamplerPlugin.cpp.o + LinuxSamplerPlugin.cpp.o \ + JucePlugin.cpp.o HEADERS = \ ../CarlaBackend.h ../CarlaEngine.hpp ../CarlaPlugin.hpp \ diff --git a/source/backend/plugin/VstPlugin.cpp b/source/backend/plugin/VstPlugin.cpp index b8126abc4..04f61ef03 100644 --- a/source/backend/plugin/VstPlugin.cpp +++ b/source/backend/plugin/VstPlugin.cpp @@ -1845,11 +1845,7 @@ protected: #endif case audioMasterGetTime: -#ifdef VESTIGE_HEADER - ret = getAddressFromPointer(&fTimeInfo); -#else - ret = ToVstPtr(&fTimeInfo); -#endif + ret = (intptr_t)&fTimeInfo; break; case audioMasterProcessEvents: @@ -2278,15 +2274,15 @@ public: { const EngineOptions& engineOptions(pData->engine->getOptions()); -#if defined(Q_WS_X11) - CarlaString uiBridgeBinary(engineOptions.bridge_vstX11); -#elif defined(CARLA_OS_MAC) - CarlaString uiBridgeBinary(engineOptions.bridge_vstMac); -#elif defined(CARLA_OS_WIN) - CarlaString uiBridgeBinary(engineOptions.bridge_vstHWND); -#else +// #if defined(Q_WS_X11) +// CarlaString uiBridgeBinary(engineOptions.bridge_vstX11); +// #elif defined(CARLA_OS_MAC) +// CarlaString uiBridgeBinary(engineOptions.bridge_vstMac); +// #elif defined(CARLA_OS_WIN) +// CarlaString uiBridgeBinary(engineOptions.bridge_vstHWND); +// #else CarlaString uiBridgeBinary; -#endif +// #endif if (engineOptions.preferUiBridges && uiBridgeBinary.isNotEmpty() && (fEffect->flags & effFlagsProgramChunks) == 0) { diff --git a/source/backend/standalone/Makefile b/source/backend/standalone/Makefile index 5e05ffbba..14dd07c3f 100644 --- a/source/backend/standalone/Makefile +++ b/source/backend/standalone/Makefile @@ -7,36 +7,35 @@ include ../Makefile.mk # -------------------------------------------------------------- +# Common -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) +LINK_FLAGS += $(shell pkg-config --libs liblo) +LINK_FLAGS += $(QTCORE_LIBS) +LINK_FLAGS += $(QTXML_LIBS) +LINK_FLAGS += $(RTMEMPOOL_LIBS) # -------------------------------------------------------------- -# Common +# Engine -LINK_FLAGS += $(shell pkg-config --libs liblo) +LINK_FLAGS += $(RTAUDIO_LIBS) +LINK_FLAGS += $(RTMIDI_LIBS) LINK_FLAGS += $(JACKBRIDGE_LIBS) + # LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) # LINK_FLAGS += $(JUCE_CORE_LIBS) # LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) # LINK_FLAGS += $(JUCE_EVENTS_LIBS) # LINK_FLAGS += $(JUCE_GRAPHICS_LIBS) # LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS) -LINK_FLAGS += $(RTAUDIO_LIBS) -LINK_FLAGS += $(RTMIDI_LIBS) -LINK_FLAGS += $(RTMEMPOOL_LIBS) -ifeq ($(HAVE_OPENGL),true) -LINK_FLAGS += $(DGL_LIBS) -endif +# -------------------------------------------------------------- +# Plugin ifeq ($(CARLA_PLUGIN_SUPPORT),true) LINK_FLAGS += $(LILV_LIBS) endif -# -------------------------------------------------------------- -# Plugin - ifeq ($(HAVE_FLUIDSYNTH),true) LINK_FLAGS += $(shell pkg-config --libs fluidsynth) endif @@ -51,6 +50,10 @@ endif # -------------------------------------------------------------- # Native +ifeq ($(HAVE_OPENGL),true) +LINK_FLAGS += $(DGL_LIBS) +endif + ifeq ($(HAVE_AF_DEPS),true) LINK_FLAGS += $(shell pkg-config --libs sndfile) ifeq ($(HAVE_FFMPEG),true) diff --git a/source/carla_backend.py b/source/carla_backend.py index 49a1ee1f0..cf241c7f0 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -866,9 +866,10 @@ class EngineDriverDeviceInfo(Structure): # @see ParameterData PyParameterData = { + 'type': PARAMETER_UNKNOWN, + 'hints': 0x0, 'index': PARAMETER_NULL, 'rindex': -1, - 'hints': 0x0, 'midiCC': -1, 'midiChannel': 0 } diff --git a/source/utils/CarlaDssiUtils.hpp b/source/utils/CarlaDssiUtils.hpp index 1cb271e13..08e95875a 100644 --- a/source/utils/CarlaDssiUtils.hpp +++ b/source/utils/CarlaDssiUtils.hpp @@ -21,53 +21,45 @@ #include "CarlaLadspaUtils.hpp" #include "dssi/dssi.h" +#include +#include +#include + // ----------------------------------------------------------------------- static inline const char* find_dssi_ui(const char* const filename, const char* const label) { - CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); - CARLA_SAFE_ASSERT_RETURN(label != nullptr, nullptr); + CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', nullptr); + CARLA_SAFE_ASSERT_RETURN(label != nullptr && label[0] != '\0', nullptr); carla_debug("find_dssi_ui(\"%s\", \"%s\")", filename, label); -#if 0 - using namespace juce; - - File pluginFile(filename); - File pluginDir(pluginFile.getParentDirectory().getFullPathName() + File::separatorString + pluginFile.getFileNameWithoutExtension()); + QString guiFilename; + QString pluginDir(filename); + pluginDir.resize(pluginDir.lastIndexOf(".")); - Array results; + QString checkLabel(label); + QString checkSName(QFileInfo(pluginDir).baseName()); - if (pluginDir.findChildFiles(results, File::findFiles|File::ignoreHiddenFiles, false) == 0) - return nullptr; + if (! checkLabel.endsWith("_")) checkLabel += "_"; + if (! checkSName.endsWith("_")) checkSName += "_"; - StringArray guiFiles; + QStringList guiFiles(QDir(pluginDir).entryList()); - for (int i=0, count=results.size(); i < count; ++i) + foreach (const QString& gui, guiFiles) { - const File& file(results[i]); - guiFiles.add(file.getFileName()); + if (gui.startsWith(checkLabel) || gui.startsWith(checkSName)) + { + QFileInfo finalname(pluginDir + QDir::separator() + gui); + guiFilename = finalname.absoluteFilePath(); + break; + } } - String pluginDirName(pluginDir.getFullPathName()); - String pluginShortName(pluginFile.getFileNameWithoutExtension()); - - String checkLabel(label); - String checkShort(pluginShortName); - - if (! checkLabel.endsWith("_")) checkLabel += "_"; - if (! checkShort.endsWith("_")) checkShort += "_"; - - for (int i=0, count=guiFiles.size(); i < count; ++i) - { - const String& gui(guiFiles[i]); - - if (gui.startsWith(checkLabel) || gui.startsWith(checkShort)) - return carla_strdup(File(pluginDir).getChildFile(gui).getFullPathName().toRawUTF8()); - } -#endif + if (guiFilename.isEmpty()) + return nullptr; - return nullptr; + return carla_strdup(guiFilename.toUtf8().constData()); } // ----------------------------------------------------------------------- diff --git a/source/utils/CarlaStateUtils.hpp b/source/utils/CarlaStateUtils.hpp index 86c4b53f8..1908be8a4 100644 --- a/source/utils/CarlaStateUtils.hpp +++ b/source/utils/CarlaStateUtils.hpp @@ -236,7 +236,7 @@ static inline void fillSaveStateFromXmlNode(SaveState& saveState, const QDomNode& xmlNode) { if (xmlNode.isNull()) - return saveState; + return; for (QDomNode node = xmlNode.firstChild(); ! node.isNull(); node = node.nextSibling()) {