Browse Source

Expose vst2 params as cv (testing)

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 4 years ago
parent
commit
b051899438
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 69 additions and 16 deletions
  1. +2
    -3
      source/backend/plugin/CarlaPluginLADSPADSSI.cpp
  2. +3
    -8
      source/backend/plugin/CarlaPluginLV2.cpp
  3. +64
    -5
      source/backend/plugin/CarlaPluginVST2.cpp

+ 2
- 3
source/backend/plugin/CarlaPluginLADSPADSSI.cpp View File

@@ -1222,7 +1222,7 @@ public:

pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0);

for (uint32_t i=0; i < params; ++i)
for (uint32_t i=0; i < params && i < 32; ++i)
{
const int32_t rindex = pData->param.data[i].rindex;
CARLA_SAFE_ASSERT_CONTINUE(rindex >= 0);
@@ -1580,13 +1580,12 @@ public:
// ----------------------------------------------------------------------------------------------------
// CV Control Input

for (uint32_t i=0, j=0; i < pData->param.count; ++i)
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);
}



+ 3
- 8
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -2799,7 +2799,7 @@ public:

pData->event.portIn = (CarlaEngineEventPort*)pData->client->addPort(kEnginePortTypeEvent, portName, true, 0);

for (uint32_t i=0; i < params; ++i)
for (uint32_t i=0; i < params && i < 32; ++i)
{
const int32_t rindex = pData->param.data[i].rindex;
CARLA_SAFE_ASSERT_CONTINUE(rindex >= 0 && rindex < static_cast<int32_t>(fRdfDescriptor->PortCount));
@@ -2815,11 +2815,7 @@ public:
// Parameter as CV
CarlaEngineCVPort* const cvPort =
(CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, portName, true, i);

if (true)
cvPort->setRange(0.0f, 3.0f + (float)i);
else
cvPort->setRange(pData->param.ranges[i].min, pData->param.ranges[i].max);
cvPort->setRange(pData->param.ranges[i].min, pData->param.ranges[i].max);
pData->event.portIn->addCVSource(cvPort, i);
}
}
@@ -3524,13 +3520,12 @@ public:
// ----------------------------------------------------------------------------------------------------
// CV Control Input

for (uint32_t i=0, j=0; i < pData->param.count; ++i)
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[pData->cvIn.count + cvIndex], frames, i);
}



+ 64
- 5
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -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;


Loading…
Cancel
Save