Browse Source

Fully working lv2 parameter groups; Fix carla-single for vst3

tags/v2.1-rc1
falkTX 5 years ago
parent
commit
5cd42f262f
7 changed files with 65 additions and 33 deletions
  1. +1
    -1
      data/carla-single
  2. +1
    -1
      source/backend/CarlaHost.h
  3. +1
    -0
      source/backend/CarlaPlugin.hpp
  4. +5
    -2
      source/backend/plugin/CarlaPluginLV2.cpp
  5. +5
    -5
      source/frontend/carla_widgets.py
  6. +5
    -5
      source/includes/lv2_rdf.hpp
  7. +47
    -19
      source/utils/CarlaLv2Utils.hpp

+ 1
- 1
data/carla-single View File

@@ -96,7 +96,7 @@ if len(sys.argv) == arg:
# --------------------------------------------------------------------------------------------------------
# Set format

if sys.argv[arg] in ("internal", "ladspa", "dssi", "lv2", "vst", "vst2", "gig", "sf2", "sfz"):
if sys.argv[arg] in ("internal", "ladspa", "dssi", "lv2", "vst", "vst2", "vst3", "au", "gig", "sf2", "sfz"):
FORMAT = sys.argv[arg]
arg += 1



+ 1
- 1
source/backend/CarlaHost.h View File

@@ -188,7 +188,7 @@ typedef struct _CarlaParameterInfo {
const char* comment;

/*!
* Parameter group name.
* Parameter group name, prefixed by a unique symbol and ":".
*/
const char* groupName;



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

@@ -343,6 +343,7 @@ public:

/*!
* Get the group name of the parameter @a parameterId.
* @note The group name is prefixed by a unique symbol and ":".
*/
virtual bool getParameterGroupName(const uint32_t parameterId, char* const strBuf) const noexcept;



+ 5
- 2
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -1203,9 +1203,12 @@ public:
{
if (std::strcmp(fRdfDescriptor->PortGroups[i].URI, uri) == 0)
{
if (const char* const label = fRdfDescriptor->PortGroups[i].Label)
const char* const name = fRdfDescriptor->PortGroups[i].Name;
const char* const symbol = fRdfDescriptor->PortGroups[i].Symbol;

if (name != nullptr && symbol != nullptr)
{
std::strncpy(strBuf, label, STR_MAX);
std::snprintf(strBuf, STR_MAX, "%s:%s", symbol, name);
return true;
}
return false;


+ 5
- 5
source/frontend/carla_widgets.py View File

@@ -1489,15 +1489,15 @@ class PluginEdit(QDialog):

for paramInfo in paramList:
groupName = paramInfo['groupName']

if groupName:
groupLayout, groupWidget = groupWidgets.get(groupName, (None, None))
groupSymbol, groupName = groupName.split(":",1)
groupLayout, groupWidget = groupWidgets.get(groupSymbol, (None, None))
if groupLayout is None:
groupWidget = QGroupBox(groupName, scrollAreaWidget)
groupLayout = QVBoxLayout(groupWidget)
groupWidget = QGroupBox(groupName, scrollAreaWidget)
groupLayout = QVBoxLayout(groupWidget)
groupWidget.setPalette(palette2)
scrollAreaLayout.addWidget(groupWidget)
groupWidgets[groupName] = (groupLayout, groupWidget)
groupWidgets[groupSymbol] = (groupLayout, groupWidget)
else:
groupLayout = scrollAreaLayout
groupWidget = scrollAreaWidget


+ 5
- 5
source/includes/lv2_rdf.hpp View File

@@ -465,20 +465,20 @@ struct LV2_RDF_Port {
// Port
struct LV2_RDF_PortGroup {
LV2_URI URI; // shared value, do not deallocate
const char* Label;
const char* Name;
const char* Symbol;

LV2_RDF_PortGroup() noexcept
: URI(nullptr),
Label(nullptr),
Name(nullptr),
Symbol(nullptr) {}

~LV2_RDF_PortGroup() noexcept
{
if (Label != nullptr)
if (Name != nullptr)
{
delete[] Label;
Label = nullptr;
delete[] Name;
Name = nullptr;
}
if (Symbol != nullptr)
{


+ 47
- 19
source/utils/CarlaLv2Utils.hpp View File

@@ -247,12 +247,11 @@ public:
Lilv::Node atom_sequence;
Lilv::Node atom_supports;

Lilv::Node lv2_name;
Lilv::Node lv2_symbol;
Lilv::Node patch_writable;
Lilv::Node parameter;
Lilv::Node pg_group;

Lilv::Node preset_preset;

Lilv::Node state_state;

Lilv::Node ui_portIndex;
@@ -383,12 +382,11 @@ public:
atom_sequence (new_uri(LV2_ATOM__Sequence)),
atom_supports (new_uri(LV2_ATOM__supports)),

lv2_name (new_uri(LV2_CORE__name)),
lv2_symbol (new_uri(LV2_CORE__symbol)),
patch_writable (new_uri(LV2_PATCH__writable)),
parameter (new_uri(LV2_CORE__Parameter)),
pg_group (new_uri(LV2_PORT_GROUPS__group)),

preset_preset (new_uri(LV2_PRESETS__Preset)),

state_state (new_uri(LV2_STATE__state)),

ui_portIndex (new_uri(LV2_UI__portIndex)),
@@ -1646,7 +1644,8 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
Lilv::Plugin lilvPlugin(cPlugin);
LV2_RDF_Descriptor* const rdfDescriptor(new LV2_RDF_Descriptor());

CarlaStringList portGroups(false); // does not allocate own elements
CarlaStringList portGroupURIs(false); // does not allocate own elements
LinkedList<LilvNode*> portGroupNodes;

// ----------------------------------------------------------------------------------------------------------------
// Set Plugin Type
@@ -1842,8 +1841,11 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
if (LilvNode* const groupNode = lilvPort.get(lv2World.pg_group.me))
{
rdfPort->GroupURI = carla_strdup(lilv_node_as_uri(groupNode));
lilv_node_free(groupNode);
portGroups.appendUnique(rdfPort->GroupURI);

if (portGroupURIs.appendUnique(rdfPort->GroupURI))
portGroupNodes.append(groupNode);
else
lilv_node_free(groupNode);
}
}

@@ -2384,8 +2386,11 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
lv2World.pg_group.me, nullptr))
{
rdfParam.GroupURI = carla_strdup_safe(lilv_node_as_uri(groupNode));
lilv_node_free(groupNode);
portGroups.appendUnique(rdfParam.GroupURI);

if (portGroupURIs.appendUnique(rdfParam.GroupURI))
portGroupNodes.append(groupNode);
else
lilv_node_free(groupNode);
}

// ----------------------------------------------------------------------------------------------------
@@ -2526,21 +2531,44 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
// ----------------------------------------------------------------------------------------------------------------
// Set Plugin Port Groups

if (const size_t portGroupCount = portGroups.count())
if (const size_t portGroupCount = portGroupURIs.count())
{
rdfDescriptor->PortGroupCount = static_cast<uint32_t>(portGroupCount);
rdfDescriptor->PortGroups = new LV2_RDF_PortGroup[portGroupCount];

std::size_t i=0;
for (LinkedList<const char*>::Itenerator it = portGroups.begin2(); it.valid(); it.next(), ++i)
uint32_t count = 0;
CarlaStringList::Itenerator itu = portGroupURIs.begin2();
LinkedList<LilvNode*>::Itenerator itn = portGroupNodes.begin2();
for (; itu.valid() && itn.valid(); itu.next(), itn.next())
{
LV2_RDF_PortGroup& portGroup(rdfDescriptor->PortGroups[i]);
const char* const portGroupURI = itu.getValue(nullptr);
CARLA_SAFE_ASSERT_CONTINUE(portGroupURI != nullptr);

portGroup.URI = portGroups.getAt(i);
LilvNode* const portGroupNode = itn.getValue(nullptr);
CARLA_SAFE_ASSERT_CONTINUE(portGroupNode != nullptr);

// TODO
portGroup.Label = carla_strdup_safe(CarlaString(1001+i));
LV2_RDF_PortGroup& portGroup(rdfDescriptor->PortGroups[count]);
portGroup.URI = portGroupURI;

if (LilvNode* const portGroupNameNode = lilv_world_get(lv2World.me, portGroupNode,
lv2World.lv2_name.me, nullptr))
{
portGroup.Name = carla_strdup_safe(lilv_node_as_string(portGroupNameNode));
lilv_node_free(portGroupNameNode);
}

if (LilvNode* const portGroupSymbolNode = lilv_world_get(lv2World.me, portGroupNode,
lv2World.lv2_symbol.me, nullptr))
{
portGroup.Symbol = carla_strdup_safe(lilv_node_as_string(portGroupSymbolNode));
lilv_node_free(portGroupSymbolNode);
}

++count;
lilv_node_free(portGroupNode);
}

rdfDescriptor->PortGroupCount = count;
portGroupNodes.clear();
}

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


Loading…
Cancel
Save