Browse Source

Add API to internal plugins so we can name audio and cv ports

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 5 years ago
parent
commit
e2ec0164ad
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 64 additions and 14 deletions
  1. +16
    -8
      source/backend/engine/CarlaEngineNative.cpp
  2. +20
    -4
      source/backend/plugin/CarlaPluginNative.cpp
  3. +1
    -0
      source/includes/CarlaNative.h
  4. +1
    -1
      source/includes/CarlaNative.hpp
  5. +3
    -1
      source/native-plugins/_data.cpp
  6. +23
    -0
      source/native-plugins/midi-to-cv.c

+ 16
- 8
source/backend/engine/CarlaEngineNative.cpp View File

@@ -2312,7 +2312,8 @@ static const NativePluginDescriptor carlaRackDesc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaRackNoMidiOutDesc = { static const NativePluginDescriptor carlaRackNoMidiOutDesc = {
@@ -2356,7 +2357,8 @@ static const NativePluginDescriptor carlaRackNoMidiOutDesc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaPatchbayDesc = { static const NativePluginDescriptor carlaPatchbayDesc = {
@@ -2400,7 +2402,8 @@ static const NativePluginDescriptor carlaPatchbayDesc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaPatchbay3sDesc = { static const NativePluginDescriptor carlaPatchbay3sDesc = {
@@ -2444,7 +2447,8 @@ static const NativePluginDescriptor carlaPatchbay3sDesc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaPatchbay16Desc = { static const NativePluginDescriptor carlaPatchbay16Desc = {
@@ -2488,7 +2492,8 @@ static const NativePluginDescriptor carlaPatchbay16Desc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaPatchbay32Desc = { static const NativePluginDescriptor carlaPatchbay32Desc = {
@@ -2532,7 +2537,8 @@ static const NativePluginDescriptor carlaPatchbay32Desc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaPatchbay64Desc = { static const NativePluginDescriptor carlaPatchbay64Desc = {
@@ -2576,7 +2582,8 @@ static const NativePluginDescriptor carlaPatchbay64Desc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 0
/* cvOuts */ 0,
/* _get_buffer_port_name */ nullptr
}; };


static const NativePluginDescriptor carlaPatchbayCVDesc = { static const NativePluginDescriptor carlaPatchbayCVDesc = {
@@ -2621,7 +2628,8 @@ static const NativePluginDescriptor carlaPatchbayCVDesc = {
CarlaEngineNative::_dispatcher, CarlaEngineNative::_dispatcher,
/* _render_inline_dsplay */ nullptr, /* _render_inline_dsplay */ nullptr,
/* cvIns */ 5, /* cvIns */ 5,
/* cvOuts */ 5
/* cvOuts */ 5,
/* _get_buffer_port_name */ nullptr
}; };


CARLA_BACKEND_END_NAMESPACE CARLA_BACKEND_END_NAMESPACE


+ 20
- 4
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -1086,7 +1086,11 @@ public:
portName += ":"; portName += ":";
} }


if (aIns > 1 && ! forcedStereoIn)
if (fDescriptor->get_buffer_port_name != nullptr)
{
portName += fDescriptor->get_buffer_port_name(fHandle, forcedStereoIn ? 0 : j, false);
}
else if (aIns > 1 && ! forcedStereoIn)
{ {
portName += "input_"; portName += "input_";
portName += CarlaString(j+1); portName += CarlaString(j+1);
@@ -1119,7 +1123,11 @@ public:
portName += ":"; portName += ":";
} }


if (aOuts > 1 && ! forcedStereoOut)
if (fDescriptor->get_buffer_port_name != nullptr)
{
portName += fDescriptor->get_buffer_port_name(fHandle, forcedStereoOut ? 0 : j, true);
}
else if (aOuts > 1 && ! forcedStereoOut)
{ {
portName += "output_"; portName += "output_";
portName += CarlaString(j+1); portName += CarlaString(j+1);
@@ -1152,7 +1160,11 @@ public:
portName += ":"; portName += ":";
} }


if (cvIns > 1)
if (fDescriptor->get_buffer_port_name != nullptr)
{
portName += fDescriptor->get_buffer_port_name(fHandle, fDescriptor->audioIns + j, false);
}
else if (cvIns > 1)
{ {
portName += "cv_input_"; portName += "cv_input_";
portName += CarlaString(j+1); portName += CarlaString(j+1);
@@ -1177,7 +1189,11 @@ public:
portName += ":"; portName += ":";
} }


if (cvOuts > 1)
if (fDescriptor->get_buffer_port_name != nullptr)
{
portName += fDescriptor->get_buffer_port_name(fHandle, fDescriptor->audioOuts + j, true);
}
else if (cvOuts > 1)
{ {
portName += "cv_output_"; portName += "cv_output_";
portName += CarlaString(j+1); portName += CarlaString(j+1);


+ 1
- 0
source/includes/CarlaNative.h View File

@@ -277,6 +277,7 @@ typedef struct _NativePluginDescriptor {
// placed at the end for backwards compatibility. only valid if NATIVE_PLUGIN_USES_CONTROL_VOLTAGE is set // placed at the end for backwards compatibility. only valid if NATIVE_PLUGIN_USES_CONTROL_VOLTAGE is set
const uint32_t cvIns; const uint32_t cvIns;
const uint32_t cvOuts; const uint32_t cvOuts;
const char* (*get_buffer_port_name)(NativePluginHandle handle, uint32_t index, bool isOutput);


} NativePluginDescriptor; } NativePluginDescriptor;




+ 1
- 1
source/includes/CarlaNative.hpp View File

@@ -618,7 +618,7 @@ public: \
ClassName::_set_state, \ ClassName::_set_state, \
ClassName::_dispatcher, \ ClassName::_dispatcher, \
ClassName::_render_inline_display, \ ClassName::_render_inline_display, \
0, 0
0, 0, nullptr


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




+ 3
- 1
source/native-plugins/_data.cpp View File

@@ -28,7 +28,7 @@
nullptr, nullptr, nullptr, nullptr, nullptr, \ nullptr, nullptr, nullptr, nullptr, nullptr, \
nullptr, nullptr nullptr, nullptr
#define DESCFUNCS_WITHOUTCV \ #define DESCFUNCS_WITHOUTCV \
DESCFUNCS_WITHCV, 0, 0
DESCFUNCS_WITHCV, 0, 0, nullptr


static const NativePluginDescriptor sNativePluginDescriptors[] = { static const NativePluginDescriptor sNativePluginDescriptors[] = {


@@ -196,6 +196,7 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = {
DESCFUNCS_WITHCV, DESCFUNCS_WITHCV,
/* cvIns */ 0, /* cvIns */ 0,
/* cvOuts */ 3, /* cvOuts */ 3,
/* bufnamefn */ nullptr
}, },
{ {
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
@@ -483,6 +484,7 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = {
DESCFUNCS_WITHCV, DESCFUNCS_WITHCV,
/* cvIns */ 5, /* cvIns */ 5,
/* cvOuts */ 5, /* cvOuts */ 5,
/* bufnamefn */ nullptr
}, },
#endif #endif




+ 23
- 0
source/native-plugins/midi-to-cv.c View File

@@ -179,6 +179,27 @@ static void midi2cv_set_parameter_value(NativePluginHandle handle, uint32_t inde
handlePtr->params[index] = value; handlePtr->params[index] = value;
} }


static const char* midi2cv_get_buffer_port_name(NativePluginHandle handle, uint32_t index, bool isOutput)
{
if (! isOutput)
return NULL;

switch (index)
{
case 0:
return "Pitch";
case 1:
return "Velocity";
case 2:
return "Trigger";
default:
return NULL;
}

// unused
(void)handle;
}

static void midi2cv_activate(NativePluginHandle handle) static void midi2cv_activate(NativePluginHandle handle)
{ {
panic(handlePtr); panic(handlePtr);
@@ -334,6 +355,8 @@ static const NativePluginDescriptor midi2cvDesc = {
.set_midi_program = NULL, .set_midi_program = NULL,
.set_custom_data = NULL, .set_custom_data = NULL,


.get_buffer_port_name = midi2cv_get_buffer_port_name,

.ui_show = NULL, .ui_show = NULL,
.ui_idle = NULL, .ui_idle = NULL,




Loading…
Cancel
Save