Browse Source

Split patchbayRefresh for host and osc modes

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-alpha2
falkTX 6 years ago
parent
commit
24d715c8da
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
10 changed files with 158 additions and 110 deletions
  1. +2
    -1
      source/backend/CarlaEngine.hpp
  2. +1
    -1
      source/backend/CarlaStandalone.cpp
  3. +26
    -26
      source/backend/engine/CarlaEngineGraph.cpp
  4. +3
    -3
      source/backend/engine/CarlaEngineGraph.hpp
  5. +15
    -14
      source/backend/engine/CarlaEngineJack.cpp
  6. +14
    -20
      source/backend/engine/CarlaEngineJuce.cpp
  7. +2
    -2
      source/backend/engine/CarlaEngineNative.cpp
  8. +74
    -20
      source/backend/engine/CarlaEngineOscHandlers.cpp
  9. +19
    -23
      source/backend/engine/CarlaEngineRtAudio.cpp
  10. +2
    -0
      source/frontend/carla_control.py

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

@@ -1037,7 +1037,7 @@ public:
/*! /*!
* Force the engine to resend all patchbay clients, ports and connections again. * 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 #endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -1167,6 +1167,7 @@ protected:
* Some internal classes read directly from pData or call protected functions. * Some internal classes read directly from pData or call protected functions.
*/ */
friend class CarlaEngineThread; friend class CarlaEngineThread;
friend class CarlaEngineOsc;
friend class CarlaPluginInstance; friend class CarlaPluginInstance;
friend class EngineInternalGraph; friend class EngineInternalGraph;
friend class PendingRtEventsRunner; friend class PendingRtEventsRunner;


+ 1
- 1
source/backend/CarlaStandalone.cpp View File

@@ -923,7 +923,7 @@ bool carla_patchbay_refresh(bool external)


carla_debug("carla_patchbay_refresh(%s)", bool2str(external)); carla_debug("carla_patchbay_refresh(%s)", bool2str(external));


return gStandalone.engine->patchbayRefresh(external);
return gStandalone.engine->patchbayRefresh(true, false, external);
} }


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


+ 26
- 26
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -311,7 +311,7 @@ bool ExternalGraph::disconnect(const uint connectionId) noexcept
return false; 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,); CARLA_SAFE_ASSERT_RETURN(deviceName != nullptr,);


@@ -319,7 +319,7 @@ void ExternalGraph::refresh(const char* const deviceName)


// Main // Main
{ {
kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
PATCHBAY_ICON_CARLA, PATCHBAY_ICON_CARLA,
@@ -329,7 +329,7 @@ void ExternalGraph::refresh(const char* const deviceName)


if (isRack) if (isRack)
{ {
kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
kExternalGraphCarlaPortAudioIn1, kExternalGraphCarlaPortAudioIn1,
@@ -337,7 +337,7 @@ void ExternalGraph::refresh(const char* const deviceName)
0, 0.0f, 0, 0.0f,
"audio-in1"); "audio-in1");


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
kExternalGraphCarlaPortAudioIn2, kExternalGraphCarlaPortAudioIn2,
@@ -345,7 +345,7 @@ void ExternalGraph::refresh(const char* const deviceName)
0, 0.0f, 0, 0.0f,
"audio-in2"); "audio-in2");


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
kExternalGraphCarlaPortAudioOut1, kExternalGraphCarlaPortAudioOut1,
@@ -353,7 +353,7 @@ void ExternalGraph::refresh(const char* const deviceName)
0, 0.0f, 0, 0.0f,
"audio-out1"); "audio-out1");


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
kExternalGraphCarlaPortAudioOut2, kExternalGraphCarlaPortAudioOut2,
@@ -362,7 +362,7 @@ void ExternalGraph::refresh(const char* const deviceName)
"audio-out2"); "audio-out2");
} }


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
kExternalGraphCarlaPortMidiIn, kExternalGraphCarlaPortMidiIn,
@@ -370,7 +370,7 @@ void ExternalGraph::refresh(const char* const deviceName)
0, 0.0f, 0, 0.0f,
"midi-in"); "midi-in");


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupCarla, kExternalGraphGroupCarla,
kExternalGraphCarlaPortMidiOut, kExternalGraphCarlaPortMidiOut,
@@ -390,7 +390,7 @@ void ExternalGraph::refresh(const char* const deviceName)
else else
std::strncpy(strBuf, "Capture", STR_MAX); std::strncpy(strBuf, "Capture", STR_MAX);


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
kExternalGraphGroupAudioIn, kExternalGraphGroupAudioIn,
PATCHBAY_ICON_HARDWARE, PATCHBAY_ICON_HARDWARE,
@@ -408,7 +408,7 @@ void ExternalGraph::refresh(const char* const deviceName)


portNameToId.setFullName(groupNameIn + portNameToId.name); portNameToId.setFullName(groupNameIn + portNameToId.name);


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupAudioIn, kExternalGraphGroupAudioIn,
++h, ++h,
@@ -423,7 +423,7 @@ void ExternalGraph::refresh(const char* const deviceName)
else else
std::strncpy(strBuf, "Playback", STR_MAX); std::strncpy(strBuf, "Playback", STR_MAX);


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
kExternalGraphGroupAudioOut, kExternalGraphGroupAudioOut,
PATCHBAY_ICON_HARDWARE, PATCHBAY_ICON_HARDWARE,
@@ -441,7 +441,7 @@ void ExternalGraph::refresh(const char* const deviceName)


portNameToId.setFullName(groupNameOut + portNameToId.name); portNameToId.setFullName(groupNameOut + portNameToId.name);


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupAudioOut, kExternalGraphGroupAudioOut,
++h, ++h,
@@ -453,7 +453,7 @@ void ExternalGraph::refresh(const char* const deviceName)


// MIDI In // MIDI In
{ {
kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
kExternalGraphGroupMidiIn, kExternalGraphGroupMidiIn,
PATCHBAY_ICON_HARDWARE, PATCHBAY_ICON_HARDWARE,
@@ -471,7 +471,7 @@ void ExternalGraph::refresh(const char* const deviceName)


portNameToId.setFullName(groupNamePlus + portNameToId.name); portNameToId.setFullName(groupNamePlus + portNameToId.name);


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupMidiIn, kExternalGraphGroupMidiIn,
++h, ++h,
@@ -483,7 +483,7 @@ void ExternalGraph::refresh(const char* const deviceName)


// MIDI Out // MIDI Out
{ {
kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
kExternalGraphGroupMidiOut, kExternalGraphGroupMidiOut,
PATCHBAY_ICON_HARDWARE, PATCHBAY_ICON_HARDWARE,
@@ -501,7 +501,7 @@ void ExternalGraph::refresh(const char* const deviceName)


portNameToId.setFullName(groupNamePlus + portNameToId.name); portNameToId.setFullName(groupNamePlus + portNameToId.name);


kEngine->callback(true, true,
kEngine->callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
kExternalGraphGroupMidiOut, kExternalGraphGroupMidiOut,
++h, ++h,
@@ -783,9 +783,9 @@ bool RackGraph::disconnect(const uint connectionId) noexcept
return extGraph.disconnect(connectionId); 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]; char strBuf[STR_MAX+1];
strBuf[STR_MAX] = '\0'; 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); 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, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 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); 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, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 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); 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, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 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); 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, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 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) if (usingExternal)
return extGraph.refresh(deviceName);
return extGraph.refresh(sendHost, sendOsc, deviceName);


CARLA_SAFE_ASSERT_RETURN(deviceName != nullptr,); CARLA_SAFE_ASSERT_RETURN(deviceName != nullptr,);


@@ -2298,7 +2298,7 @@ bool CarlaEngine::patchbayDisconnect(const uint connectionId)
return false; return false;
} }


bool CarlaEngine::patchbayRefresh(const bool external)
bool CarlaEngine::patchbayRefresh(const bool sendHost, const bool sendOsc, const bool external)
{ {
// subclasses should handle this // subclasses should handle this
CARLA_SAFE_ASSERT_RETURN(! external, false); CARLA_SAFE_ASSERT_RETURN(! external, false);
@@ -2315,7 +2315,7 @@ bool CarlaEngine::patchbayRefresh(const bool external)
PatchbayGraph* const graph = pData->graph.getPatchbayGraph(); PatchbayGraph* const graph = pData->graph.getPatchbayGraph();
CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false);


graph->refresh("");
graph->refresh(sendHost, sendOsc, "");
return true; return true;
} }




+ 3
- 3
source/backend/engine/CarlaEngineGraph.hpp View File

@@ -86,7 +86,7 @@ struct ExternalGraph {
void clear() noexcept; void clear() noexcept;
bool connect(const uint groupA, const uint portA, const uint groupB, const uint portB, const bool sendCallback) 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; 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; const char* const* getConnections() const noexcept;
bool getGroupAndPortIdFromFullName(const char* const fullPortName, uint& groupId, uint& portId) 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 connect(const uint groupA, const uint portA, const uint groupB, const uint portB) noexcept;
bool disconnect(const uint connectionId) 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; const char* const* getConnections() const noexcept;
bool getGroupAndPortIdFromFullName(const char* const fullPortName, uint& groupId, uint& portId) 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 connect(const bool external, const uint groupA, const uint portA, const uint groupB, const uint portB, const bool sendCallback);
bool disconnect(const uint connectionId); bool disconnect(const uint connectionId);
void disconnectInternalGroup(const uint groupId) noexcept; 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; const char* const* getConnections(const bool external) const;
bool getGroupAndPortIdFromFullName(const bool external, const char* const fullPortName, uint& groupId, uint& portId) const; bool getGroupAndPortIdFromFullName(const bool external, const char* const fullPortName, uint& groupId, uint& portId) const;


+ 15
- 14
source/backend/engine/CarlaEngineJack.cpp View File

@@ -961,7 +961,7 @@ public:
fTimebaseMaster = false; fTimebaseMaster = false;


if (opts.processMode != ENGINE_PROCESS_MODE_PATCHBAY) 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_client_registration_callback(fClient, carla_jack_client_registration_callback, this);
jackbridge_set_port_registration_callback(fClient, carla_jack_port_registration_callback, this); jackbridge_set_port_registration_callback(fClient, carla_jack_port_registration_callback, this);
@@ -986,7 +986,7 @@ public:
else else
{ {
pData->graph.create(2, 2); pData->graph.create(2, 2);
patchbayRefresh(false);
patchbayRefresh(true, false, false);
} }
} }


@@ -1477,7 +1477,7 @@ public:
return true; 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); CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, false);


@@ -1487,7 +1487,7 @@ public:
pData->graph.setUsingExternal(external); pData->graph.setUsingExternal(external);


if (! external) if (! external)
return CarlaEngine::patchbayRefresh(false);
return CarlaEngine::patchbayRefresh(sendHost, sendOsc, false);
} }


fUsedGroups.clear(); fUsedGroups.clear();
@@ -1495,8 +1495,7 @@ public:
fUsedConnections.clear(); fUsedConnections.clear();
fNewGroups.clear(); fNewGroups.clear();


initJackPatchbay(jackbridge_get_client_name(fClient));

initJackPatchbay(sendHost, sendOsc, jackbridge_get_client_name(fClient));
return true; return true;
} }


@@ -2024,7 +2023,7 @@ protected:
fUsedGroups.list.append(groupNameToId); fUsedGroups.list.append(groupNameToId);
} }


addPatchbayJackPort(groupId, jackPort, shortPortName, fullPortName, jackPortFlags);
addPatchbayJackPort(true, true, groupId, jackPort, shortPortName, fullPortName, jackPortFlags);
} }
else else
{ {
@@ -2296,7 +2295,7 @@ private:
return false; 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(pData->options.processMode != ENGINE_PROCESS_MODE_PATCHBAY || fExternalPatchbay,);
CARLA_SAFE_ASSERT_RETURN(ourName != nullptr && ourName[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(ourName != nullptr && ourName[0] != '\0',);
@@ -2310,7 +2309,7 @@ private:
GroupNameToId groupNameToId; GroupNameToId groupNameToId;
groupNameToId.setData(++fUsedGroups.lastId, ourName); groupNameToId.setData(++fUsedGroups.lastId, ourName);


callback(true, true,
callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
groupNameToId.group, groupNameToId.group,
PATCHBAY_ICON_CARLA, PATCHBAY_ICON_CARLA,
@@ -2362,7 +2361,7 @@ private:
GroupNameToId groupNameToId; GroupNameToId groupNameToId;
groupNameToId.setData(groupId, groupName); groupNameToId.setData(groupId, groupName);


callback(true, true,
callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED,
groupNameToId.group, groupNameToId.group,
icon, icon,
@@ -2372,7 +2371,7 @@ private:
fUsedGroups.list.append(groupNameToId); fUsedGroups.list.append(groupNameToId);
} }


addPatchbayJackPort(groupId, jackPort, shortPortName, fullPortName, jackPortFlags);
addPatchbayJackPort(sendHost, sendOsc, groupId, jackPort, shortPortName, fullPortName, jackPortFlags);
} }


jackbridge_free(ports); jackbridge_free(ports);
@@ -2414,7 +2413,7 @@ private:
ConnectionToId connectionToId; ConnectionToId connectionToId;
connectionToId.setData(++fUsedConnections.lastId, thisPort.group, thisPort.port, targetPort.group, targetPort.port); connectionToId.setData(++fUsedConnections.lastId, thisPort.group, thisPort.port, targetPort.group, targetPort.port);


callback(true, true,
callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 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 portIsInput = (jackPortFlags & JackPortIsInput);
bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0); bool portIsAudio = (std::strcmp(jackbridge_port_type(jackPort), JACK_DEFAULT_AUDIO_TYPE) == 0);
@@ -2468,7 +2469,7 @@ private:
PortNameToId portNameToId; PortNameToId portNameToId;
portNameToId.setData(groupId, ++fUsedPorts.lastId, shortPortName, fullPortName); portNameToId.setData(groupId, ++fUsedPorts.lastId, shortPortName, fullPortName);


callback(true, true,
callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, ENGINE_CALLBACK_PATCHBAY_PORT_ADDED,
portNameToId.group, portNameToId.group,
static_cast<int>(portNameToId.port), static_cast<int>(portNameToId.port),


+ 14
- 20
source/backend/engine/CarlaEngineJuce.cpp View File

@@ -222,10 +222,10 @@ public:


fDevice->start(this); fDevice->start(this);


patchbayRefresh(false);
patchbayRefresh(true, false, false);


if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY)
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false);
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false, false);


callback(true, true, callback(true, true,
ENGINE_CALLBACK_ENGINE_STARTED, ENGINE_CALLBACK_ENGINE_STARTED,
@@ -343,7 +343,7 @@ public:
// Patchbay // Patchbay


template<class Graph> 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); CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false);


@@ -412,14 +412,14 @@ public:
// --------------------------------------------------------------- // ---------------------------------------------------------------
// now refresh // now refresh


if (sendCallback)
if (sendHost || sendOsc)
{ {
juce::String deviceName(fDevice->getName()); juce::String deviceName(fDevice->getName());


if (deviceName.isNotEmpty()) if (deviceName.isNotEmpty())
deviceName = deviceName.dropLastCharacters(deviceName.fromFirstOccurrenceOf(", ", true, false).length()); 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); std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB);
strBuf[STR_MAX-1] = '\0'; strBuf[STR_MAX-1] = '\0';


callback(true, true,
callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 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); std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB);
strBuf[STR_MAX-1] = '\0'; strBuf[STR_MAX-1] = '\0';


callback(true, true,
callback(sendHost, sendOsc,
ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED,
connectionToId.id, connectionToId.id,
0, 0, 0, 0.0f, 0, 0, 0, 0.0f,
@@ -478,25 +478,19 @@ public:
return true; 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); CARLA_SAFE_ASSERT_RETURN(pData->graph.isReady(), false);


if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) 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);
} }


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


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

@@ -242,7 +242,7 @@ protected:
CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(external), true); CARLA_SAFE_ASSERT_RETURN(readNextLineAsBool(external), true);


try { try {
ok = fEngine->patchbayRefresh(external);
ok = fEngine->patchbayRefresh(true, false, external);
} CARLA_SAFE_EXCEPTION("patchbayRefresh"); } CARLA_SAFE_EXCEPTION("patchbayRefresh");
} }
else if (std::strcmp(msg, "transport_play") == 0) else if (std::strcmp(msg, "transport_play") == 0)
@@ -1803,7 +1803,7 @@ protected:
} }


if (kIsPatchbay) if (kIsPatchbay)
patchbayRefresh(false);
patchbayRefresh(true, false, false);
} }
else else
{ {


+ 74
- 20
source/backend/engine/CarlaEngineOscHandlers.cpp View File

@@ -19,7 +19,7 @@


#ifdef HAVE_LIBLO #ifdef HAVE_LIBLO


#include "CarlaEngine.hpp"
#include "CarlaEngineInternal.hpp"
#include "CarlaPlugin.hpp" #include "CarlaPlugin.hpp"
#include "CarlaMIDI.h" #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()); 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; 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) /**/ if (std::strcmp(method, "clear_engine_xruns") == 0)
{ {
fEngine->clearXruns(); fEngine->clearXruns();
@@ -305,8 +299,6 @@ int CarlaEngineOsc::handleMsgControl(const char* const method,
{ {
fEngine->setActionCanceled(true); fEngine->setActionCanceled(true);
} }
// "patchbay_connect",
// "patchbay_disconnect",
else if (std::strcmp(method, "patchbay_connect") == 0) else if (std::strcmp(method, "patchbay_connect") == 0)
{ {
CARLA_SAFE_ASSERT_INT_RETURN(argc == 4, argc, 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); CARLA_SAFE_ASSERT_RETURN(types[0] == 'i', 0);


const int32_t i = argv[0]->i; 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) else if (std::strcmp(method, "transport_play") == 0)
{ {
@@ -395,14 +387,76 @@ int CarlaEngineOsc::handleMsgControl(const char* const method,


fEngine->transportRelocate(frame); 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; return 0;
} }




+ 19
- 23
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -344,10 +344,10 @@ public:
return false; return false;
} }


patchbayRefresh(false);
patchbayRefresh(true, false, false);


if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY)
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false);
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false, false);


callback(true, true, callback(true, true,
ENGINE_CALLBACK_ENGINE_STARTED, ENGINE_CALLBACK_ENGINE_STARTED,
@@ -463,7 +463,7 @@ public:
// Patchbay // Patchbay


template<class Graph> 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); CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false);


@@ -533,8 +533,8 @@ public:
// --------------------------------------------------------------- // ---------------------------------------------------------------
// now refresh // now refresh


if (sendCallback)
graph->refresh(fDeviceName.buffer());
if (sendHost || sendOsc)
graph->refresh(sendHost, sendOsc, fDeviceName.buffer());


// --------------------------------------------------------------- // ---------------------------------------------------------------
// add midi connections // add midi connections
@@ -556,13 +556,11 @@ public:


extGraph.connections.list.append(connectionToId); 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(); fMidiOutMutex.lock();
@@ -584,13 +582,11 @@ public:


extGraph.connections.list.append(connectionToId); 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(); fMidiOutMutex.unlock();
@@ -598,19 +594,19 @@ public:
return true; 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); CARLA_SAFE_ASSERT_RETURN(pData->graph.isReady(), false);


if (pData->options.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) 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); pData->graph.setUsingExternal(external);


if (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);
} }


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


+ 2
- 0
source/frontend/carla_control.py View File

@@ -447,6 +447,7 @@ class HostWindowOSC(HostWindow):
self.killTimers() self.killTimers()
self.unregister() self.unregister()
self.removeAllPlugins() self.removeAllPlugins()
patchcanvas.clear()


self.ui.act_file_refresh.setEnabled(False) self.ui.act_file_refresh.setEnabled(False)


@@ -559,6 +560,7 @@ class HostWindowOSC(HostWindow):
#self.host.lo_server_tcp.free() #self.host.lo_server_tcp.free()


self.removeAllPlugins() self.removeAllPlugins()
patchcanvas.clear()


self.host.lo_server_tcp = CarlaControlServerTCP(self.host) self.host.lo_server_tcp = CarlaControlServerTCP(self.host)
self.host.lo_server_udp = CarlaControlServerUDP(self.host) self.host.lo_server_udp = CarlaControlServerUDP(self.host)


Loading…
Cancel
Save