|
|
@@ -873,6 +873,26 @@ public: |
|
|
|
portName.truncate(portNameSize); |
|
|
|
|
|
|
|
pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0); |
|
|
|
|
|
|
|
char strBuf[STR_MAX]; |
|
|
|
|
|
|
|
for (uint32_t i=0; i < params && i < 32; ++i) |
|
|
|
{ |
|
|
|
if (pData->param.data[i].type != PARAMETER_INPUT) |
|
|
|
continue; |
|
|
|
|
|
|
|
carla_zeroChars(strBuf, STR_MAX); |
|
|
|
dispatcher(effGetParamName, static_cast<int32_t>(i), 0, strBuf); |
|
|
|
|
|
|
|
if (strBuf[0] == '\0') |
|
|
|
std::snprintf(strBuf, STR_MAX-1, "Parameter %u", i+1U); |
|
|
|
|
|
|
|
// Parameter as CV |
|
|
|
CarlaEngineCVPort* const cvPort = |
|
|
|
(CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, strBuf, true, i); |
|
|
|
cvPort->setRange(pData->param.ranges[i].min, pData->param.ranges[i].max); |
|
|
|
pData->event.portIn->addCVSource(cvPort, i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (needsCtrlOut) |
|
|
@@ -1090,7 +1110,11 @@ public: |
|
|
|
} catch(...) {} |
|
|
|
} |
|
|
|
|
|
|
|
void process(const float** const audioIn, float** const audioOut, const float** const, float** const, const uint32_t frames) override |
|
|
|
void process(const float** const audioIn, |
|
|
|
float** const audioOut, |
|
|
|
const float** const cvIn, |
|
|
|
float** const, |
|
|
|
const uint32_t frames) override |
|
|
|
{ |
|
|
|
const CarlaScopedValueSetter<pthread_t> svs(fProcThread, pthread_self(), kNullThread); |
|
|
|
|
|
|
@@ -1245,6 +1269,18 @@ public: |
|
|
|
|
|
|
|
} // End of MIDI Input (External) |
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------------------------------- |
|
|
|
// CV Control Input |
|
|
|
|
|
|
|
for (uint32_t i=0, j=0; i < pData->param.count && i < 32; ++i) |
|
|
|
{ |
|
|
|
if (pData->param.data[i].type != PARAMETER_INPUT) |
|
|
|
continue; |
|
|
|
|
|
|
|
const uint32_t cvIndex = j++; |
|
|
|
pData->event.portIn->mixWithCvBuffer(cvIn[cvIndex], frames, i); |
|
|
|
} |
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------------------------------- |
|
|
|
// Event Input (System) |
|
|
|
|
|
|
@@ -1301,12 +1337,37 @@ public: |
|
|
|
break; |
|
|
|
|
|
|
|
case kEngineControlEventTypeParameter: { |
|
|
|
float value; |
|
|
|
|
|
|
|
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH |
|
|
|
// via CV |
|
|
|
if (event.channel == 0xFF) |
|
|
|
{ |
|
|
|
const uint32_t k = ctrlEvent.param; |
|
|
|
CARLA_SAFE_ASSERT_CONTINUE(k < pData->param.count); |
|
|
|
|
|
|
|
if (pData->param.data[k].hints & PARAMETER_IS_BOOLEAN) |
|
|
|
{ |
|
|
|
value = (ctrlEvent.value < 0.5f) ? pData->param.ranges[k].min : pData->param.ranges[k].max; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (pData->param.data[k].hints & PARAMETER_IS_LOGARITHMIC) |
|
|
|
value = pData->param.ranges[k].getUnnormalizedLogValue(ctrlEvent.value); |
|
|
|
else |
|
|
|
value = pData->param.ranges[k].getUnnormalizedValue(ctrlEvent.value); |
|
|
|
|
|
|
|
if (pData->param.data[k].hints & PARAMETER_IS_INTEGER) |
|
|
|
value = std::rint(value); |
|
|
|
} |
|
|
|
|
|
|
|
setParameterValueRT(k, value, true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// Control backend stuff |
|
|
|
if (event.channel == pData->ctrlChannel) |
|
|
|
{ |
|
|
|
float value; |
|
|
|
|
|
|
|
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_DRYWET) != 0) |
|
|
|
{ |
|
|
|
value = ctrlEvent.value; |
|
|
@@ -1358,8 +1419,6 @@ public: |
|
|
|
if ((pData->param.data[k].hints & PARAMETER_IS_AUTOMABLE) == 0) |
|
|
|
continue; |
|
|
|
|
|
|
|
float value; |
|
|
|
|
|
|
|
if (pData->param.data[k].hints & PARAMETER_IS_BOOLEAN) |
|
|
|
{ |
|
|
|
value = (ctrlEvent.value < 0.5f) ? pData->param.ranges[k].min : pData->param.ranges[k].max; |
|
|
|