Browse Source

Add pluginId to CLIENT_ADDED callback; Misc changes

tags/1.9.4
falkTX 10 years ago
parent
commit
61ef02afc3
12 changed files with 69 additions and 81 deletions
  1. +1
    -1
      source/Makefile.mk
  2. +1
    -0
      source/backend/CarlaBackend.h
  3. +0
    -7
      source/backend/CarlaHost.h
  4. +0
    -6
      source/backend/CarlaPlugin.hpp
  5. +56
    -43
      source/backend/engine/CarlaEngineJack.cpp
  6. +5
    -5
      source/backend/engine/CarlaEngineJuce.cpp
  7. +5
    -5
      source/backend/engine/CarlaEngineRtAudio.cpp
  8. +0
    -5
      source/backend/plugin/CarlaPlugin.cpp
  9. +0
    -1
      source/backend/plugin/CarlaPluginInternal.cpp
  10. +0
    -1
      source/backend/plugin/CarlaPluginInternal.hpp
  11. +0
    -2
      source/backend/standalone/CarlaStandalone.cpp
  12. +1
    -5
      source/carla_backend.py

+ 1
- 1
source/Makefile.mk View File

@@ -160,7 +160,7 @@ endif
# --------------------------------------------------------------
# Check for optional libs (required by backend or bridges)

HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && pkg-config --max-version=1.9 libavcodec && echo true)
HAVE_FFMPEG = $(shell pkg-config --exists libavcodec libavformat libavutil && echo true)
HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true)
HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true)


+ 1
- 0
source/backend/CarlaBackend.h View File

@@ -784,6 +784,7 @@ typedef enum {
* A patchbay client has been added.
* @param pluginId Client Id
* @param value1 Client icon
* @param value2 Plugin Id (-1 if not a plugin)
* @param valueStr Client name
* @see PatchbayIcon
*/


+ 0
- 7
source/backend/CarlaHost.h View File

@@ -155,12 +155,6 @@ typedef struct _CarlaPluginInfo {
*/
const char* iconName;

/*!
* Patchbay client Id for this plugin.\n
* When 0, Id is considered invalid or unused.
*/
int patchbayClientId;

/*!
* Plugin unique Id.\n
* This Id is dependant on the plugin type and may sometimes be 0.
@@ -183,7 +177,6 @@ typedef struct _CarlaPluginInfo {
maker(nullptr),
copyright(nullptr),
iconName(nullptr),
patchbayClientId(0),
uniqueId(0) {}

/*!


+ 0
- 6
source/backend/CarlaPlugin.hpp View File

@@ -122,12 +122,6 @@ public:
*/
unsigned int getOptionsEnabled() const noexcept;

/*!
* Get the plugin's patchbay client id.\n
* Id 0 means no client.
*/
unsigned int getPatchbayClientId() const noexcept;

/*!
* Check if the plugin is enabled.\n
* When a plugin is disabled, it will never be processed or managed in any way.


+ 56
- 43
source/backend/engine/CarlaEngineJack.cpp View File

@@ -1349,17 +1349,12 @@ protected:
groupNameToId.setData(groupId, groupName);
fUsedGroupNames.append(groupNameToId);

if (jackPortFlags & JackPortIsPhysical)
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), PATCHBAY_ICON_HARDWARE, 0, 0.0f, groupName);
// hardware
}
else
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), 0, 0, 0.0f, groupName);
//fGroupIconsChanged.append(groupId);
// "application"
}
int pluginId = -1;
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, pluginId, 0.0f, groupName);
}

bool portIsInput = (jackPortFlags & JackPortIsInput);
@@ -1724,6 +1719,51 @@ private:
nameBuf[0] = '\0';
}

bool findPluginIdAndIcon(const char* const clientName, int& pluginId, PatchbayIcon& icon)
{
carla_debug("CarlaEngineJack::findPluginIdAndIcon(\"%s\", ...)");

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPlugin* const plugin(pData->plugins[i].plugin);

if (plugin == nullptr || ! plugin->isEnabled())
continue;

const CarlaEngineJackClient* const engClient((const CarlaEngineJackClient*)plugin->getEngineClient());
CARLA_SAFE_ASSERT_CONTINUE(engClient != nullptr && engClient->fClient != nullptr);

const char* const thisClientName(jackbridge_get_client_name(engClient->fClient));
CARLA_SAFE_ASSERT_CONTINUE(thisClientName != nullptr && thisClientName[0] != '\0');

if (std::strcmp(clientName, thisClientName) == 0)
{
carla_stdout("CarlaEngineJack::findPluginIdAndIcon(\"%s\", ...) - found plugin, yes!!!");

pluginId = static_cast<int>(i);

if (const char* const pluginIcon = plugin->getIconName())
{
if (std::strcmp(pluginIcon, "app") == 0 || std::strcmp(pluginIcon, "application") == 0)
icon = PATCHBAY_ICON_APPLICATION;
else if (std::strcmp(pluginIcon, "plugin") == 0)
icon = PATCHBAY_ICON_PLUGIN;
else if (std::strcmp(pluginIcon, "hardware") == 0)
icon = PATCHBAY_ICON_HARDWARE;
else if (std::strcmp(pluginIcon, "carla") == 0)
icon = PATCHBAY_ICON_CARLA;
else if (std::strcmp(pluginIcon, "distrho") == 0)
icon = PATCHBAY_ICON_DISTRHO;
else if (std::strcmp(pluginIcon, "file") == 0)
icon = PATCHBAY_ICON_FILE;
}
return true;
}
}
carla_stdout("CarlaEngineJack::findPluginIdAndIcon(\"%s\", ...) - nothing here...");
return false;
}

void initJackPatchbay(const char* const ourName)
{
CARLA_SAFE_ASSERT_RETURN(fLastGroupId == 0,);
@@ -1742,7 +1782,7 @@ private:
groupNameToId.setData(fLastGroupId++, ourName);
fUsedGroupNames.append(groupNameToId);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0 /* our client */, PATCHBAY_ICON_CARLA, 0, 0.0f, ourName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0 /* our client */, PATCHBAY_ICON_CARLA, -1, 0.0f, ourName);
}

if (const char** ports = jackbridge_get_ports(fClient, nullptr, nullptr, 0))
@@ -1782,39 +1822,12 @@ private:
groupNameToId.setData(groupId, groupName);
fUsedGroupNames.append(groupNameToId);

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

#if 0
void* data = nullptr;
size_t dataSize = 0;
#endif

if (jackPortFlags & JackPortIsPhysical)
{
groupIcon = PATCHBAY_ICON_HARDWARE;
}
#if 0
else 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);

if (std::strcmp(icon, "app") == 0 || std::strcmp(icon, "application") == 0)
groupIcon = PATCHBAY_ICON_APPLICATION;
else if (std::strcmp(icon, "hardware") == 0)
groupIcon = PATCHBAY_ICON_HARDWARE;
else if (std::strcmp(icon, "carla") == 0)
groupIcon = PATCHBAY_ICON_CARLA;
else if (std::strcmp(icon, "distrho") == 0)
groupIcon = PATCHBAY_ICON_DISTRHO;
else if (std::strcmp(icon, "file") == 0)
groupIcon = PATCHBAY_ICON_FILE;
else if (std::strcmp(icon, "plugin") == 0)
groupIcon = PATCHBAY_ICON_PLUGIN;
}
#endif
findPluginIdAndIcon(groupName.getBuffer(), pluginId, icon);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), groupIcon, 0, 0.0f, groupName);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, static_cast<uint>(groupId), icon, pluginId, 0.0f, groupName);
}

bool portIsInput = (jackPortFlags & JackPortIsInput);


+ 5
- 5
source/backend/engine/CarlaEngineJuce.cpp View File

@@ -224,7 +224,7 @@ public:

// Main
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_CARLA, 0, 0, 0.0f, getName());
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_CARLA, PATCHBAY_ICON_CARLA, -1, 0.0f, getName());

callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_CARLA, RACK_PATCHBAY_PORT_AUDIO_IN1, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, "audio-in1");
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_CARLA, RACK_PATCHBAY_PORT_AUDIO_IN2, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, "audio-in2");
@@ -243,7 +243,7 @@ public:
else
std::strncpy(strBuf, "Capture", STR_MAX);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, 0, 0, 0.0f, strBuf);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf);

StringArray inputNames(fDevice->getInputChannelNames());
CARLA_ASSERT(inputNames.size() == static_cast<int>(pData->bufAudio.inCount));
@@ -268,7 +268,7 @@ public:
else
std::strncpy(strBuf, "Playback", STR_MAX);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, 0, 0, 0.0f, strBuf);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf);

StringArray outputNames(fDevice->getOutputChannelNames());
CARLA_ASSERT(outputNames.size() == static_cast<int>(pData->bufAudio.outCount));
@@ -289,7 +289,7 @@ public:
#if 0 // midi implemented yet
// MIDI In
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_IN, 0, 0, 0.0f, "Readable MIDI ports");
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_IN, PATCHBAY_ICON_HARDWARE, -1, 0.0f, "Readable MIDI ports");

for (unsigned int i=0, count=fDummyMidiIn.getPortCount(); i < count; ++i)
{
@@ -304,7 +304,7 @@ public:

// MIDI Out
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, RACK_PATCHBAY_GROUP_MIDI_OUT, 0, 0.0f, "Writable MIDI ports");
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_OUT, PATCHBAY_ICON_HARDWARE, -1, 0.0f, "Writable MIDI ports");

for (unsigned int i=0, count=fDummyMidiOut.getPortCount(); i < count; ++i)
{


+ 5
- 5
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -423,7 +423,7 @@ public:

// Main
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_CARLA, 0, 0, 0.0f, getName());
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_CARLA, PATCHBAY_ICON_CARLA, -1, 0.0f, getName());

callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_CARLA, RACK_PATCHBAY_PORT_AUDIO_IN1, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, "audio-in1");
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, RACK_PATCHBAY_GROUP_CARLA, RACK_PATCHBAY_PORT_AUDIO_IN2, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, "audio-in2");
@@ -440,7 +440,7 @@ public:
else
std::strncpy(strBuf, "Capture", STR_MAX);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, 0, 0, 0.0f, strBuf);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_IN, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf);

for (uint i=0; i < pData->bufAudio.inCount; ++i)
{
@@ -456,7 +456,7 @@ public:
else
std::strncpy(strBuf, "Playback", STR_MAX);

callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, 0, 0, 0.0f, strBuf);
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_AUDIO_OUT, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf);

for (uint i=0; i < pData->bufAudio.outCount; ++i)
{
@@ -467,7 +467,7 @@ public:

// MIDI In
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_IN, 0, 0, 0.0f, "Readable MIDI ports");
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_IN, PATCHBAY_ICON_HARDWARE, -1, 0.0f, "Readable MIDI ports");

for (uint i=0, count=fDummyMidiIn.getPortCount(); i < count; ++i)
{
@@ -484,7 +484,7 @@ public:
#if 0 // midi-out not implemented yet
// MIDI Out
{
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, RACK_PATCHBAY_GROUP_MIDI_OUT, 0, 0.0f, "Writable MIDI ports");
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, RACK_PATCHBAY_GROUP_MIDI_OUT, PATCHBAY_ICON_HARDWARE, -1, 0.0f, "Writable MIDI ports");

for (unsigned int i=0, count=fDummyMidiOut.getPortCount(); i < count; ++i)
{


+ 0
- 5
source/backend/plugin/CarlaPlugin.cpp View File

@@ -171,11 +171,6 @@ unsigned int CarlaPlugin::getOptionsEnabled() const noexcept
return pData->options;
}

unsigned int CarlaPlugin::getPatchbayClientId() const noexcept
{
return pData->patchbayClientId;
}

bool CarlaPlugin::isEnabled() const noexcept
{
return pData->enabled;


+ 0
- 1
source/backend/plugin/CarlaPluginInternal.cpp View File

@@ -465,7 +465,6 @@ CarlaPluginProtectedData::CarlaPluginProtectedData(CarlaEngine* const eng, const
uiLib(nullptr),
ctrlChannel(0),
extraHints(0x0),
patchbayClientId(0),
transientTryCounter(0),
latency(0),
latencyBuffers(nullptr),


+ 0
- 1
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -242,7 +242,6 @@ struct CarlaPluginProtectedData {
// misc
int8_t ctrlChannel;
uint extraHints;
int patchbayClientId;
uint transientTryCounter;

// latency


+ 0
- 2
source/backend/standalone/CarlaStandalone.cpp View File

@@ -993,7 +993,6 @@ const CarlaPluginInfo* carla_get_plugin_info(uint pluginId)
info.filename = nullptr;
info.name = nullptr;
info.iconName = nullptr;
info.patchbayClientId = 0;
info.uniqueId = 0;

// cleanup
@@ -1037,7 +1036,6 @@ const CarlaPluginInfo* carla_get_plugin_info(uint pluginId)

info.optionsAvailable = plugin->getOptionsAvailable();
info.optionsEnabled = plugin->getOptionsEnabled();
info.patchbayClientId = plugin->getPatchbayClientId();

plugin->getLabel(strBufLabel);
info.label = carla_strdup(strBufLabel);


+ 1
- 5
source/carla_backend.py View File

@@ -559,6 +559,7 @@ ENGINE_CALLBACK_RELOAD_ALL = 18
# A patchbay client has been added.
# @param pluginId Client Id
# @param value1 Client icon
# @param value2 Plugin Id (-1 if not a plugin)
# @param valueStr Client name
# @see PatchbayIcon
ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 19
@@ -1001,10 +1002,6 @@ class CarlaPluginInfo(Structure):
# Default is "plugin".
("iconName", c_char_p),

# Patchbay client Id for this plugin.
# When 0, Id is considered invalid or unused.
("patchbayClientId", c_int),

# Plugin unique Id.
# This Id is dependant on the plugin type and may sometimes be 0.
("uniqueId", c_long)
@@ -1133,7 +1130,6 @@ PyCarlaPluginInfo = {
'maker': None,
'copyright': None,
'iconName': None,
'patchbayClientId': 0,
'uniqueId': 0
}



Loading…
Cancel
Save