Browse Source

Fix jack engine for grouping canvas clients to plugin ids

tags/1.9.4
falkTX 11 years ago
parent
commit
dc146bb5ad
7 changed files with 33 additions and 64 deletions
  1. +3
    -2
      source/backend/CarlaBackend.h
  2. +18
    -51
      source/backend/engine/CarlaEngineJack.cpp
  3. +1
    -1
      source/carla
  4. +3
    -2
      source/carla_backend.py
  5. +3
    -3
      source/carla_host.py
  6. +3
    -3
      source/carla_patchbay.py
  7. +2
    -2
      source/utils/CarlaBackendUtils.hpp

+ 3
- 2
source/backend/CarlaBackend.h View File

@@ -804,12 +804,13 @@ typedef enum {
ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21, ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21,


/*! /*!
* A patchbay client icon has changed.
* A patchbay client data has changed.
* @param pluginId Client Id * @param pluginId Client Id
* @param value1 New icon * @param value1 New icon
* @param value2 New plugin Id (-1 if not a plugin)
* @see PatchbayIcon * @see PatchbayIcon
*/ */
ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED = 22,
ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 22,


/*! /*!
* A patchbay port has been added. * A patchbay port has been added.


+ 18
- 51
source/backend/engine/CarlaEngineJack.cpp View File

@@ -490,7 +490,7 @@ public:
fUsedGroupNames.clear(); fUsedGroupNames.clear();
fUsedPortNames.clear(); fUsedPortNames.clear();
fUsedConnections.clear(); fUsedConnections.clear();
fNewPlugins.clear();
fNewGroups.clear();
#endif #endif
} }


@@ -567,7 +567,7 @@ public:
fUsedGroupNames.clear(); fUsedGroupNames.clear();
fUsedPortNames.clear(); fUsedPortNames.clear();
fUsedConnections.clear(); fUsedConnections.clear();
fNewPlugins.clear();
fNewGroups.clear();


fClient = jackbridge_client_open(clientName, JackNullOption, nullptr); fClient = jackbridge_client_open(clientName, JackNullOption, nullptr);


@@ -576,9 +576,6 @@ public:
pData->bufferSize = jackbridge_get_buffer_size(fClient); pData->bufferSize = jackbridge_get_buffer_size(fClient);
pData->sampleRate = jackbridge_get_sample_rate(fClient); pData->sampleRate = jackbridge_get_sample_rate(fClient);


//jackbridge_custom_publish_data(fClient, URI_CANVAS_ICON, "carla", 6);
//jackbridge_custom_set_data_appearance_callback(fClient, carla_jack_custom_appearance_callback, this);

jackbridge_set_buffer_size_callback(fClient, carla_jack_bufsize_callback, this); jackbridge_set_buffer_size_callback(fClient, carla_jack_bufsize_callback, this);
jackbridge_set_sample_rate_callback(fClient, carla_jack_srate_callback, this); jackbridge_set_sample_rate_callback(fClient, carla_jack_srate_callback, this);
jackbridge_set_freewheel_callback(fClient, carla_jack_freewheel_callback, this); jackbridge_set_freewheel_callback(fClient, carla_jack_freewheel_callback, this);
@@ -663,58 +660,37 @@ public:
fUsedGroupNames.clear(); fUsedGroupNames.clear();
fUsedPortNames.clear(); fUsedPortNames.clear();
fUsedConnections.clear(); fUsedConnections.clear();
fNewPlugins.clear();
fNewGroups.clear();


return false; return false;
#endif #endif
} }


#if 0 //ndef BUILD_BRIDGE
void idle() override void idle() override
{ {
CarlaEngine::idle(); CarlaEngine::idle();


if (fGroupIconsChanged.count() == 0)
return;

static bool checkIcons = false;

if (! checkIcons)
{
checkIcons = true; // check them next time
if (fNewGroups.count() == 0)
return; return;
}

checkIcons = false;

void* data;
size_t dataSize;


List<int> groupIconsCopy;
fGroupIconsChanged.spliceAppend(groupIconsCopy, true);
LinkedList<int> newPlugins;
fNewGroups.spliceInsert(newPlugins, true);


for (List<int>::Itenerator it = groupIconsCopy.begin(); it.valid(); it.next())
for (LinkedList<int>::Itenerator it = newPlugins.begin(); it.valid(); it.next())
{ {
const int& groupId(*it);
const int groupId(it.getValue());
const char* const groupName(getGroupName(groupId)); const char* const groupName(getGroupName(groupId));
CARLA_SAFE_ASSERT_CONTINUE(groupId > 0 && groupName != nullptr && groupName[0] != '\0');


data = nullptr;
dataSize = 0;
int pluginId = -1;
PatchbayIcon icon = PATCHBAY_ICON_PLUGIN;


if (jackbridge_custom_get_data(fClient, groupName, URI_CANVAS_ICON, &data, &dataSize) && data != nullptr && dataSize != 0)
{
const char* const icon((const char*)data);
CARLA_ASSERT(std::strlen(icon)+1 == dataSize);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED, 0, groupId, 0, 0.0f, icon);

jackbridge_free(data);
}
if (findPluginIdAndIcon(groupName, pluginId, icon))
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED, static_cast<uint>(groupId), icon, pluginId, 0.0f, nullptr);
} }


groupIconsCopy.clear();
newPlugins.clear();
} }
#endif


bool isRunning() const noexcept override bool isRunning() const noexcept override
{ {
@@ -742,7 +718,6 @@ public:


CarlaEngineClient* addClient(CarlaPlugin* const plugin) override CarlaEngineClient* addClient(CarlaPlugin* const plugin) override
{ {
//const char* const iconName(plugin->getIconName());
jack_client_t* client = nullptr; jack_client_t* client = nullptr;


#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
@@ -753,8 +728,6 @@ public:
pData->bufferSize = jackbridge_get_buffer_size(client); pData->bufferSize = jackbridge_get_buffer_size(client);
pData->sampleRate = jackbridge_get_sample_rate(client); pData->sampleRate = jackbridge_get_sample_rate(client);


//jackbridge_custom_publish_data(client, URI_CANVAS_ICON, iconName, std::strlen(iconName)+1);

jackbridge_set_buffer_size_callback(client, carla_jack_bufsize_callback, this); jackbridge_set_buffer_size_callback(client, carla_jack_bufsize_callback, this);
jackbridge_set_sample_rate_callback(client, carla_jack_srate_callback, this); jackbridge_set_sample_rate_callback(client, carla_jack_srate_callback, this);
jackbridge_set_freewheel_callback(client, carla_jack_freewheel_callback, this); jackbridge_set_freewheel_callback(client, carla_jack_freewheel_callback, this);
@@ -772,8 +745,6 @@ public:


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


//jackbridge_custom_publish_data(client, URI_CANVAS_ICON, iconName, std::strlen(iconName)+1);

//jackbridge_set_latency_callback(client, carla_jack_latency_callback_plugin, plugin); //jackbridge_set_latency_callback(client, carla_jack_latency_callback_plugin, plugin);
jackbridge_set_process_callback(client, carla_jack_process_callback_plugin, plugin); jackbridge_set_process_callback(client, carla_jack_process_callback_plugin, plugin);
} }
@@ -822,9 +793,6 @@ public:


if (jack_client_t* const jclient = jackbridge_client_open(name, JackNullOption, nullptr)) if (jack_client_t* const jclient = jackbridge_client_open(name, JackNullOption, nullptr))
{ {
//const char* const iconName(plugin->getIconName());
//jackbridge_custom_publish_data(jclient, URI_CANVAS_ICON, iconName, std::strlen(iconName)+1);

// close old client // close old client
plugin->setEnabled(false); plugin->setEnabled(false);


@@ -931,7 +899,7 @@ public:
fUsedGroupNames.clear(); fUsedGroupNames.clear();
fUsedPortNames.clear(); fUsedPortNames.clear();
fUsedConnections.clear(); fUsedConnections.clear();
fNewPlugins.clear();
fNewGroups.clear();


initJackPatchbay(jackbridge_get_client_name(fClient)); initJackPatchbay(jackbridge_get_client_name(fClient));


@@ -1334,12 +1302,11 @@ protected:
groupNameToId.setData(groupId, groupName); groupNameToId.setData(groupId, groupName);
fUsedGroupNames.append(groupNameToId); fUsedGroupNames.append(groupNameToId);


int pluginId = -1;
PatchbayIcon icon = (jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION; PatchbayIcon icon = (jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION;


findPluginIdAndIcon(groupName.getBuffer(), pluginId, icon);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), icon, -1, 0.0f, groupName);


callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), icon, pluginId, 0.0f, groupName);
fNewGroups.append(groupId);
} }


bool portIsInput = (jackPortFlags & JackPortIsInput); bool portIsInput = (jackPortFlags & JackPortIsInput);
@@ -1641,7 +1608,7 @@ private:
LinkedList<GroupNameToId> fUsedGroupNames; LinkedList<GroupNameToId> fUsedGroupNames;
LinkedList<PortNameToId> fUsedPortNames; LinkedList<PortNameToId> fUsedPortNames;
LinkedList<ConnectionToId> fUsedConnections; LinkedList<ConnectionToId> fUsedConnections;
LinkedList<uint> fNewPlugins;
LinkedList<int> fNewGroups;


int getGroupId(const char* const name) int getGroupId(const char* const name)
{ {


+ 1
- 1
source/carla View File

@@ -84,7 +84,7 @@ class CarlaMultiW(QTabWidget):
parent.PatchbayClientAddedCallback.connect(self.fPatchbay.slot_handlePatchbayClientAddedCallback) parent.PatchbayClientAddedCallback.connect(self.fPatchbay.slot_handlePatchbayClientAddedCallback)
parent.PatchbayClientRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRemovedCallback) parent.PatchbayClientRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRemovedCallback)
parent.PatchbayClientRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRenamedCallback) parent.PatchbayClientRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRenamedCallback)
parent.PatchbayClientIconChangedCallback.connect(self.fPatchbay.slot_handlePatchbayClientIconChangedCallback)
parent.PatchbayClientDataChangedCallback.connect(self.fPatchbay.slot_handlePatchbayClientDataChangedCallback)
parent.PatchbayPortAddedCallback.connect(self.fPatchbay.slot_handlePatchbayPortAddedCallback) parent.PatchbayPortAddedCallback.connect(self.fPatchbay.slot_handlePatchbayPortAddedCallback)
parent.PatchbayPortRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRemovedCallback) parent.PatchbayPortRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRemovedCallback)
parent.PatchbayPortRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRenamedCallback) parent.PatchbayPortRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRenamedCallback)


+ 3
- 2
source/carla_backend.py View File

@@ -573,11 +573,12 @@ ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 20
# @param valueStr New client name # @param valueStr New client name
ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21 ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21


# A patchbay client icon has changed.
# A patchbay client data has changed.
# @param pluginId Client Id # @param pluginId Client Id
# @param value1 New icon # @param value1 New icon
# @param value2 New plugin Id (-1 if not a plugin)
# @see PatchbayIcon # @see PatchbayIcon
ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED = 22
ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 22


# A patchbay port has been added. # A patchbay port has been added.
# @param pluginId Client Id # @param pluginId Client Id


+ 3
- 3
source/carla_host.py View File

@@ -124,7 +124,7 @@ class HostWindow(QMainWindow):
PatchbayClientAddedCallback = pyqtSignal(int, int, str) PatchbayClientAddedCallback = pyqtSignal(int, int, str)
PatchbayClientRemovedCallback = pyqtSignal(int) PatchbayClientRemovedCallback = pyqtSignal(int)
PatchbayClientRenamedCallback = pyqtSignal(int, str) PatchbayClientRenamedCallback = pyqtSignal(int, str)
PatchbayClientIconChangedCallback = pyqtSignal(int, int)
PatchbayClientDataChangedCallback = pyqtSignal(int, int, int)
PatchbayPortAddedCallback = pyqtSignal(int, int, int, str) PatchbayPortAddedCallback = pyqtSignal(int, int, int, str)
PatchbayPortRemovedCallback = pyqtSignal(int, int) PatchbayPortRemovedCallback = pyqtSignal(int, int)
PatchbayPortRenamedCallback = pyqtSignal(int, int, str) PatchbayPortRenamedCallback = pyqtSignal(int, int, str)
@@ -1178,8 +1178,8 @@ def engineCallback(ptr, action, pluginId, value1, value2, value3, valueStr):
Carla.gui.PatchbayClientRemovedCallback.emit(pluginId) Carla.gui.PatchbayClientRemovedCallback.emit(pluginId)
elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED: elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED:
Carla.gui.PatchbayClientRenamedCallback.emit(pluginId, valueStr) Carla.gui.PatchbayClientRenamedCallback.emit(pluginId, valueStr)
elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED:
Carla.gui.PatchbayClientIconChangedCallback.emit(pluginId, value1)
elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED:
Carla.gui.PatchbayClientDataChangedCallback.emit(pluginId, value1, value2)
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_ADDED: elif action == ENGINE_CALLBACK_PATCHBAY_PORT_ADDED:
Carla.gui.PatchbayPortAddedCallback.emit(pluginId, value1, value2, valueStr) Carla.gui.PatchbayPortAddedCallback.emit(pluginId, value1, value2, valueStr)
elif action == ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED: elif action == ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED:


+ 3
- 3
source/carla_patchbay.py View File

@@ -133,7 +133,7 @@ class CarlaPatchbayW(QGraphicsView):
parent.PatchbayClientAddedCallback.connect(self.slot_handlePatchbayClientAddedCallback) parent.PatchbayClientAddedCallback.connect(self.slot_handlePatchbayClientAddedCallback)
parent.PatchbayClientRemovedCallback.connect(self.slot_handlePatchbayClientRemovedCallback) parent.PatchbayClientRemovedCallback.connect(self.slot_handlePatchbayClientRemovedCallback)
parent.PatchbayClientRenamedCallback.connect(self.slot_handlePatchbayClientRenamedCallback) parent.PatchbayClientRenamedCallback.connect(self.slot_handlePatchbayClientRenamedCallback)
parent.PatchbayClientIconChangedCallback.connect(self.slot_handlePatchbayClientIconChangedCallback)
parent.PatchbayClientDataChangedCallback.connect(self.slot_handlePatchbayClientDataChangedCallback)
parent.PatchbayPortAddedCallback.connect(self.slot_handlePatchbayPortAddedCallback) parent.PatchbayPortAddedCallback.connect(self.slot_handlePatchbayPortAddedCallback)
parent.PatchbayPortRemovedCallback.connect(self.slot_handlePatchbayPortRemovedCallback) parent.PatchbayPortRemovedCallback.connect(self.slot_handlePatchbayPortRemovedCallback)
parent.PatchbayPortRenamedCallback.connect(self.slot_handlePatchbayPortRenamedCallback) parent.PatchbayPortRenamedCallback.connect(self.slot_handlePatchbayPortRenamedCallback)
@@ -640,8 +640,8 @@ class CarlaPatchbayW(QGraphicsView):
patchcanvas.renameGroup(clientId, newClientName) patchcanvas.renameGroup(clientId, newClientName)
QTimer.singleShot(0, self.fMiniCanvasPreview.update) QTimer.singleShot(0, self.fMiniCanvasPreview.update)


@pyqtSlot(int, int)
def slot_handlePatchbayClientIconChangedCallback(self, clientId, clientIcon):
@pyqtSlot(int, int, int)
def slot_handlePatchbayClientDataChangedCallback(self, clientId, clientIcon, pluginId):
pcIcon = patchcanvas.ICON_APPLICATION pcIcon = patchcanvas.ICON_APPLICATION


if clientIcon == PATCHBAY_ICON_PLUGIN: if clientIcon == PATCHBAY_ICON_PLUGIN:


+ 2
- 2
source/utils/CarlaBackendUtils.hpp View File

@@ -241,8 +241,8 @@ const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED"; return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED";
case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED: case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED:
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED"; return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED";
case ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED:
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED";
case ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED:
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED";
case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED: case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED:
return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED"; return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED";
case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED: case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED:


Loading…
Cancel
Save