Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-alpha2
| @@ -1037,7 +1037,7 @@ public: | |||
| /*! | |||
| * Force the engine to resend all patchbay clients, ports and connections again. | |||
| */ | |||
| virtual bool patchbayRefresh(const bool external); | |||
| virtual bool patchbayRefresh(const bool sendHost, const bool sendOsc, const bool external); | |||
| #endif | |||
| // ------------------------------------------------------------------- | |||
| @@ -1167,6 +1167,7 @@ protected: | |||
| * Some internal classes read directly from pData or call protected functions. | |||
| */ | |||
| friend class CarlaEngineThread; | |||
| friend class CarlaEngineOsc; | |||
| friend class CarlaPluginInstance; | |||
| friend class EngineInternalGraph; | |||
| friend class PendingRtEventsRunner; | |||
| @@ -923,7 +923,7 @@ bool carla_patchbay_refresh(bool external) | |||
| carla_debug("carla_patchbay_refresh(%s)", bool2str(external)); | |||
| return gStandalone.engine->patchbayRefresh(external); | |||
| return gStandalone.engine->patchbayRefresh(true, false, external); | |||
| } | |||
| // -------------------------------------------------------------------------------------------------------------------- | |||
| @@ -311,7 +311,7 @@ bool ExternalGraph::disconnect(const uint connectionId) noexcept | |||
| return false; | |||
| } | |||
| void ExternalGraph::refresh(const char* const deviceName) | |||
| void ExternalGraph::refresh(const bool sendHost, const bool sendOsc, const char* const deviceName) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(deviceName != nullptr,); | |||
| @@ -319,7 +319,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| // Main | |||
| { | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| PATCHBAY_ICON_CARLA, | |||
| @@ -329,7 +329,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| if (isRack) | |||
| { | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| kExternalGraphCarlaPortAudioIn1, | |||
| @@ -337,7 +337,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| 0, 0.0f, | |||
| "audio-in1"); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| kExternalGraphCarlaPortAudioIn2, | |||
| @@ -345,7 +345,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| 0, 0.0f, | |||
| "audio-in2"); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| kExternalGraphCarlaPortAudioOut1, | |||
| @@ -353,7 +353,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| 0, 0.0f, | |||
| "audio-out1"); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| kExternalGraphCarlaPortAudioOut2, | |||
| @@ -362,7 +362,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| "audio-out2"); | |||
| } | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| kExternalGraphCarlaPortMidiIn, | |||
| @@ -370,7 +370,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| 0, 0.0f, | |||
| "midi-in"); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupCarla, | |||
| kExternalGraphCarlaPortMidiOut, | |||
| @@ -390,7 +390,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| else | |||
| std::strncpy(strBuf, "Capture", STR_MAX); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| kExternalGraphGroupAudioIn, | |||
| PATCHBAY_ICON_HARDWARE, | |||
| @@ -408,7 +408,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| portNameToId.setFullName(groupNameIn + portNameToId.name); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupAudioIn, | |||
| ++h, | |||
| @@ -423,7 +423,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| else | |||
| std::strncpy(strBuf, "Playback", STR_MAX); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| kExternalGraphGroupAudioOut, | |||
| PATCHBAY_ICON_HARDWARE, | |||
| @@ -441,7 +441,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| portNameToId.setFullName(groupNameOut + portNameToId.name); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupAudioOut, | |||
| ++h, | |||
| @@ -453,7 +453,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| // MIDI In | |||
| { | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| kExternalGraphGroupMidiIn, | |||
| PATCHBAY_ICON_HARDWARE, | |||
| @@ -471,7 +471,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| portNameToId.setFullName(groupNamePlus + portNameToId.name); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupMidiIn, | |||
| ++h, | |||
| @@ -483,7 +483,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| // MIDI Out | |||
| { | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| kExternalGraphGroupMidiOut, | |||
| PATCHBAY_ICON_HARDWARE, | |||
| @@ -501,7 +501,7 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
| portNameToId.setFullName(groupNamePlus + portNameToId.name); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| kExternalGraphGroupMidiOut, | |||
| ++h, | |||
| @@ -783,9 +783,9 @@ bool RackGraph::disconnect(const uint connectionId) noexcept | |||
| return extGraph.disconnect(connectionId); | |||
| } | |||
| void RackGraph::refresh(const char* const deviceName) | |||
| void RackGraph::refresh(const bool sendHost, const bool sendOsc, const char* const deviceName) | |||
| { | |||
| extGraph.refresh(deviceName); | |||
| extGraph.refresh(sendHost, sendOsc, deviceName); | |||
| char strBuf[STR_MAX+1]; | |||
| strBuf[STR_MAX] = '\0'; | |||
| @@ -804,7 +804,7 @@ void RackGraph::refresh(const char* const deviceName) | |||
| std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -824,7 +824,7 @@ void RackGraph::refresh(const char* const deviceName) | |||
| std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -844,7 +844,7 @@ void RackGraph::refresh(const char* const deviceName) | |||
| std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -864,7 +864,7 @@ void RackGraph::refresh(const char* const deviceName) | |||
| std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
| kEngine->callback(true, true, | |||
| kEngine->callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -1830,10 +1830,10 @@ void PatchbayGraph::disconnectInternalGroup(const uint groupId) noexcept | |||
| } | |||
| } | |||
| void PatchbayGraph::refresh(const char* const deviceName) | |||
| void PatchbayGraph::refresh(const bool sendHost, const bool sendOsc, const char* const deviceName) | |||
| { | |||
| if (usingExternal) | |||
| return extGraph.refresh(deviceName); | |||
| return extGraph.refresh(sendHost, sendOsc, deviceName); | |||
| CARLA_SAFE_ASSERT_RETURN(deviceName != nullptr,); | |||
| @@ -2298,7 +2298,7 @@ bool CarlaEngine::patchbayDisconnect(const uint connectionId) | |||
| return false; | |||
| } | |||
| bool CarlaEngine::patchbayRefresh(const bool external) | |||
| bool CarlaEngine::patchbayRefresh(const bool sendHost, const bool sendOsc, const bool external) | |||
| { | |||
| // subclasses should handle this | |||
| CARLA_SAFE_ASSERT_RETURN(! external, false); | |||
| @@ -2315,7 +2315,7 @@ bool CarlaEngine::patchbayRefresh(const bool external) | |||
| PatchbayGraph* const graph = pData->graph.getPatchbayGraph(); | |||
| CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); | |||
| graph->refresh(""); | |||
| graph->refresh(sendHost, sendOsc, ""); | |||
| return true; | |||
| } | |||
| @@ -86,7 +86,7 @@ struct ExternalGraph { | |||
| void clear() noexcept; | |||
| bool connect(const uint groupA, const uint portA, const uint groupB, const uint portB, const bool sendCallback) noexcept; | |||
| bool disconnect(const uint connectionId) noexcept; | |||
| void refresh(const char* const deviceName); | |||
| void refresh(const bool sendHost, const bool sendOsc, const char* const deviceName); | |||
| const char* const* getConnections() const noexcept; | |||
| bool getGroupAndPortIdFromFullName(const char* const fullPortName, uint& groupId, uint& portId) const noexcept; | |||
| @@ -130,7 +130,7 @@ struct RackGraph { | |||
| bool connect(const uint groupA, const uint portA, const uint groupB, const uint portB) noexcept; | |||
| bool disconnect(const uint connectionId) noexcept; | |||
| void refresh(const char* const deviceName); | |||
| void refresh(const bool sendHost, const bool sendOsc, const char* const deviceName); | |||
| const char* const* getConnections() const noexcept; | |||
| bool getGroupAndPortIdFromFullName(const char* const fullPortName, uint& groupId, uint& portId) const noexcept; | |||
| @@ -177,7 +177,7 @@ public: | |||
| bool connect(const bool external, const uint groupA, const uint portA, const uint groupB, const uint portB, const bool sendCallback); | |||
| bool disconnect(const uint connectionId); | |||
| void disconnectInternalGroup(const uint groupId) noexcept; | |||
| void refresh(const char* const deviceName); | |||
| void refresh(const bool sendHost, const bool sendOsc, const char* const deviceName); | |||
| const char* const* getConnections(const bool external) const; | |||
| bool getGroupAndPortIdFromFullName(const bool external, const char* const fullPortName, uint& groupId, uint& portId) const; | |||
| @@ -961,7 +961,7 @@ public: | |||
| fTimebaseMaster = false; | |||
| if (opts.processMode != ENGINE_PROCESS_MODE_PATCHBAY) | |||
| initJackPatchbay(jackClientName); | |||
| initJackPatchbay(true, false, jackClientName); | |||
| jackbridge_set_client_registration_callback(fClient, carla_jack_client_registration_callback, this); | |||
| jackbridge_set_port_registration_callback(fClient, carla_jack_port_registration_callback, this); | |||
| @@ -986,7 +986,7 @@ public: | |||
| else | |||
| { | |||
| pData->graph.create(2, 2); | |||
| patchbayRefresh(false); | |||
| patchbayRefresh(true, false, false); | |||
| } | |||
| } | |||
| @@ -1477,7 +1477,7 @@ public: | |||
| return true; | |||
| } | |||
| bool patchbayRefresh(const bool external) override | |||
| bool patchbayRefresh(const bool sendHost, const bool sendOsc, const bool external) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, false); | |||
| @@ -1487,7 +1487,7 @@ public: | |||
| pData->graph.setUsingExternal(external); | |||
| if (! external) | |||
| return CarlaEngine::patchbayRefresh(false); | |||
| return CarlaEngine::patchbayRefresh(sendHost, sendOsc, false); | |||
| } | |||
| fUsedGroups.clear(); | |||
| @@ -1495,8 +1495,7 @@ public: | |||
| fUsedConnections.clear(); | |||
| fNewGroups.clear(); | |||
| initJackPatchbay(jackbridge_get_client_name(fClient)); | |||
| initJackPatchbay(sendHost, sendOsc, jackbridge_get_client_name(fClient)); | |||
| return true; | |||
| } | |||
| @@ -2024,7 +2023,7 @@ protected: | |||
| fUsedGroups.list.append(groupNameToId); | |||
| } | |||
| addPatchbayJackPort(groupId, jackPort, shortPortName, fullPortName, jackPortFlags); | |||
| addPatchbayJackPort(true, true, groupId, jackPort, shortPortName, fullPortName, jackPortFlags); | |||
| } | |||
| else | |||
| { | |||
| @@ -2296,7 +2295,7 @@ private: | |||
| return false; | |||
| } | |||
| void initJackPatchbay(const char* const ourName) | |||
| void initJackPatchbay(const bool sendHost, const bool sendOsc, const char* const ourName) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY || fExternalPatchbay,); | |||
| CARLA_SAFE_ASSERT_RETURN(ourName != nullptr && ourName[0] != '\0',); | |||
| @@ -2310,7 +2309,7 @@ private: | |||
| GroupNameToId groupNameToId; | |||
| groupNameToId.setData(++fUsedGroups.lastId, ourName); | |||
| callback(true, true, | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| groupNameToId.group, | |||
| PATCHBAY_ICON_CARLA, | |||
| @@ -2362,7 +2361,7 @@ private: | |||
| GroupNameToId groupNameToId; | |||
| groupNameToId.setData(groupId, groupName); | |||
| callback(true, true, | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
| groupNameToId.group, | |||
| icon, | |||
| @@ -2372,7 +2371,7 @@ private: | |||
| fUsedGroups.list.append(groupNameToId); | |||
| } | |||
| addPatchbayJackPort(groupId, jackPort, shortPortName, fullPortName, jackPortFlags); | |||
| addPatchbayJackPort(sendHost, sendOsc, groupId, jackPort, shortPortName, fullPortName, jackPortFlags); | |||
| } | |||
| jackbridge_free(ports); | |||
| @@ -2414,7 +2413,7 @@ private: | |||
| ConnectionToId connectionToId; | |||
| connectionToId.setData(++fUsedConnections.lastId, thisPort.group, thisPort.port, targetPort.group, targetPort.port); | |||
| callback(true, true, | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -2430,7 +2429,9 @@ private: | |||
| } | |||
| } | |||
| void addPatchbayJackPort(const uint groupId, const jack_port_t* const jackPort, const char* const shortPortName, const char* const fullPortName, const int jackPortFlags) | |||
| void addPatchbayJackPort(const bool sendHost, const bool sendOsc, | |||
| const uint groupId, const jack_port_t* const jackPort, | |||
| const char* const shortPortName, const char* const fullPortName, const int jackPortFlags) | |||
| { | |||
| bool portIsInput = (jackPortFlags & JackPortIsInput); | |||
| bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0); | |||
| @@ -2468,7 +2469,7 @@ private: | |||
| PortNameToId portNameToId; | |||
| portNameToId.setData(groupId, ++fUsedPorts.lastId, shortPortName, fullPortName); | |||
| callback(true, true, | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
| portNameToId.group, | |||
| static_cast<int>(portNameToId.port), | |||
| @@ -222,10 +222,10 @@ public: | |||
| fDevice->start(this); | |||
| patchbayRefresh(false); | |||
| patchbayRefresh(true, false, false); | |||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
| refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false); | |||
| refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false, false); | |||
| callback(true, true, | |||
| ENGINE_CALLBACK_ENGINE_STARTED, | |||
| @@ -343,7 +343,7 @@ public: | |||
| // Patchbay | |||
| template<class Graph> | |||
| bool refreshExternalGraphPorts(Graph* const graph, const bool sendCallback) | |||
| bool refreshExternalGraphPorts(Graph* const graph, const bool sendHost, const bool sendOsc) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); | |||
| @@ -412,14 +412,14 @@ public: | |||
| // --------------------------------------------------------------- | |||
| // now refresh | |||
| if (sendCallback) | |||
| if (sendHost || sendOsc) | |||
| { | |||
| juce::String deviceName(fDevice->getName()); | |||
| if (deviceName.isNotEmpty()) | |||
| deviceName = deviceName.dropLastCharacters(deviceName.fromFirstOccurrenceOf(", ", true, false).length()); | |||
| graph->refresh(deviceName.toRawUTF8()); | |||
| graph->refresh(sendHost, sendOsc, deviceName.toRawUTF8()); | |||
| } | |||
| // --------------------------------------------------------------- | |||
| @@ -439,7 +439,7 @@ public: | |||
| std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
| strBuf[STR_MAX-1] = '\0'; | |||
| callback(true, true, | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -464,7 +464,7 @@ public: | |||
| std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
| strBuf[STR_MAX-1] = '\0'; | |||
| callback(true, true, | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| @@ -478,25 +478,19 @@ public: | |||
| return true; | |||
| } | |||
| bool patchbayRefresh(const bool external) override | |||
| bool patchbayRefresh(const bool sendHost, const bool sendOsc, const bool external) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->graph.isReady(), false); | |||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) | |||
| { | |||
| return refreshExternalGraphPorts<RackGraph>(pData->graph.getRackGraph(), true); | |||
| } | |||
| else | |||
| { | |||
| pData->graph.setUsingExternal(external); | |||
| return refreshExternalGraphPorts<RackGraph>(pData->graph.getRackGraph(), sendHost, sendOsc); | |||
| if (external) | |||
| return refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), true); | |||
| else | |||
| return CarlaEngine::patchbayRefresh(false); | |||
| } | |||
| pData->graph.setUsingExternal(external); | |||
| return false; | |||
| if (external) | |||
| return refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), sendHost, sendOsc); | |||
| return CarlaEngine::patchbayRefresh(sendHost, sendOsc, false); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -242,7 +242,7 @@ protected: | |||
| CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(external), true); | |||
| try { | |||
| ok = fEngine->patchbayRefresh(external); | |||
| ok = fEngine->patchbayRefresh(true, false, external); | |||
| } CARLA_SAFE_EXCEPTION("patchbayRefresh"); | |||
| } | |||
| else if (std::strcmp(msg, "transport_play") == 0) | |||
| @@ -1803,7 +1803,7 @@ protected: | |||
| } | |||
| if (kIsPatchbay) | |||
| patchbayRefresh(false); | |||
| patchbayRefresh(true, false, false); | |||
| } | |||
| else | |||
| { | |||
| @@ -19,7 +19,7 @@ | |||
| #ifdef HAVE_LIBLO | |||
| #include "CarlaEngine.hpp" | |||
| #include "CarlaEngineInternal.hpp" | |||
| #include "CarlaPlugin.hpp" | |||
| #include "CarlaMIDI.h" | |||
| @@ -241,6 +241,9 @@ int CarlaEngineOsc::handleMsgRegister(const bool isTCP, | |||
| fEngine->callback(false, true, ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName()); | |||
| } | |||
| const bool usingExternalPatchbay = false; | |||
| fEngine->patchbayRefresh(false, true, fEngine->pData->graph.isUsingExternal()); | |||
| } | |||
| } | |||
| @@ -288,15 +291,6 @@ int CarlaEngineOsc::handleMsgControl(const char* const method, | |||
| return 0; | |||
| } | |||
| carla_stdout("OSC control for '%s'", method); | |||
| // "patchbay_refresh", | |||
| // "transport_play", | |||
| // "transport_pause", | |||
| // "transport_relocate", | |||
| // "transport_bpm", | |||
| /**/ if (std::strcmp(method, "clear_engine_xruns") == 0) | |||
| { | |||
| fEngine->clearXruns(); | |||
| @@ -305,8 +299,6 @@ int CarlaEngineOsc::handleMsgControl(const char* const method, | |||
| { | |||
| fEngine->setActionCanceled(true); | |||
| } | |||
| // "patchbay_connect", | |||
| // "patchbay_disconnect", | |||
| else if (std::strcmp(method, "patchbay_connect") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 4, argc, 0); | |||
| @@ -348,7 +340,7 @@ int CarlaEngineOsc::handleMsgControl(const char* const method, | |||
| CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0); | |||
| const int32_t i = argv[0]->i; | |||
| fEngine->patchbayRefresh(i != 0); | |||
| fEngine->patchbayRefresh(false, true, i != 0); | |||
| } | |||
| else if (std::strcmp(method, "transport_play") == 0) | |||
| { | |||
| @@ -395,14 +387,76 @@ int CarlaEngineOsc::handleMsgControl(const char* const method, | |||
| fEngine->transportRelocate(frame); | |||
| } | |||
| // TODO add plugin | |||
| else if (std::strcmp(method, "remove_plugin") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0); | |||
| const int32_t i = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_RETURN(i >= 0, 0); | |||
| fEngine->removePlugin(static_cast<uint32_t>(i)); | |||
| } | |||
| else if (std::strcmp(method, "remove_all_plugins") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 0, argc, 0); | |||
| fEngine->removeAllPlugins(); | |||
| } | |||
| else if (std::strcmp(method, "rename_plugin") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 2, argc, 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[1] == 's', 0); | |||
| const int32_t i = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_RETURN(i >= 0, 0); | |||
| const char* const s = &argv[0]->s; | |||
| CARLA_SAFE_ASSERT_RETURN(s != nullptr && s[0] != '\0', 0); | |||
| fEngine->renamePlugin(static_cast<uint32_t>(i), s); | |||
| } | |||
| else if (std::strcmp(method, "clone_plugin") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0); | |||
| const int32_t i = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_RETURN(i >= 0, 0); | |||
| fEngine->clonePlugin(static_cast<uint32_t>(i)); | |||
| } | |||
| else if (std::strcmp(method, "replace_plugin") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 1, argc, 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0); | |||
| const int32_t i = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_RETURN(i >= 0, 0); | |||
| fEngine->replacePlugin(static_cast<uint32_t>(i)); | |||
| } | |||
| else if (std::strcmp(method, "switch_plugins") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_INT_RETURN(argc == 2, argc, 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0); | |||
| CARLA_SAFE_ASSERT_RETURN(types[1] == 'i', 0); | |||
| const int32_t i0 = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_RETURN(i0 >= 0, 0); | |||
| const int32_t i1 = argv[0]->i; | |||
| CARLA_SAFE_ASSERT_RETURN(i1 >= 0, 0); | |||
| fEngine->switchPlugins(static_cast<uint32_t>(i0), static_cast<uint32_t>(i1)); | |||
| } | |||
| else | |||
| { | |||
| carla_stderr2("Unhandled OSC control for '%s'", method); | |||
| } | |||
| // #"add_plugin", | |||
| // "remove_plugin", | |||
| // "remove_all_plugins", | |||
| // "rename_plugin", | |||
| // "clone_plugin", | |||
| // "replace_plugin", | |||
| // "switch_plugins", | |||
| return 0; | |||
| } | |||
| @@ -344,10 +344,10 @@ public: | |||
| return false; | |||
| } | |||
| patchbayRefresh(false); | |||
| patchbayRefresh(true, false, false); | |||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
| refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false); | |||
| refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false, false); | |||
| callback(true, true, | |||
| ENGINE_CALLBACK_ENGINE_STARTED, | |||
| @@ -463,7 +463,7 @@ public: | |||
| // Patchbay | |||
| template<class Graph> | |||
| bool refreshExternalGraphPorts(Graph* const graph, const bool sendCallback) | |||
| bool refreshExternalGraphPorts(Graph* const graph, const bool sendHost, const bool sendOsc) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); | |||
| @@ -533,8 +533,8 @@ public: | |||
| // --------------------------------------------------------------- | |||
| // now refresh | |||
| if (sendCallback) | |||
| graph->refresh(fDeviceName.buffer()); | |||
| if (sendHost || sendOsc) | |||
| graph->refresh(sendHost, sendOsc, fDeviceName.buffer()); | |||
| // --------------------------------------------------------------- | |||
| // add midi connections | |||
| @@ -556,13 +556,11 @@ public: | |||
| extGraph.connections.list.append(connectionToId); | |||
| if (sendCallback) { | |||
| callback(true, true, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| strBuf); | |||
| } | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| strBuf); | |||
| } | |||
| fMidiOutMutex.lock(); | |||
| @@ -584,13 +582,11 @@ public: | |||
| extGraph.connections.list.append(connectionToId); | |||
| if (sendCallback) { | |||
| callback(true, true, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| strBuf); | |||
| } | |||
| callback(sendHost, sendOsc, | |||
| ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
| connectionToId.id, | |||
| 0, 0, 0, 0.0f, | |||
| strBuf); | |||
| } | |||
| fMidiOutMutex.unlock(); | |||
| @@ -598,19 +594,19 @@ public: | |||
| return true; | |||
| } | |||
| bool patchbayRefresh(const bool external) override | |||
| bool patchbayRefresh(const bool sendHost, const bool sendOsc, const bool external) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(pData->graph.isReady(), false); | |||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) | |||
| return refreshExternalGraphPorts<RackGraph>(pData->graph.getRackGraph(), true); | |||
| return refreshExternalGraphPorts<RackGraph>(pData->graph.getRackGraph(), sendHost, sendOsc); | |||
| pData->graph.setUsingExternal(external); | |||
| if (external) | |||
| return refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), true); | |||
| return refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), sendHost, sendOsc); | |||
| return CarlaEngine::patchbayRefresh(false); | |||
| return CarlaEngine::patchbayRefresh(sendHost, sendOsc, false); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -447,6 +447,7 @@ class HostWindowOSC(HostWindow): | |||
| self.killTimers() | |||
| self.unregister() | |||
| self.removeAllPlugins() | |||
| patchcanvas.clear() | |||
| self.ui.act_file_refresh.setEnabled(False) | |||
| @@ -559,6 +560,7 @@ class HostWindowOSC(HostWindow): | |||
| #self.host.lo_server_tcp.free() | |||
| self.removeAllPlugins() | |||
| patchcanvas.clear() | |||
| self.host.lo_server_tcp = CarlaControlServerTCP(self.host) | |||
| self.host.lo_server_udp = CarlaControlServerUDP(self.host) | |||