Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-rc1
@@ -2343,7 +2343,8 @@ static const NativePluginDescriptor carlaRackDesc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaRackNoMidiOutDesc = { | static const NativePluginDescriptor carlaRackNoMidiOutDesc = { | ||||
@@ -2388,7 +2389,8 @@ static const NativePluginDescriptor carlaRackNoMidiOutDesc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaPatchbayDesc = { | static const NativePluginDescriptor carlaPatchbayDesc = { | ||||
@@ -2433,7 +2435,8 @@ static const NativePluginDescriptor carlaPatchbayDesc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaPatchbay3sDesc = { | static const NativePluginDescriptor carlaPatchbay3sDesc = { | ||||
@@ -2478,7 +2481,8 @@ static const NativePluginDescriptor carlaPatchbay3sDesc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaPatchbay16Desc = { | static const NativePluginDescriptor carlaPatchbay16Desc = { | ||||
@@ -2523,7 +2527,8 @@ static const NativePluginDescriptor carlaPatchbay16Desc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaPatchbay32Desc = { | static const NativePluginDescriptor carlaPatchbay32Desc = { | ||||
@@ -2568,7 +2573,8 @@ static const NativePluginDescriptor carlaPatchbay32Desc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaPatchbay64Desc = { | static const NativePluginDescriptor carlaPatchbay64Desc = { | ||||
@@ -2613,7 +2619,8 @@ static const NativePluginDescriptor carlaPatchbay64Desc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 0, | /* cvIns */ 0, | ||||
/* cvOuts */ 0, | /* cvOuts */ 0, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
static const NativePluginDescriptor carlaPatchbayCVDesc = { | static const NativePluginDescriptor carlaPatchbayCVDesc = { | ||||
@@ -2659,7 +2666,8 @@ static const NativePluginDescriptor carlaPatchbayCVDesc = { | |||||
/* _render_inline_dsplay */ nullptr, | /* _render_inline_dsplay */ nullptr, | ||||
/* cvIns */ 5, | /* cvIns */ 5, | ||||
/* cvOuts */ 5, | /* cvOuts */ 5, | ||||
/* _get_buffer_port_name */ nullptr | |||||
/* _get_buffer_port_name */ nullptr, | |||||
/* _get_buffer_port_range */ nullptr | |||||
}; | }; | ||||
CARLA_BACKEND_END_NAMESPACE | CARLA_BACKEND_END_NAMESPACE | ||||
@@ -2211,17 +2211,34 @@ public: | |||||
} | } | ||||
else if (LV2_IS_PORT_CV(portTypes)) | else if (LV2_IS_PORT_CV(portTypes)) | ||||
{ | { | ||||
const LV2_RDF_PortPoints portPoints(fRdfDescriptor->Ports[i].Points); | |||||
float min, max; | |||||
// min value | |||||
if (LV2_HAVE_MINIMUM_PORT_POINT(portPoints.Hints)) | |||||
min = portPoints.Minimum; | |||||
else | |||||
min = -1.0f; | |||||
// max value | |||||
if (LV2_HAVE_MAXIMUM_PORT_POINT(portPoints.Hints)) | |||||
max = portPoints.Maximum; | |||||
else | |||||
max = 1.0f; | |||||
if (LV2_IS_PORT_INPUT(portTypes)) | if (LV2_IS_PORT_INPUT(portTypes)) | ||||
{ | { | ||||
const uint32_t j = iCvIn++; | const uint32_t j = iCvIn++; | ||||
pData->cvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true, j); | pData->cvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true, j); | ||||
pData->cvIn.ports[j].rindex = i; | pData->cvIn.ports[j].rindex = i; | ||||
pData->cvIn.ports[j].port->setRange(min, max); | |||||
} | } | ||||
else if (LV2_IS_PORT_OUTPUT(portTypes)) | else if (LV2_IS_PORT_OUTPUT(portTypes)) | ||||
{ | { | ||||
const uint32_t j = iCvOut++; | const uint32_t j = iCvOut++; | ||||
pData->cvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false, j); | pData->cvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false, j); | ||||
pData->cvOut.ports[j].rindex = i; | pData->cvOut.ports[j].rindex = i; | ||||
pData->cvOut.ports[j].port->setRange(min, max); | |||||
} | } | ||||
else | else | ||||
carla_stderr("WARNING - Got a broken Port (CV, but not input or output)"); | carla_stderr("WARNING - Got a broken Port (CV, but not input or output)"); | ||||
@@ -1213,8 +1213,21 @@ public: | |||||
portName.truncate(portNameSize); | portName.truncate(portNameSize); | ||||
float min = -1.0f, max = 1.0f; | |||||
if (fDescriptor->get_buffer_port_range != nullptr) | |||||
{ | |||||
if (const NativePortRange* const range = fDescriptor->get_buffer_port_range(fHandle, | |||||
fDescriptor->audioIns + j, | |||||
false)) | |||||
{ | |||||
min = range->minimum; | |||||
max = range->maximum; | |||||
} | |||||
} | |||||
pData->cvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true, j); | pData->cvIn.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true, j); | ||||
pData->cvIn.ports[j].rindex = j; | pData->cvIn.ports[j].rindex = j; | ||||
pData->cvIn.ports[j].port->setRange(min, max); | |||||
} | } | ||||
// CV Outs | // CV Outs | ||||
@@ -1242,8 +1255,21 @@ public: | |||||
portName.truncate(portNameSize); | portName.truncate(portNameSize); | ||||
float min = -1.0f, max = 1.0f; | |||||
if (fDescriptor->get_buffer_port_range != nullptr) | |||||
{ | |||||
if (const NativePortRange* const range = fDescriptor->get_buffer_port_range(fHandle, | |||||
fDescriptor->audioOuts + j, | |||||
true)) | |||||
{ | |||||
min = range->minimum; | |||||
max = range->maximum; | |||||
} | |||||
} | |||||
pData->cvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false, j); | pData->cvOut.ports[j].port = (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, false, j); | ||||
pData->cvOut.ports[j].rindex = j; | pData->cvOut.ports[j].rindex = j; | ||||
pData->cvOut.ports[j].port->setRange(min, max); | |||||
} | } | ||||
// MIDI Input (only if multiple) | // MIDI Input (only if multiple) | ||||
@@ -193,6 +193,10 @@ typedef struct { | |||||
int stride; | int stride; | ||||
} NativeInlineDisplayImageSurface; | } NativeInlineDisplayImageSurface; | ||||
typedef struct { | |||||
float minimum, maximum; | |||||
} NativePortRange; | |||||
/* ------------------------------------------------------------------------------------------------------------ | /* ------------------------------------------------------------------------------------------------------------ | ||||
* HostDescriptor */ | * HostDescriptor */ | ||||
@@ -283,6 +287,7 @@ typedef struct _NativePluginDescriptor { | |||||
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); | const char* (*get_buffer_port_name)(NativePluginHandle handle, uint32_t index, bool isOutput); | ||||
const NativePortRange* (*get_buffer_port_range)(NativePluginHandle handle, uint32_t index, bool isOutput); | |||||
} NativePluginDescriptor; | } NativePluginDescriptor; | ||||
@@ -619,7 +619,7 @@ public: \ | |||||
ClassName::_set_state, \ | ClassName::_set_state, \ | ||||
ClassName::_dispatcher, \ | ClassName::_dispatcher, \ | ||||
ClassName::_render_inline_display, \ | ClassName::_render_inline_display, \ | ||||
0, 0, nullptr | |||||
0, 0, nullptr, nullptr | |||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
@@ -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, nullptr | |||||
DESCFUNCS_WITHCV, 0, 0, nullptr, nullptr | |||||
static const NativePluginDescriptor sNativePluginDescriptors[] = { | static const NativePluginDescriptor sNativePluginDescriptors[] = { | ||||
@@ -194,9 +194,10 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = { | |||||
/* maker */ "falkTX, Bram Giesen, Jarno Verheesen", | /* maker */ "falkTX, Bram Giesen, Jarno Verheesen", | ||||
/* copyright */ "GNU GPL v2+", | /* copyright */ "GNU GPL v2+", | ||||
DESCFUNCS_WITHCV, | DESCFUNCS_WITHCV, | ||||
/* cvIns */ 0, | |||||
/* cvOuts */ 3, | |||||
/* bufnamefn */ nullptr | |||||
/* cvIns */ 0, | |||||
/* cvOuts */ 3, | |||||
/* bufnamefn */ nullptr, | |||||
/* bufrangefn */ nullptr | |||||
}, | }, | ||||
{ | { | ||||
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, | /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, | ||||
@@ -482,9 +483,10 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = { | |||||
/* maker */ "falkTX", | /* maker */ "falkTX", | ||||
/* copyright */ "GNU GPL v2+", | /* copyright */ "GNU GPL v2+", | ||||
DESCFUNCS_WITHCV, | DESCFUNCS_WITHCV, | ||||
/* cvIns */ 5, | |||||
/* cvOuts */ 5, | |||||
/* bufnamefn */ nullptr | |||||
/* cvIns */ 5, | |||||
/* cvOuts */ 5, | |||||
/* bufnamefn */ nullptr, | |||||
/* bufrangefn */ nullptr | |||||
}, | }, | ||||
#endif | #endif | ||||
@@ -338,9 +338,7 @@ static const NativePluginDescriptor audiogainStereoDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = audiogain_dispatcher, | |||||
.render_inline_display = NULL | |||||
.dispatcher = audiogain_dispatcher | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -92,9 +92,7 @@ static const NativePluginDescriptor bypassDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -312,9 +312,7 @@ static const NativePluginDescriptor lfoDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -201,9 +201,7 @@ static const NativePluginDescriptor midichanabDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -192,9 +192,7 @@ static const NativePluginDescriptor midichanfilterDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -200,9 +200,7 @@ static const NativePluginDescriptor midichannelizeDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -262,9 +262,7 @@ static const NativePluginDescriptor midigainDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -139,9 +139,7 @@ static const NativePluginDescriptor midijoinDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -132,9 +132,7 @@ static const NativePluginDescriptor midisplitDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -113,9 +113,7 @@ static const NativePluginDescriptor midithroughDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -179,6 +179,35 @@ static void midi2cv_set_parameter_value(NativePluginHandle handle, uint32_t inde | |||||
handlePtr->params[index] = value; | handlePtr->params[index] = value; | ||||
} | } | ||||
static const NativePortRange* midi2cv_get_buffer_port_range(NativePluginHandle handle, uint32_t index, bool isOutput) | |||||
{ | |||||
if (! isOutput) | |||||
return NULL; | |||||
static NativePortRange npr; | |||||
switch (index) | |||||
{ | |||||
case 0: | |||||
npr.minimum = 0.0f; | |||||
npr.maximum = 9.0f; | |||||
return ⊀ | |||||
case 1: | |||||
npr.minimum = 0.0f; | |||||
npr.maximum = 10.5f; | |||||
return ⊀ | |||||
case 2: | |||||
npr.minimum = 0.0f; | |||||
npr.maximum = 10.0f; | |||||
return ⊀ | |||||
default: | |||||
return NULL; | |||||
} | |||||
// unused | |||||
(void)handle; | |||||
} | |||||
static const char* midi2cv_get_buffer_port_name(NativePluginHandle handle, uint32_t index, bool isOutput) | static const char* midi2cv_get_buffer_port_name(NativePluginHandle handle, uint32_t index, bool isOutput) | ||||
{ | { | ||||
if (! isOutput) | if (! isOutput) | ||||
@@ -357,6 +386,7 @@ static const NativePluginDescriptor midi2cvDesc = { | |||||
.set_custom_data = NULL, | .set_custom_data = NULL, | ||||
.get_buffer_port_name = midi2cv_get_buffer_port_name, | .get_buffer_port_name = midi2cv_get_buffer_port_name, | ||||
.get_buffer_port_range = midi2cv_get_buffer_port_range, | |||||
.ui_show = NULL, | .ui_show = NULL, | ||||
.ui_idle = NULL, | .ui_idle = NULL, | ||||
@@ -225,9 +225,7 @@ static const NativePluginDescriptor miditransposeDesc = { | |||||
.get_state = NULL, | .get_state = NULL, | ||||
.set_state = NULL, | .set_state = NULL, | ||||
.dispatcher = NULL, | |||||
.render_inline_display = NULL | |||||
.dispatcher = NULL | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||