Browse Source

Do not clamp LV2 output values under normal circunstances

Only clamp outputs if plugin includes supportsStrictBounds feature,
and an output port does not set hasStrictBounds.
That case means the plugin needs strict bounds support from the host,
and does not set bounds for a port.

In the case of an output port with hasStrictBounds,
it's considered an error if the value is not really in bounds.
We won't check for this though (err, moo moo...).

Fixes #383
tags/1.9.7
falkTX 8 years ago
parent
commit
dbcbe7ae23
1 changed files with 21 additions and 5 deletions
  1. +21
    -5
      source/backend/plugin/CarlaPluginLV2.cpp

+ 21
- 5
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -501,9 +501,10 @@ public:
fCvOutBuffers(nullptr),
fParamBuffers(nullptr),
fCanInit2(true),
fNeedsFixedBuffers(false),
fNeedsUiClose(false),
fLatencyIndex(-1),
fNeedsFixedBuffers(false),
fStrictBounds(-1),
fAtomBufferIn(),
fAtomBufferOut(),
fAtomForge(),
@@ -842,8 +843,16 @@ public:
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr, 0.0f);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, 0.0f);

if (pData->param.data[parameterId].hints & PARAMETER_IS_STRICT_BOUNDS)
pData->param.ranges[parameterId].fixValue(fParamBuffers[parameterId]);
if (pData->param.data[parameterId].type == PARAMETER_INPUT)
{
if (pData->param.data[parameterId].hints & PARAMETER_IS_STRICT_BOUNDS)
pData->param.ranges[parameterId].fixValue(fParamBuffers[parameterId]);
}
else
{
if (fStrictBounds >= 0 && (pData->param.data[parameterId].hints & PARAMETER_IS_STRICT_BOUNDS) == 0)
pData->param.ranges[parameterId].fixValue(fParamBuffers[parameterId]);
}

return fParamBuffers[parameterId];
}
@@ -3451,7 +3460,9 @@ public:
if (pData->param.data[k].type != PARAMETER_OUTPUT)
continue;

pData->param.ranges[k].fixValue(fParamBuffers[k]);
if (fStrictBounds >= 0 && (pData->param.data[k].hints & PARAMETER_IS_STRICT_BOUNDS) != 0)
// plugin is responsible to ensure correct bounds
pData->param.ranges[k].fixValue(fParamBuffers[k]);

if (pData->param.data[k].midiCC > 0)
{
@@ -4808,6 +4819,10 @@ public:
{
fNeedsFixedBuffers = true;
}
else if (std::strcmp(feature.URI, LV2_PORT_PROPS__supportsStrictBounds) == 0)
{
fStrictBounds = feature.Required ? 1 : 0;
}
else if (feature.Required && ! is_lv2_feature_supported(feature.URI))
{
CarlaString msg("Plugin wants a feature that is not supported:\n");
@@ -5529,9 +5544,10 @@ private:
float* fParamBuffers;

bool fCanInit2; // some plugins don't like 2 instances
bool fNeedsFixedBuffers;
bool fNeedsUiClose;
int32_t fLatencyIndex; // -1 if invalid
bool fNeedsFixedBuffers;
int fStrictBounds; // -1 unsupported, 0 optional, 1 required

Lv2AtomRingBuffer fAtomBufferIn;
Lv2AtomRingBuffer fAtomBufferOut;


Loading…
Cancel
Save