Browse Source

Rework for better plugin string result handling; single page params

tags/v2.1-rc1
falkTX 5 years ago
parent
commit
f652ad2e13
22 changed files with 736 additions and 398 deletions
  1. +44
    -8
      resources/ui/carla_edit.ui
  2. +10
    -0
      source/backend/CarlaHost.h
  3. +6
    -0
      source/backend/CarlaHostCommon.cpp
  4. +21
    -11
      source/backend/CarlaPlugin.hpp
  5. +44
    -11
      source/backend/CarlaStandalone.cpp
  6. +46
    -21
      source/backend/plugin/CarlaPlugin.cpp
  7. +25
    -15
      source/backend/plugin/CarlaPluginBridge.cpp
  8. +31
    -30
      source/backend/plugin/CarlaPluginDSSI.cpp
  9. +41
    -39
      source/backend/plugin/CarlaPluginFluidSynth.cpp
  10. +8
    -6
      source/backend/plugin/CarlaPluginJack.cpp
  11. +21
    -14
      source/backend/plugin/CarlaPluginJuce.cpp
  12. +58
    -59
      source/backend/plugin/CarlaPluginLADSPA.cpp
  13. +143
    -62
      source/backend/plugin/CarlaPluginLV2.cpp
  14. +38
    -38
      source/backend/plugin/CarlaPluginNative.cpp
  15. +13
    -10
      source/backend/plugin/CarlaPluginSFZero.cpp
  16. +25
    -18
      source/backend/plugin/CarlaPluginVST2.cpp
  17. +8
    -0
      source/frontend/carla_backend.py
  18. +22
    -45
      source/frontend/carla_widgets.py
  19. +52
    -0
      source/includes/lv2_rdf.hpp
  20. +1
    -0
      source/modules/lilv/lilv-0.24.0/lilv/lilvmm.hpp
  21. +47
    -1
      source/utils/CarlaLv2Utils.hpp
  22. +32
    -10
      source/utils/CarlaStringList.hpp

+ 44
- 8
resources/ui/carla_edit.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>505</width>
<height>436</height>
<width>537</width>
<height>535</height>
</rect>
</property>
<property name="windowTitle">
@@ -170,7 +170,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -224,7 +233,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -499,7 +517,16 @@ Plugin Name
</property>
<widget class="QWidget" name="sww_programs">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@@ -542,7 +569,16 @@ Plugin Name
</widget>
<widget class="QWidget" name="sww_midiPrograms">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@@ -597,7 +633,7 @@ Plugin Name
<string>Save State</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<iconset>
<normaloff>:/16x16/document-save.png</normaloff>:/16x16/document-save.png</iconset>
</property>
</widget>
@@ -611,7 +647,7 @@ Plugin Name
<string>Load State</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<iconset>
<normaloff>:/16x16/document-open.png</normaloff>:/16x16/document-open.png</iconset>
</property>
</widget>


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

@@ -182,6 +182,16 @@ typedef struct _CarlaParameterInfo {
*/
const char* unit;

/*!
* Parameter comment / documentation.
*/
const char* comment;

/*!
* Parameter group name.
*/
const char* groupName;

/*!
* Number of scale points.
* @see CarlaScalePointInfo


+ 6
- 0
source/backend/CarlaHostCommon.cpp View File

@@ -66,6 +66,8 @@ _CarlaParameterInfo::_CarlaParameterInfo() noexcept
: name(gNullCharPtr),
symbol(gNullCharPtr),
unit(gNullCharPtr),
comment(gNullCharPtr),
groupName(gNullCharPtr),
scalePointCount(0) {}

_CarlaParameterInfo::~_CarlaParameterInfo() noexcept
@@ -76,6 +78,10 @@ _CarlaParameterInfo::~_CarlaParameterInfo() noexcept
delete[] symbol;
if (unit != gNullCharPtr)
delete[] unit;
if (comment != gNullCharPtr)
delete[] comment;
if (groupName != gNullCharPtr)
delete[] groupName;
}

_CarlaScalePointInfo::_CarlaScalePointInfo() noexcept


+ 21
- 11
source/backend/CarlaPlugin.hpp View File

@@ -296,50 +296,60 @@ public:
/*!
* Get the plugin's label (URI for LV2 plugins).
*/
virtual void getLabel(char* const strBuf) const noexcept;
virtual bool getLabel(char* const strBuf) const noexcept;

/*!
* Get the plugin's maker.
*/
virtual void getMaker(char* const strBuf) const noexcept;
virtual bool getMaker(char* const strBuf) const noexcept;

/*!
* Get the plugin's copyright/license.
*/
virtual void getCopyright(char* const strBuf) const noexcept;
virtual bool getCopyright(char* const strBuf) const noexcept;

/*!
* Get the plugin's (real) name.
*
* @see getName() and setName()
*/
virtual void getRealName(char* const strBuf) const noexcept;
virtual bool getRealName(char* const strBuf) const noexcept;

/*!
* Get the name of the parameter @a parameterId.
*/
virtual void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept;
virtual bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept;

/*!
* Get the symbol of the parameter @a parameterId.
*/
virtual void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept;
virtual bool getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept;

/*!
* Get the custom text of the parameter @a parameterId.
* @see PARAMETER_USES_CUSTOM_TEXT
*/
virtual void getParameterText(const uint32_t parameterId, char* const strBuf) noexcept;
virtual bool getParameterText(const uint32_t parameterId, char* const strBuf) noexcept;

/*!
* Get the unit of the parameter @a parameterId.
*/
virtual void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept;
virtual bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept;

/*!
* Get the comment (documentation) of the parameter @a parameterId.
*/
virtual bool getParameterComment(const uint32_t parameterId, char* const strBuf) const noexcept;

/*!
* Get the group name of the parameter @a parameterId.
*/
virtual bool getParameterGroupName(const uint32_t parameterId, char* const strBuf) const noexcept;

/*!
* Get the scalepoint @a scalePointId label of the parameter @a parameterId.
*/
virtual void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept;
virtual bool getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept;

/*!
* Get the current parameter value of @a parameterId.
@@ -351,14 +361,14 @@ public:
/*!
* Get the name of the program at @a index.
*/
void getProgramName(const uint32_t index, char* const strBuf) const noexcept;
bool getProgramName(const uint32_t index, char* const strBuf) const noexcept;

/*!
* Get the name of the MIDI program at @a index.
*
* @see getMidiProgramInfo()
*/
void getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept;
bool getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept;

/*!
* Get information about the plugin's parameter count.


+ 44
- 11
source/backend/CarlaStandalone.cpp View File

@@ -1300,6 +1300,18 @@ const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t param
retInfo.unit = gNullCharPtr;
}

if (retInfo.comment != gNullCharPtr)
{
delete[] retInfo.comment;
retInfo.comment = gNullCharPtr;
}

if (retInfo.groupName != gNullCharPtr)
{
delete[] retInfo.groupName;
retInfo.groupName = gNullCharPtr;
}

CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &retInfo);

CarlaPlugin* const plugin(gStandalone.engine->getPlugin(pluginId));
@@ -1308,24 +1320,45 @@ const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t param
carla_debug("carla_get_parameter_info(%i, %i)", pluginId, parameterId);

char strBuf[STR_MAX+1];
carla_zeroChars(strBuf, STR_MAX+1);

retInfo.scalePointCount = plugin->getParameterScalePointCount(parameterId);

carla_zeroChars(strBuf, STR_MAX+1);
plugin->getParameterName(parameterId, strBuf);
retInfo.name = carla_strdup_safe(strBuf);
if (plugin->getParameterName(parameterId, strBuf))
{
retInfo.name = carla_strdup_safe(strBuf);
carla_zeroChars(strBuf, STR_MAX+1);
}

carla_zeroChars(strBuf, STR_MAX+1);
plugin->getParameterSymbol(parameterId, strBuf);
retInfo.symbol = carla_strdup_safe(strBuf);
if (plugin->getParameterSymbol(parameterId, strBuf))
{
retInfo.symbol = carla_strdup_safe(strBuf);
carla_zeroChars(strBuf, STR_MAX+1);
}

carla_zeroChars(strBuf, STR_MAX+1);
plugin->getParameterUnit(parameterId, strBuf);
retInfo.unit = carla_strdup_safe(strBuf);
if (plugin->getParameterUnit(parameterId, strBuf))
{
retInfo.unit = carla_strdup_safe(strBuf);
carla_zeroChars(strBuf, STR_MAX+1);
}

if (plugin->getParameterComment(parameterId, strBuf))
{
retInfo.comment = carla_strdup_safe(strBuf);
carla_zeroChars(strBuf, STR_MAX+1);
}

if (plugin->getParameterGroupName(parameterId, strBuf))
{
retInfo.groupName = carla_strdup_safe(strBuf);
carla_zeroChars(strBuf, STR_MAX+1);
}

checkStringPtr(retInfo.name);
checkStringPtr(retInfo.symbol);
checkStringPtr(retInfo.unit);
checkStringPtr(retInfo.comment);
checkStringPtr(retInfo.groupName);

return &retInfo;
}
@@ -1358,8 +1391,8 @@ const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, ui
retInfo.value = plugin->getParameterScalePointValue(parameterId, scalePointId);

carla_zeroChars(strBuf, STR_MAX+1);
plugin->getParameterScalePointLabel(parameterId, scalePointId, strBuf);
retInfo.label = carla_strdup_safe(strBuf);
if (plugin->getParameterScalePointLabel(parameterId, scalePointId, strBuf))
retInfo.label = carla_strdup_safe(strBuf);

checkStringPtr(retInfo.label);



+ 46
- 21
source/backend/plugin/CarlaPlugin.cpp View File

@@ -300,58 +300,81 @@ float CarlaPlugin::getParameterScalePointValue(const uint32_t parameterId, const
return 0.0f;
}

void CarlaPlugin::getLabel(char* const strBuf) const noexcept
bool CarlaPlugin::getLabel(char* const strBuf) const noexcept
{
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getMaker(char* const strBuf) const noexcept
bool CarlaPlugin::getMaker(char* const strBuf) const noexcept
{
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getCopyright(char* const strBuf) const noexcept
bool CarlaPlugin::getCopyright(char* const strBuf) const noexcept
{
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getRealName(char* const strBuf) const noexcept
bool CarlaPlugin::getRealName(char* const strBuf) const noexcept
{
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept
bool CarlaPlugin::getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
CARLA_SAFE_ASSERT(false); // this should never happen
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept
bool CarlaPlugin::getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getParameterText(const uint32_t parameterId, char* const strBuf) noexcept
bool CarlaPlugin::getParameterText(const uint32_t parameterId, char* const strBuf) noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
CARLA_SAFE_ASSERT(false); // this should never happen
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept
bool CarlaPlugin::getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
strBuf[0] = '\0';
return false;
}

void CarlaPlugin::getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept
bool CarlaPlugin::getParameterComment(const uint32_t parameterId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(),);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),);
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
strBuf[0] = '\0';
return false;
}

bool CarlaPlugin::getParameterGroupName(const uint32_t parameterId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
strBuf[0] = '\0';
return false;
}

bool CarlaPlugin::getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(parameterId < getParameterCount(), false);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), false);
CARLA_SAFE_ASSERT(false); // this should never happen
strBuf[0] = '\0';
return false;
}

float CarlaPlugin::getInternalParameterValue(const int32_t parameterId) const noexcept
@@ -382,18 +405,20 @@ float CarlaPlugin::getInternalParameterValue(const int32_t parameterId) const no
return getParameterValue(static_cast<uint32_t>(parameterId));
}

void CarlaPlugin::getProgramName(const uint32_t index, char* const strBuf) const noexcept
bool CarlaPlugin::getProgramName(const uint32_t index, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count,);
CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr,);
CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count, false);
CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr, false);
std::strncpy(strBuf, pData->prog.names[index], STR_MAX);
return false;
}

void CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept
bool CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept
{
CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,);
CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr,);
CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count, false);
CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr, false);
std::strncpy(strBuf, pData->midiprog.data[index].name, STR_MAX);
return false;
}

void CarlaPlugin::getParameterCountInfo(uint32_t& ins, uint32_t& outs) const noexcept


+ 25
- 15
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -530,37 +530,42 @@ public:
return fParams[parameterId].value;
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fInfo.label, STR_MAX);
return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fInfo.maker, STR_MAX);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fInfo.copyright, STR_MAX);
return true;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fInfo.name, STR_MAX);
return true;
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

std::strncpy(strBuf, fParams[parameterId].name.buffer(), STR_MAX);
return true;
}

void getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
bool getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(! fReceivingParamText.isCurrentlyWaitingData(), nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);
CARLA_SAFE_ASSERT_RETURN(! fReceivingParamText.isCurrentlyWaitingData(), false);

const int32_t parameterIdi = static_cast<int32_t>(parameterId);
fReceivingParamText.setTargetData(parameterIdi, strBuf);
@@ -573,22 +578,27 @@ public:
fShmNonRtClientControl.commitWrite();
}

if (! waitForParameterText())
std::snprintf(strBuf, STR_MAX, "%f", static_cast<double>(fParams[parameterId].value));
if (waitForParameterText())
return true;

std::snprintf(strBuf, STR_MAX, "%f", static_cast<double>(fParams[parameterId].value));
return false;
}

void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

std::strncpy(strBuf, fParams[parameterId].symbol.buffer(), STR_MAX);
return true;
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

std::strncpy(strBuf, fParams[parameterId].unit.buffer(), STR_MAX);
return true;
}

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


+ 31
- 30
source/backend/plugin/CarlaPluginDSSI.cpp View File

@@ -468,68 +468,69 @@ public:
return fParamBuffers[parameterId];
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Label != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Label != nullptr, false);

std::strncpy(strBuf, fDescriptor->Label, STR_MAX);
return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Maker != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Maker != nullptr, false);

std::strncpy(strBuf, fDescriptor->Maker, STR_MAX);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Copyright != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Copyright != nullptr, false);

std::strncpy(strBuf, fDescriptor->Copyright, STR_MAX);
return true;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Name != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Name != nullptr, false);

std::strncpy(strBuf, fDescriptor->Name, STR_MAX);
return true;
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

const int32_t rindex(pData->param.data[parameterId].rindex);
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, false);
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, false);

if (getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, true))
return;
if (! getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, true))
std::strncpy(strBuf, fDescriptor->PortNames[rindex], STR_MAX);

std::strncpy(strBuf, fDescriptor->PortNames[rindex], STR_MAX);
return true;
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

const int32_t rindex(pData->param.data[parameterId].rindex);
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, false);

CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, nullStrBuf(strBuf));

if (getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, false))
return;
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, false);

nullStrBuf(strBuf);
return getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, false);
}

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


+ 41
- 39
source/backend/plugin/CarlaPluginFluidSynth.cpp View File

@@ -227,106 +227,108 @@ public:
}
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
if (fLabel != nullptr)
{
std::strncpy(strBuf, fLabel, STR_MAX);
return;
return true;
}

CarlaPlugin::getLabel(strBuf);
return CarlaPlugin::getLabel(strBuf);
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, "FluidSynth SF2 engine", STR_MAX);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, "GNU GPL v2+", STR_MAX);
return true;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
getLabel(strBuf);
return getLabel(strBuf);
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

switch (parameterId)
{
case FluidSynthReverbOnOff:
std::strncpy(strBuf, "Reverb On/Off", STR_MAX);
return;
return true;
case FluidSynthReverbRoomSize:
std::strncpy(strBuf, "Reverb Room Size", STR_MAX);
return;
return true;
case FluidSynthReverbDamp:
std::strncpy(strBuf, "Reverb Damp", STR_MAX);
return;
return true;
case FluidSynthReverbLevel:
std::strncpy(strBuf, "Reverb Level", STR_MAX);
return;
return true;
case FluidSynthReverbWidth:
std::strncpy(strBuf, "Reverb Width", STR_MAX);
return;
return true;
case FluidSynthChorusOnOff:
std::strncpy(strBuf, "Chorus On/Off", STR_MAX);
return;
return true;
case FluidSynthChorusNr:
std::strncpy(strBuf, "Chorus Voice Count", STR_MAX);
return;
return true;
case FluidSynthChorusLevel:
std::strncpy(strBuf, "Chorus Level", STR_MAX);
return;
return true;
case FluidSynthChorusSpeedHz:
std::strncpy(strBuf, "Chorus Speed", STR_MAX);
return;
return true;
case FluidSynthChorusDepthMs:
std::strncpy(strBuf, "Chorus Depth", STR_MAX);
return;
return true;
case FluidSynthChorusType:
std::strncpy(strBuf, "Chorus Type", STR_MAX);
return;
return true;
case FluidSynthPolyphony:
std::strncpy(strBuf, "Polyphony", STR_MAX);
return;
return true;
case FluidSynthInterpolation:
std::strncpy(strBuf, "Interpolation", STR_MAX);
return;
return true;
case FluidSynthVoiceCount:
std::strncpy(strBuf, "Voice Count", STR_MAX);
return;
return true;
}

CarlaPlugin::getParameterName(parameterId, strBuf);
return CarlaPlugin::getParameterName(parameterId, strBuf);
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

switch (parameterId)
{
case FluidSynthChorusSpeedHz:
std::strncpy(strBuf, "Hz", STR_MAX);
return;
return true;
case FluidSynthChorusDepthMs:
std::strncpy(strBuf, "ms", STR_MAX);
return;
return true;
}

CarlaPlugin::getParameterUnit(parameterId, strBuf);
return CarlaPlugin::getParameterUnit(parameterId, strBuf);
}

void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
bool getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);
CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId), false);

switch (parameterId)
{
@@ -335,10 +337,10 @@ public:
{
case 0:
std::strncpy(strBuf, "Sine wave", STR_MAX);
return;
return true;
case 1:
std::strncpy(strBuf, "Triangle wave", STR_MAX);
return;
return true;
}
break;
case FluidSynthInterpolation:
@@ -346,21 +348,21 @@ public:
{
case 0:
std::strncpy(strBuf, "None", STR_MAX);
return;
return true;
case 1:
std::strncpy(strBuf, "Straight-line", STR_MAX);
return;
return true;
case 2:
std::strncpy(strBuf, "Fourth-order", STR_MAX);
return;
return true;
case 3:
std::strncpy(strBuf, "Seventh-order", STR_MAX);
return;
return true;
}
break;
}

CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
return CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
}

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


+ 8
- 6
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -572,25 +572,27 @@ public:
return fInfo.optionsAvailable;
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fInfo.setupLabel, STR_MAX);
return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const) const noexcept override
{
nullStrBuf(strBuf);
return false;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const) const noexcept override
{
nullStrBuf(strBuf);
return false;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
// FIXME
std::strncpy(strBuf, "Carla's libjack", STR_MAX);
return true;
}

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


+ 21
- 14
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -201,51 +201,58 @@ public:
return fInstance->getParameter(static_cast<int>(parameterId));
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
if (fDesc.pluginFormatName == "AU" || fDesc.pluginFormatName == "AudioUnit")
std::strncpy(strBuf, fDesc.fileOrIdentifier.toRawUTF8(), STR_MAX);
else
std::strncpy(strBuf, fDesc.name.toRawUTF8(), STR_MAX);

return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fDesc.manufacturerName.toRawUTF8(), STR_MAX);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
getMaker(strBuf);
return getMaker(strBuf);
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, fDesc.descriptiveName.toRawUTF8(), STR_MAX);
return true;
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr, false);

std::strncpy(strBuf, fInstance->getParameterName(static_cast<int>(parameterId), STR_MAX).toRawUTF8(), STR_MAX);
return true;
}

void getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
bool getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr, false);

std::strncpy(strBuf, fInstance->getParameterText(static_cast<int>(parameterId), STR_MAX).toRawUTF8(), STR_MAX);
return true;
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr, false);

std::strncpy(strBuf, fInstance->getParameterLabel(static_cast<int>(parameterId)).toRawUTF8(), STR_MAX);
return true;
}

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


+ 58
- 59
source/backend/plugin/CarlaPluginLADSPA.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin, LADSPA implementation
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -230,72 +230,72 @@ public:
return pData->param.ranges[parameterId].getFixedValue(scalePoint.Value);
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Label != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Label != nullptr, false);

std::strncpy(strBuf, fDescriptor->Label, STR_MAX);
return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Maker != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Maker != nullptr, false);

if (fRdfDescriptor != nullptr && fRdfDescriptor->Creator != nullptr)
{
std::strncpy(strBuf, fRdfDescriptor->Creator, STR_MAX);
return;
}
else
std::strncpy(strBuf, fDescriptor->Maker, STR_MAX);

std::strncpy(strBuf, fDescriptor->Maker, STR_MAX);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Copyright != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Copyright != nullptr, false);

std::strncpy(strBuf, fDescriptor->Copyright, STR_MAX);
return true;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Name != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->Name != nullptr, false);

if (fRdfDescriptor != nullptr && fRdfDescriptor->Title != nullptr)
{
std::strncpy(strBuf, fRdfDescriptor->Title, STR_MAX);
return;
}
else
std::strncpy(strBuf, fDescriptor->Name, STR_MAX);

std::strncpy(strBuf, fDescriptor->Name, STR_MAX);
return true;
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

const int32_t rindex(pData->param.data[parameterId].rindex);
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, false);
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, false);

if (getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, true))
return;
if (! getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, true))
std::strncpy(strBuf, fDescriptor->PortNames[rindex], STR_MAX);

std::strncpy(strBuf, fDescriptor->PortNames[rindex], STR_MAX);
return true;
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

const int32_t rindex(pData->param.data[parameterId].rindex);
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, false);

if (fRdfDescriptor != nullptr && rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
@@ -307,74 +307,73 @@ public:
{
case LADSPA_UNIT_DB:
std::strncpy(strBuf, "dB", STR_MAX);
return;
return true;
case LADSPA_UNIT_COEF:
std::strncpy(strBuf, "(coef)", STR_MAX);
return;
return true;
case LADSPA_UNIT_HZ:
std::strncpy(strBuf, "Hz", STR_MAX);
return;
return true;
case LADSPA_UNIT_S:
std::strncpy(strBuf, "s", STR_MAX);
return;
return true;
case LADSPA_UNIT_MS:
std::strncpy(strBuf, "ms", STR_MAX);
return;
return true;
case LADSPA_UNIT_MIN:
std::strncpy(strBuf, "min", STR_MAX);
return;
return true;
}
}
}

CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, nullStrBuf(strBuf));

if (getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, false))
return;
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fDescriptor->PortCount), false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->PortNames[rindex] != nullptr, false);

nullStrBuf(strBuf);
return getSeparatedParameterNameOrUnit(fDescriptor->PortNames[rindex], strBuf, false);
}

void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

if (fRdfDescriptor == nullptr)
return nullStrBuf(strBuf);
return false;

const int32_t rindex(pData->param.data[parameterId].rindex);
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, false);

if (rindex >= static_cast<int32_t>(fRdfDescriptor->PortCount))
return nullStrBuf(strBuf);
return false;

const LADSPA_RDF_Port& port(fRdfDescriptor->Ports[rindex]);

if (! LADSPA_PORT_HAS_LABEL(port.Hints))
return nullStrBuf(strBuf);
return false;

CARLA_SAFE_ASSERT_RETURN(port.Label != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(port.Label != nullptr, false);

std::strncpy(strBuf, port.Label, STR_MAX);
return true;
}

void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
bool getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

const int32_t rindex(pData->param.data[parameterId].rindex);
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fRdfDescriptor->PortCount), nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(rindex >= 0, false);
CARLA_SAFE_ASSERT_RETURN(rindex < static_cast<int32_t>(fRdfDescriptor->PortCount), false);

const LADSPA_RDF_Port& port(fRdfDescriptor->Ports[rindex]);
CARLA_SAFE_ASSERT_RETURN(scalePointId < port.ScalePointCount, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(scalePointId < port.ScalePointCount, false);

const LADSPA_RDF_ScalePoint& scalePoint(port.ScalePoints[scalePointId]);
CARLA_SAFE_ASSERT_RETURN(scalePoint.Label != nullptr, nullStrBuf(strBuf));
CARLA_SAFE_ASSERT_RETURN(scalePoint.Label != nullptr, false);

std::strncpy(strBuf, scalePoint.Label, STR_MAX);
return true;
}

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


+ 143
- 62
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -934,55 +934,65 @@ public:
return 0.0f;
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor->URI != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor->URI != nullptr, false);

std::strncpy(strBuf, fRdfDescriptor->URI, STR_MAX);
return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);

if (fRdfDescriptor->Author != nullptr)
{
std::strncpy(strBuf, fRdfDescriptor->Author, STR_MAX);
else
CarlaPlugin::getMaker(strBuf);
return true;
}

return false;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);

if (fRdfDescriptor->License != nullptr)
{
std::strncpy(strBuf, fRdfDescriptor->License, STR_MAX);
else
CarlaPlugin::getCopyright(strBuf);
return true;
}

return false;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);

if (fRdfDescriptor->Name != nullptr)
{
std::strncpy(strBuf, fRdfDescriptor->Name, STR_MAX);
else
CarlaPlugin::getRealName(strBuf);
return true;
}

return false;
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

int32_t rindex = pData->param.data[parameterId].rindex;

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
std::strncpy(strBuf, fRdfDescriptor->Ports[rindex].Name, STR_MAX);
return;
return true;
}

rindex -= static_cast<int32_t>(fRdfDescriptor->PortCount);
@@ -990,23 +1000,23 @@ public:
if (rindex < static_cast<int32_t>(fRdfDescriptor->ParameterCount))
{
std::strncpy(strBuf, fRdfDescriptor->Parameters[rindex].Label, STR_MAX);
return;
return true;
}

CarlaPlugin::getParameterName(parameterId, strBuf);
return CarlaPlugin::getParameterName(parameterId, strBuf);
}

void getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterSymbol(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

int32_t rindex = pData->param.data[parameterId].rindex;

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
std::strncpy(strBuf, fRdfDescriptor->Ports[rindex].Symbol, STR_MAX);
return;
return true;
}

rindex -= static_cast<int32_t>(fRdfDescriptor->PortCount);
@@ -1014,16 +1024,16 @@ public:
if (rindex < static_cast<int32_t>(fRdfDescriptor->ParameterCount))
{
std::strncpy(strBuf, fRdfDescriptor->Parameters[rindex].URI, STR_MAX);
return;
return true;
}

CarlaPlugin::getParameterSymbol(parameterId, strBuf);
return CarlaPlugin::getParameterSymbol(parameterId, strBuf);
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

LV2_RDF_PortUnit* portUnit = nullptr;

@@ -1048,7 +1058,7 @@ public:
if (LV2_HAVE_PORT_UNIT_SYMBOL(portUnit->Hints) && portUnit->Symbol != nullptr)
{
std::strncpy(strBuf, portUnit->Symbol, STR_MAX);
return;
return true;
}

if (LV2_HAVE_PORT_UNIT_UNIT(portUnit->Hints))
@@ -1057,105 +1067,176 @@ public:
{
case LV2_PORT_UNIT_BAR:
std::strncpy(strBuf, "bars", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_BEAT:
std::strncpy(strBuf, "beats", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_BPM:
std::strncpy(strBuf, "BPM", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_CENT:
std::strncpy(strBuf, "ct", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_CM:
std::strncpy(strBuf, "cm", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_COEF:
std::strncpy(strBuf, "(coef)", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_DB:
std::strncpy(strBuf, "dB", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_DEGREE:
std::strncpy(strBuf, "deg", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_FRAME:
std::strncpy(strBuf, "frames", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_HZ:
std::strncpy(strBuf, "Hz", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_INCH:
std::strncpy(strBuf, "in", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_KHZ:
std::strncpy(strBuf, "kHz", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_KM:
std::strncpy(strBuf, "km", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_M:
std::strncpy(strBuf, "m", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_MHZ:
std::strncpy(strBuf, "MHz", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_MIDINOTE:
std::strncpy(strBuf, "note", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_MILE:
std::strncpy(strBuf, "mi", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_MIN:
std::strncpy(strBuf, "min", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_MM:
std::strncpy(strBuf, "mm", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_MS:
std::strncpy(strBuf, "ms", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_OCT:
std::strncpy(strBuf, "oct", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_PC:
std::strncpy(strBuf, "%", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_S:
std::strncpy(strBuf, "s", STR_MAX);
return;
return true;
case LV2_PORT_UNIT_SEMITONE:
std::strncpy(strBuf, "semi", STR_MAX);
return;
return true;
}
}
}

CarlaPlugin::getParameterUnit(parameterId, strBuf);
return CarlaPlugin::getParameterUnit(parameterId, strBuf);
}

void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
bool getParameterComment(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

int32_t rindex = pData->param.data[parameterId].rindex;

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
if (const char* const comment = fRdfDescriptor->Ports[rindex].Comment)
{
std::strncpy(strBuf, comment, STR_MAX);
return true;
}
return false;
}

rindex -= static_cast<int32_t>(fRdfDescriptor->PortCount);

if (rindex < static_cast<int32_t>(fRdfDescriptor->ParameterCount))
{
if (const char* const comment = fRdfDescriptor->Parameters[rindex].Comment)
{
std::strncpy(strBuf, comment, STR_MAX);
return true;
}
return false;
}

return CarlaPlugin::getParameterComment(parameterId, strBuf);
}

bool getParameterGroupName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

int32_t rindex = pData->param.data[parameterId].rindex;
const char* uri = nullptr;

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
uri = fRdfDescriptor->Ports[rindex].GroupURI;
}
else
{
rindex -= static_cast<int32_t>(fRdfDescriptor->PortCount);

if (rindex < static_cast<int32_t>(fRdfDescriptor->ParameterCount))
uri = fRdfDescriptor->Parameters[rindex].GroupURI;
}

if (uri == nullptr)
return false;

for (uint32_t i=0; i<fRdfDescriptor->PortGroupCount; ++i)
{
if (std::strcmp(fRdfDescriptor->PortGroups[i].URI, uri) == 0)
{
if (const char* const label = fRdfDescriptor->PortGroups[i].Label)
{
std::strncpy(strBuf, label, STR_MAX);
return true;
}
return false;
}
}

return false;
}

bool getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

const int32_t rindex(pData->param.data[parameterId].rindex);

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]);
CARLA_SAFE_ASSERT_RETURN(scalePointId < port->ScalePointCount,);
CARLA_SAFE_ASSERT_RETURN(scalePointId < port->ScalePointCount, false);

const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]);

if (portScalePoint->Label != nullptr)
{
std::strncpy(strBuf, portScalePoint->Label, STR_MAX);
return;
return true;
}
}

CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
return CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
}

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


+ 38
- 38
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -478,64 +478,64 @@ public:
return 0.0f;
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);

if (fDescriptor->label != nullptr)
{
std::strncpy(strBuf, fDescriptor->label, STR_MAX);
return;
return true;
}

CarlaPlugin::getLabel(strBuf);
return CarlaPlugin::getLabel(strBuf);
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);

if (fDescriptor->maker != nullptr)
{
std::strncpy(strBuf, fDescriptor->maker, STR_MAX);
return;
return true;
}

CarlaPlugin::getMaker(strBuf);
return CarlaPlugin::getMaker(strBuf);
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);

if (fDescriptor->copyright != nullptr)
{
std::strncpy(strBuf, fDescriptor->copyright, STR_MAX);
return;
return true;
}

CarlaPlugin::getCopyright(strBuf);
return CarlaPlugin::getCopyright(strBuf);
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);

if (fDescriptor->name != nullptr)
{
std::strncpy(strBuf, fDescriptor->name, STR_MAX);
return;
return true;
}

CarlaPlugin::getRealName(strBuf);
return CarlaPlugin::getRealName(strBuf);
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
@@ -543,7 +543,7 @@ public:
if (param->name != nullptr)
{
std::strncpy(strBuf, param->name, STR_MAX);
return;
return true;
}

carla_safe_assert("param->name != nullptr", __FILE__, __LINE__);
@@ -551,15 +551,15 @@ public:
}

carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
CarlaPlugin::getParameterName(parameterId, strBuf);
return CarlaPlugin::getParameterName(parameterId, strBuf);
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
@@ -567,34 +567,34 @@ public:
if (param->unit != nullptr)
{
std::strncpy(strBuf, param->unit, STR_MAX);
return;
return true;
}

return CarlaPlugin::getParameterUnit(parameterId, strBuf);
}

carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
CarlaPlugin::getParameterUnit(parameterId, strBuf);
return CarlaPlugin::getParameterUnit(parameterId, strBuf);
}

void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
bool getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

// FIXME - try
if (const NativeParameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId))
{
CARLA_SAFE_ASSERT_RETURN(scalePointId < param->scalePointCount,);
CARLA_SAFE_ASSERT_RETURN(scalePointId < param->scalePointCount, false);

const NativeParameterScalePoint* scalePoint(&param->scalePoints[scalePointId]);

if (scalePoint->label != nullptr)
{
std::strncpy(strBuf, scalePoint->label, STR_MAX);
return;
return true;
}

carla_safe_assert("scalePoint->label != nullptr", __FILE__, __LINE__);
@@ -602,7 +602,7 @@ public:
}

carla_safe_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__);
CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
return CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
}

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


+ 13
- 10
source/backend/plugin/CarlaPluginSFZero.cpp View File

@@ -136,43 +136,46 @@ public:
return fNumVoices;
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
if (fLabel != nullptr)
{
std::strncpy(strBuf, fLabel, STR_MAX);
return;
return true;
}

CarlaPlugin::getLabel(strBuf);
return CarlaPlugin::getLabel(strBuf);
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, "SFZero engine", STR_MAX);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
std::strncpy(strBuf, "ISC", STR_MAX);
return true;
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
if (fRealName != nullptr)
{
std::strncpy(strBuf, fRealName, STR_MAX);
return;
return true;
}

CarlaPlugin::getRealName(strBuf);
return CarlaPlugin::getRealName(strBuf);
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId == 0,);
CARLA_SAFE_ASSERT_RETURN(parameterId == 0, false);

std::strncpy(strBuf, "Voice Count", STR_MAX);
return true;
}

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


+ 25
- 18
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -276,39 +276,42 @@ public:
return fEffect->getParameter(fEffect, static_cast<int32_t>(parameterId));
}

void getLabel(char* const strBuf) const noexcept override
bool getLabel(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false);

strBuf[0] = '\0';
dispatcher(effGetProductString, 0, 0, strBuf);
return true;
}

void getMaker(char* const strBuf) const noexcept override
bool getMaker(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false);

strBuf[0] = '\0';
dispatcher(effGetVendorString, 0, 0, strBuf);
return true;
}

void getCopyright(char* const strBuf) const noexcept override
bool getCopyright(char* const strBuf) const noexcept override
{
getMaker(strBuf);
return getMaker(strBuf);
}

void getRealName(char* const strBuf) const noexcept override
bool getRealName(char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false);

strBuf[0] = '\0';
dispatcher(effGetEffectName, 0, 0, strBuf);
return true;
}

void getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterName(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

strBuf[0] = '\0';

@@ -319,32 +322,36 @@ public:
{
std::strncpy(strBuf, prop.label, 64);
strBuf[64] = '\0';
return;
return true;
}

strBuf[0] = '\0';
dispatcher(effGetParamName, static_cast<int32_t>(parameterId), 0, strBuf);
return true;
}

void getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
bool getParameterText(const uint32_t parameterId, char* const strBuf) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

strBuf[0] = '\0';
dispatcher(effGetParamDisplay, static_cast<int32_t>(parameterId), 0, strBuf);

if (strBuf[0] == '\0')
std::snprintf(strBuf, STR_MAX, "%f", static_cast<double>(getParameterValue(parameterId)));

return true;
}

void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
bool getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false);

strBuf[0] = '\0';
dispatcher(effGetParamLabel, static_cast<int32_t>(parameterId), 0, strBuf);
return true;
}

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


+ 8
- 0
source/frontend/carla_backend.py View File

@@ -1246,6 +1246,12 @@ class CarlaParameterInfo(Structure):
# Parameter unit.
("unit", c_char_p),

# Parameter comment / documentation.
("comment", c_char_p),

# Parameter group name.
("groupName", c_char_p),

# Number of scale points.
# @see CarlaScalePointInfo
("scalePointCount", c_uint32)
@@ -1360,6 +1366,8 @@ PyCarlaParameterInfo = {
'name': "",
'symbol': "",
'unit': "",
'comment': "",
'groupName': "",
'scalePointCount': 0,
}



+ 22
- 45
source/frontend/carla_widgets.py View File

@@ -21,7 +21,7 @@

from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QSettings, QTimer
from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath, QPalette, QPixmap
from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu, QScrollArea, QVBoxLayout, QWidget

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom)
@@ -435,9 +435,6 @@ class PluginEditParentMeta():
# Plugin Editor (Built-in)

class PluginEdit(QDialog):
# settings
kParamsPerPage = 17

# signals
SIGTERM = pyqtSignal()
SIGUSR1 = pyqtSignal()
@@ -720,18 +717,6 @@ class PluginEdit(QDialog):
if not self.ui.scrollArea.isEnabled():
self.resize(self.width(), self.height()-self.ui.scrollArea.height())

# FIXME: See if this is still needed
# Workaround for a Qt4 bug, see https://bugreports.qt-project.org/browse/QTBUG-7792
if LINUX: QTimer.singleShot(0, self.slot_fixNameWordWrap)

@pyqtSlot()
def slot_fixNameWordWrap(self):
if self.ui.tabWidget.count() > 0:
self.ui.tabWidget.setCurrentIndex(1)
self.adjustSize()
self.ui.tabWidget.setCurrentIndex(0)
self.setMinimumSize(self.width(), self.height())

#------------------------------------------------------------------

def reloadInfo(self):
@@ -893,11 +878,6 @@ class PluginEdit(QDialog):

paramInputList.append(parameter)

if len(paramInputList) == self.kParamsPerPage:
paramInputListFull.append((paramInputList, paramInputWidth))
paramInputList = []
paramInputWidth = 0

else:
paramOutputWidthTMP = self.fontMetrics().width(parameter['name'])

@@ -906,19 +886,8 @@ class PluginEdit(QDialog):

paramOutputList.append(parameter)

if len(paramOutputList) == self.kParamsPerPage:
paramOutputListFull.append((paramOutputList, paramOutputWidth))
paramOutputList = []
paramOutputWidth = 0

# for i in range(parameterCount)
else:
# Final page width values
if 0 < len(paramInputList) < self.kParamsPerPage:
paramInputListFull.append((paramInputList, paramInputWidth))

if 0 < len(paramOutputList) < self.kParamsPerPage:
paramOutputListFull.append((paramOutputList, paramOutputWidth))
paramInputListFull.append((paramInputList, paramInputWidth))
paramOutputListFull.append((paramOutputList, paramOutputWidth))

# Create parameter tabs + widgets
self._createParameterWidgets(PARAMETER_INPUT, paramInputListFull, self.tr("Parameters"))
@@ -1490,21 +1459,27 @@ class PluginEdit(QDialog):
#------------------------------------------------------------------

def _createParameterWidgets(self, paramType, paramListFull, tabPageName):
i = 1
for paramList, width in paramListFull:
if len(paramList) == 0:
break

tabIndex = self.ui.tabWidget.count()
tabPageContainer = QWidget(self.ui.tabWidget)
tabPageLayout = QVBoxLayout(tabPageContainer)
tabPageLayout.setSpacing(1)
tabPageContainer.setLayout(tabPageLayout)
tabIndex = self.ui.tabWidget.count()

tabPageLayout = QVBoxLayout(self.ui.tabWidget)
tabPageLayout.setSpacing(0)

scrollArea = QScrollArea(self.ui.tabWidget)
scrollArea.setWidgetResizable(True)
scrollArea.setFrameStyle(0)

scrollAreaWidget = QWidget(scrollArea)
scrollAreaLayout = QVBoxLayout(scrollAreaWidget)
scrollAreaLayout.setSpacing(1)

for paramInfo in paramList:
paramWidget = PluginParameter(tabPageContainer, self.host, paramInfo, self.fPluginId, tabIndex)
paramWidget = PluginParameter(scrollAreaWidget, self.host, paramInfo, self.fPluginId, tabIndex)
paramWidget.setLabelWidth(width)
tabPageLayout.addWidget(paramWidget)
scrollAreaLayout.addWidget(paramWidget)

self.fParameterList.append((paramType, paramInfo['index'], paramWidget))

@@ -1514,10 +1489,12 @@ class PluginEdit(QDialog):
paramWidget.midiControlChanged.connect(self.slot_parameterMidiControlChanged)
paramWidget.midiChannelChanged.connect(self.slot_parameterMidiChannelChanged)

tabPageLayout.addStretch()
scrollAreaLayout.addStretch()

scrollArea.setWidget(scrollAreaWidget)
tabPageLayout.addWidget(scrollArea)

self.ui.tabWidget.addTab(tabPageContainer, "%s (%i)" % (tabPageName, i))
i += 1
self.ui.tabWidget.addTab(scrollArea, tabPageName)

if paramType == PARAMETER_INPUT:
self.ui.tabWidget.setTabIcon(tabIndex, self.fTabIconOff)


+ 52
- 0
source/includes/lv2_rdf.hpp View File

@@ -404,6 +404,7 @@ struct LV2_RDF_Port {
const char* Name;
const char* Symbol;
const char* Comment;
const char* GroupURI;

LV2_RDF_PortMidiMap MidiMap;
LV2_RDF_PortPoints Points;
@@ -421,6 +422,7 @@ struct LV2_RDF_Port {
Name(nullptr),
Symbol(nullptr),
Comment(nullptr),
GroupURI(nullptr),
MidiMap(),
Points(),
Unit(),
@@ -445,6 +447,11 @@ struct LV2_RDF_Port {
delete[] Comment;
Comment = nullptr;
}
if (GroupURI != nullptr)
{
delete[] GroupURI;
GroupURI = nullptr;
}
if (ScalePoints != nullptr)
{
delete[] ScalePoints;
@@ -455,6 +462,34 @@ struct LV2_RDF_Port {
CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Port)
};

// Port
struct LV2_RDF_PortGroup {
LV2_URI URI; // shared value, do not deallocate
const char* Label;
const char* Symbol;

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

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

CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_PortGroup)
};

// Parameter
struct LV2_RDF_Parameter {
LV2_URI URI;
@@ -462,6 +497,7 @@ struct LV2_RDF_Parameter {
bool Input;
const char* Label;
const char* Comment;
const char* GroupURI;

LV2_RDF_PortMidiMap MidiMap;
LV2_RDF_PortPoints Points;
@@ -473,6 +509,7 @@ struct LV2_RDF_Parameter {
Input(true),
Label(nullptr),
Comment(nullptr),
GroupURI(nullptr),
MidiMap(),
Points(),
Unit() {}
@@ -494,6 +531,11 @@ struct LV2_RDF_Parameter {
delete[] Comment;
Comment = nullptr;
}
if (GroupURI != nullptr)
{
delete[] GroupURI;
GroupURI = nullptr;
}
}

CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Parameter)
@@ -656,6 +698,9 @@ struct LV2_RDF_Descriptor {
uint32_t PortCount;
LV2_RDF_Port* Ports;

uint32_t PortGroupCount;
LV2_RDF_PortGroup* PortGroups;

uint32_t ParameterCount;
LV2_RDF_Parameter* Parameters;

@@ -681,6 +726,8 @@ struct LV2_RDF_Descriptor {
UniqueID(0),
PortCount(0),
Ports(nullptr),
PortGroupCount(0),
PortGroups(nullptr),
ParameterCount(0),
Parameters(nullptr),
PresetCount(0),
@@ -732,6 +779,11 @@ struct LV2_RDF_Descriptor {
delete[] Ports;
Ports = nullptr;
}
if (PortGroups != nullptr)
{
delete[] PortGroups;
PortGroups = nullptr;
}
if (Parameters != nullptr)
{
delete[] Parameters;


+ 1
- 0
source/modules/lilv/lilv-0.24.0/lilv/lilvmm.hpp View File

@@ -187,6 +187,7 @@ struct Port {
#define LILV_PORT_WRAP1(RT, name, T1, a1) \
inline RT name (T1 a1) { return lilv_port_ ## name (parent, me, a1); }

LILV_PORT_WRAP1(LilvNode*, get, LilvNode*, predicate);
LILV_PORT_WRAP1(LilvNodes*, get_value, LilvNode*, predicate);
LILV_PORT_WRAP0(LilvNodes*, get_properties)
LILV_PORT_WRAP1(bool, has_property, LilvNode*, property_uri);


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

@@ -19,6 +19,7 @@
#define CARLA_LV2_UTILS_HPP_INCLUDED

#include "CarlaMathUtils.hpp"
#include "CarlaStringList.hpp"

#ifndef nullptr
# undef NULL
@@ -248,6 +249,7 @@ public:

Lilv::Node patch_writable;
Lilv::Node parameter;
Lilv::Node pg_group;

Lilv::Node preset_preset;

@@ -383,6 +385,7 @@ public:

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)),

@@ -1643,6 +1646,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

// ----------------------------------------------------------------------------------------------------------------
// Set Plugin Type
{
@@ -1827,6 +1832,19 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)

if (const char* const symbol = lilv_node_as_string(lilvPort.get_symbol()))
rdfPort->Symbol = carla_strdup(symbol);

if (LilvNode* const commentNode = lilvPort.get(lv2World.rdfs_comment.me))
{
rdfPort->Comment = carla_strdup(lilv_node_as_string(commentNode));
lilv_node_free(commentNode);
}

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

// --------------------------------------------------------------------------------------------------------
@@ -2358,10 +2376,18 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
if (LilvNode* const commentNode = lilv_world_get(lv2World.me, patchWritableNode,
lv2World.rdfs_comment.me, nullptr))
{
rdfParam.Comment = carla_strdup(lilv_node_as_string(commentNode));
rdfParam.Comment = carla_strdup_safe(lilv_node_as_string(commentNode));
lilv_node_free(commentNode);
}

if (LilvNode* const groupNode = lilv_world_get(lv2World.me, patchWritableNode,
lv2World.pg_group.me, nullptr))
{
rdfParam.GroupURI = carla_strdup_safe(lilv_node_as_uri(groupNode));
lilv_node_free(groupNode);
portGroups.appendUnique(rdfParam.GroupURI);
}

// ----------------------------------------------------------------------------------------------------
// Set Port Points

@@ -2497,6 +2523,26 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool loadPresets)
lilv_nodes_free(const_cast<LilvNodes*>(patchWritableNodes.me));
}

// ----------------------------------------------------------------------------------------------------------------
// Set Plugin Port Groups

if (const size_t portGroupCount = portGroups.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)
{
LV2_RDF_PortGroup& portGroup(rdfDescriptor->PortGroups[i]);

portGroup.URI = portGroups.getAt(i);

// TODO
portGroup.Label = carla_strdup_safe("test 1");
}
}

// ----------------------------------------------------------------------------------------------------------------
// Set Plugin Presets



+ 32
- 10
source/utils/CarlaStringList.hpp View File

@@ -156,11 +156,13 @@ private:
class CarlaStringList : public LinkedList<const char*>
{
public:
CarlaStringList() noexcept
: LinkedList<const char*>() {}
CarlaStringList(bool allocateElements = true) noexcept
: LinkedList<const char*>(),
fAllocateElements(allocateElements) {}

CarlaStringList(const CarlaStringList& list) noexcept
: LinkedList<const char*>()
: LinkedList<const char*>(),
fAllocateElements(list.fAllocateElements)
{
for (Itenerator it = list.begin2(); it.valid(); it.next())
LinkedList<const char*>::append(carla_strdup_safe(it.getValue(nullptr)));
@@ -175,10 +177,13 @@ public:

void clear() noexcept
{
for (Itenerator it = begin2(); it.valid(); it.next())
if (fAllocateElements)
{
if (const char* const string = it.getValue(nullptr))
delete[] string;
for (Itenerator it = begin2(); it.valid(); it.next())
{
if (const char* const string = it.getValue(nullptr))
delete[] string;
}
}

LinkedList<const char*>::clear();
@@ -190,7 +195,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);

if (const char* const stringDup = carla_strdup_safe(string))
if (const char* const stringDup = fAllocateElements ? carla_strdup_safe(string) : string)
{
if (LinkedList<const char*>::append(stringDup))
return true;
@@ -200,11 +205,21 @@ public:
return false;
}

bool appendUnique(const char* const string) noexcept
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);

if (contains(string))
return false;

return append(string);
}

bool appendAt(const char* const string, const Itenerator& it) noexcept
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);

if (const char* const stringDup = carla_strdup_safe(string))
if (const char* const stringDup = fAllocateElements ? carla_strdup_safe(string) : string)
{
if (LinkedList<const char*>::appendAt(stringDup, it))
return true;
@@ -218,7 +233,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);

if (const char* const stringDup = carla_strdup_safe(string))
if (const char* const stringDup = fAllocateElements ? carla_strdup_safe(string) : string)
{
if (LinkedList<const char*>::insert(stringDup))
return true;
@@ -232,7 +247,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);

if (const char* const stringDup = carla_strdup_safe(string))
if (const char* const stringDup = fAllocateElements ? carla_strdup_safe(string) : string)
{
if (LinkedList<const char*>::insertAt(stringDup, it))
return true;
@@ -392,6 +407,8 @@ public:

CarlaStringList& operator=(const char* const* const charStringList) noexcept
{
CARLA_SAFE_ASSERT_RETURN(! fAllocateElements, *this);

clear();

CARLA_SAFE_ASSERT_RETURN(charStringList != nullptr, *this);
@@ -407,6 +424,8 @@ public:

CarlaStringList& operator=(const CarlaStringList& list) noexcept
{
CARLA_SAFE_ASSERT_RETURN(! fAllocateElements, *this);

clear();

for (Itenerator it = list.begin2(); it.valid(); it.next())
@@ -418,6 +437,9 @@ public:
return *this;
}

private:
const bool fAllocateElements;

CARLA_PREVENT_VIRTUAL_HEAP_ALLOCATION
};



Loading…
Cancel
Save