Browse Source

Cleanup; misc LV2 work

tags/1.9.4
falkTX 10 years ago
parent
commit
291791980d
9 changed files with 158 additions and 156 deletions
  1. +6
    -3
      source/backend/plugin/DssiPlugin.cpp
  2. +7
    -4
      source/backend/plugin/LadspaPlugin.cpp
  3. +123
    -109
      source/backend/plugin/Lv2Plugin.cpp
  4. +1
    -5
      source/discovery/Makefile
  5. +4
    -4
      source/discovery/carla-discovery.cpp
  6. +4
    -13
      source/includes/lv2/atom-helpers.h
  7. +1
    -1
      source/includes/lv2/atom-util.h
  8. +5
    -5
      source/modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp
  9. +7
    -12
      source/utils/CarlaLv2Utils.hpp

+ 6
- 3
source/backend/plugin/DssiPlugin.cpp View File

@@ -574,8 +574,6 @@ public:

if (min > max)
max = min;
else if (max < min)
min = max;

if (max - min == 0.0f)
{
@@ -1421,7 +1419,6 @@ public:
pData->event.portOut->writeControlEvent(0, channel, kEngineControlEventTypeParameter, param, value);
}
}

} // End of Control Output
}

@@ -1957,6 +1954,8 @@ public:
return true;
}

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

private:
LADSPA_Handle fHandle;
LADSPA_Handle fHandle2;
@@ -2015,6 +2014,8 @@ CARLA_BACKEND_END_NAMESPACE

#endif // WANT_DSSI

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

CARLA_BACKEND_START_NAMESPACE

CarlaPlugin* CarlaPlugin::newDSSI(const Initializer& init)
@@ -2047,3 +2048,5 @@ CarlaPlugin* CarlaPlugin::newDSSI(const Initializer& init)
}

CARLA_BACKEND_END_NAMESPACE

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

+ 7
- 4
source/backend/plugin/LadspaPlugin.cpp View File

@@ -573,8 +573,6 @@ public:

if (min > max)
max = min;
else if (max < min)
min = max;

if (max - min == 0.0f)
{
@@ -1063,7 +1061,6 @@ public:
pData->event.portOut->writeControlEvent(0, channel, kEngineControlEventTypeParameter, param, value);
}
}

} // End of Control Output
}

@@ -1468,6 +1465,8 @@ public:
return true;
}

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

private:
LADSPA_Handle fHandle;
LADSPA_Handle fHandle2;
@@ -1483,7 +1482,9 @@ private:

CARLA_BACKEND_END_NAMESPACE

#endif
#endif // WANT_LADSPA

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

CARLA_BACKEND_START_NAMESPACE

@@ -1517,3 +1518,5 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const Initializer& init, const LADSPA_RDF_De
}

CARLA_BACKEND_END_NAMESPACE

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

+ 123
- 109
source/backend/plugin/Lv2Plugin.cpp View File

@@ -158,7 +158,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, 0);

return fRdfDescriptor->UniqueID;
return static_cast<long>(fRdfDescriptor->UniqueID);
}

// -------------------------------------------------------------------
@@ -207,8 +207,8 @@ public:

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
const LV2_RDF_Port& port(fRdfDescriptor->Ports[rindex]);
return port.ScalePointCount;
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]);
return port->ScalePointCount;
}

return 0;
@@ -224,7 +224,7 @@ public:

unsigned int getOptionsAvailable() const noexcept override
{
const uint32_t hasMidiIn(getMidiInCount() > 0);
const bool hasMidiIn(getMidiInCount() > 0);

unsigned int options = 0x0;

@@ -274,12 +274,12 @@ public:

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
const LV2_RDF_Port& port(fRdfDescriptor->Ports[rindex]);
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]);

if (scalePointId < port.ScalePointCount)
if (scalePointId < port->ScalePointCount)
{
const LV2_RDF_PortScalePoint& portScalePoint(port.ScalePoints[scalePointId]);
return portScalePoint.Value;
const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]);
return portScalePoint->Value;
}
}

@@ -291,10 +291,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor->URI != nullptr,);

if (fRdfDescriptor->URI != nullptr)
std::strncpy(strBuf, fRdfDescriptor->URI, STR_MAX);
else
CarlaPlugin::getLabel(strBuf);
std::strncpy(strBuf, fRdfDescriptor->URI, STR_MAX);
}

void getMaker(char* const strBuf) const noexcept override
@@ -362,16 +359,17 @@ public:

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
const LV2_RDF_Port& port(fRdfDescriptor->Ports[rindex]);
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]);

if (LV2_HAVE_PORT_UNIT_SYMBOL(port.Unit.Hints) && port.Unit.Symbol != nullptr)
if (LV2_HAVE_PORT_UNIT_SYMBOL(port->Unit.Hints) && port->Unit.Symbol != nullptr)
{
std::strncpy(strBuf, port.Unit.Symbol, STR_MAX);
std::strncpy(strBuf, port->Unit.Symbol, STR_MAX);
return;
}
else if (LV2_HAVE_PORT_UNIT_UNIT(port.Unit.Hints))

if (LV2_HAVE_PORT_UNIT_UNIT(port->Unit.Hints))
{
switch (port.Unit.Unit)
switch (port->Unit.Unit)
{
case LV2_PORT_UNIT_BAR:
std::strncpy(strBuf, "bars", STR_MAX);
@@ -462,15 +460,15 @@ public:

if (rindex < static_cast<int32_t>(fRdfDescriptor->PortCount))
{
const LV2_RDF_Port& port(fRdfDescriptor->Ports[rindex]);
const LV2_RDF_Port* const port(&fRdfDescriptor->Ports[rindex]);

if (scalePointId < port.ScalePointCount)
if (scalePointId < port->ScalePointCount)
{
const LV2_RDF_PortScalePoint& portScalePoint(port.ScalePoints[scalePointId]);
const LV2_RDF_PortScalePoint* const portScalePoint(&port->ScalePoints[scalePointId]);

if (portScalePoint.Label != nullptr)
if (portScalePoint->Label != nullptr)
{
std::strncpy(strBuf, portScalePoint.Label, STR_MAX);
std::strncpy(strBuf, portScalePoint->Label, STR_MAX);
return;
}
}
@@ -479,11 +477,22 @@ public:
CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);
}

// -------------------------------------------------------------------
// Set data (state)

// nothing

// -------------------------------------------------------------------
// Set data (internal stuff)

// nothing

// -------------------------------------------------------------------
// Set data (plugin-specific stuff)

void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);

const float fixedValue(pData->param.getFixedValue(parameterId, value));
@@ -492,6 +501,11 @@ public:
CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback);
}

// -------------------------------------------------------------------
// Set ui stuff

// nothing

// -------------------------------------------------------------------
// Plugin state

@@ -514,9 +528,9 @@ public:
clearBuffers();

const float sampleRate(static_cast<float>(pData->engine->getSampleRate()));
const uint32_t portCount(static_cast<uint32_t>(fRdfDescriptor->PortCount));
const uint32_t portCount(fRdfDescriptor->PortCount);

uint32_t aIns, aOuts, params, j;
uint32_t aIns, aOuts, params;
aIns = aOuts = params = 0;

bool forcedStereoIn, forcedStereoOut;
@@ -525,19 +539,22 @@ public:
bool needsCtrlIn, needsCtrlOut;
needsCtrlIn = needsCtrlOut = false;

for (uint32_t i=0; i < portCount; ++i)
if (portCount > 0)
{
const LV2_Property portTypes(fRdfDescriptor->Ports[i].Types);

if (LV2_IS_PORT_AUDIO(portTypes))
for (uint32_t i=0; i < portCount; ++i)
{
if (LV2_IS_PORT_INPUT(portTypes))
aIns += 1;
else if (LV2_IS_PORT_OUTPUT(portTypes))
aOuts += 1;
const LV2_Property portTypes(fRdfDescriptor->Ports[i].Types);

if (LV2_IS_PORT_AUDIO(portTypes))
{
if (LV2_IS_PORT_INPUT(portTypes))
aIns += 1;
else if (LV2_IS_PORT_OUTPUT(portTypes))
aOuts += 1;
}
else if (LV2_IS_PORT_CONTROL(portTypes))
params += 1;
}
else if (LV2_IS_PORT_CONTROL(portTypes))
params += 1;
}

if ((pData->options & PLUGIN_OPTION_FORCE_STEREO) != 0 && (aIns == 1 || aOuts == 1) /*&& fExt.state == nullptr && fExt.worker == nullptr*/)
@@ -613,7 +630,7 @@ public:
{
if (LV2_IS_PORT_INPUT(portTypes))
{
j = iAudioIn++;
uint32_t j = iAudioIn++;
pData->audioIn.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, true);
pData->audioIn.ports[j].rindex = i;

@@ -626,7 +643,7 @@ public:
}
else if (LV2_IS_PORT_OUTPUT(portTypes))
{
j = iAudioOut++;
uint32_t j = iAudioOut++;
pData->audioOut.ports[j].port = (CarlaEngineAudioPort*)pData->client->addPort(kEnginePortTypeAudio, portName, false);
pData->audioOut.ports[j].rindex = i;

@@ -638,7 +655,7 @@ public:
}
}
else
carla_stderr("WARNING - Got a broken Port (Audio, but not input or output)");
carla_stderr2("WARNING - Got a broken Port (Audio, but not input or output)");
}
else if (LV2_IS_PORT_CONTROL(portTypes))
{
@@ -646,13 +663,14 @@ public:
const LV2_Property portDesignation(fRdfDescriptor->Ports[i].Designation);
const LV2_RDF_PortPoints portPoints(fRdfDescriptor->Ports[i].Points);

j = iCtrl++;
uint32_t j = iCtrl++;
pData->param.data[j].type = PARAMETER_UNKNOWN;
pData->param.data[j].hints = 0x0;
pData->param.data[j].index = j;
pData->param.data[j].rindex = i;
pData->param.data[j].index = static_cast<int32_t>(j);
pData->param.data[j].rindex = static_cast<int32_t>(i);
pData->param.data[j].midiCC = -1;
pData->param.data[j].midiChannel = 0;
pData->param.special[j] = PARAMETER_SPECIAL_NULL;

float min, max, def, step, stepSmall, stepLarge;

@@ -670,8 +688,6 @@ public:

if (min > max)
max = min;
else if (max < min)
min = max;

// stupid hack for ir.lv2 (broken plugin)
if (std::strcmp(fRdfDescriptor->URI, "http://factorial.hu/plugins/lv2/ir") == 0 && std::strncmp(fRdfDescriptor->Ports[i].Name, "FileHash", 8) == 0)
@@ -743,21 +759,17 @@ public:
}
else if (LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(portDesignation))
{
def = sampleRate;
step = 1.0f;
stepSmall = 1.0f;
stepLarge = 1.0f;

//pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
pData->param.data[j].hints = 0x0;
carla_stderr("Plugin has sample-rate input port, this is not supported!");
}
else if (LV2_IS_PORT_DESIGNATION_FREEWHEELING(portDesignation))
{
//pData->param.data[j].type = PARAMETER_LV2_FREEWHEEL;
pData->param.data[j].type = PARAMETER_SPECIAL;
pData->param.special[j] = PARAMETER_SPECIAL_LV2_FREEWHEEL;
}
else if (LV2_IS_PORT_DESIGNATION_TIME(portDesignation))
{
//pData->param.data[j].type = PARAMETER_LV2_TIME;
pData->param.data[j].type = PARAMETER_SPECIAL;
pData->param.special[j] = PARAMETER_SPECIAL_LV2_TIME;
}
else
{
@@ -787,8 +799,8 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

//pData->param.data[j].type = PARAMETER_LATENCY;
pData->param.data[j].hints = 0x0;
pData->param.data[j].type = PARAMETER_SPECIAL;
pData->param.special[j] = PARAMETER_SPECIAL_LATENCY;
}
else if (LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(portDesignation))
{
@@ -797,8 +809,8 @@ public:
stepSmall = 1.0f;
stepLarge = 1.0f;

//pData->param.data[j].type = PARAMETER_SAMPLE_RATE;
pData->param.data[j].hints = 0x0;
pData->param.data[j].type = PARAMETER_SPECIAL;
pData->param.special[j] = PARAMETER_SPECIAL_SAMPLE_RATE;
}
else if (LV2_IS_PORT_DESIGNATION_FREEWHEELING(portDesignation))
{
@@ -806,7 +818,7 @@ public:
}
else if (LV2_IS_PORT_DESIGNATION_TIME(portDesignation))
{
//pData->param.data[j].type = PARAMETER_LV2_TIME;
carla_stderr("Plugin has time output port, this is not supported!");
}
else
{
@@ -818,14 +830,10 @@ public:
}
else
{
pData->param.data[j].type = PARAMETER_UNKNOWN;
carla_stderr2("WARNING - Got a broken Port (Control, but not input or output)");
}

// extra parameter hints
if (LV2_IS_PORT_ENUMERATION(portProps))
pData->param.data[j].hints |= PARAMETER_USES_SCALEPOINTS;

if (LV2_IS_PORT_LOGARITHMIC(portProps))
pData->param.data[j].hints |= PARAMETER_IS_LOGARITHMIC;

@@ -835,11 +843,12 @@ public:
if (LV2_IS_PORT_STRICT_BOUNDS(portProps))
pData->param.data[j].hints |= PARAMETER_IS_STRICT_BOUNDS;

if (LV2_IS_PORT_ENUMERATION(portProps))
pData->param.data[j].hints |= PARAMETER_USES_SCALEPOINTS;

// check if parameter is not enabled or automable
if (LV2_IS_PORT_NOT_ON_GUI(portProps))
{
pData->param.data[j].hints &= ~(PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE);
}
else if (LV2_IS_PORT_CAUSES_ARTIFACTS(portProps) || LV2_IS_PORT_EXPENSIVE(portProps) || LV2_IS_PORT_NOT_AUTOMATIC(portProps))
pData->param.data[j].hints &= ~PARAMETER_IS_AUTOMABLE;

@@ -850,11 +859,11 @@ public:
pData->param.ranges[j].stepSmall = stepSmall;
pData->param.ranges[j].stepLarge = stepLarge;

// Start parameters in their default values
//if (pData->param.data[j].type != PARAMETER_LV2_FREEWHEEL)
// Start parameters in their default values (except freewheel, which is off by default)
if (pData->param.data[j].type != PARAMETER_SPECIAL && pData->param.special[j] != PARAMETER_SPECIAL_LV2_FREEWHEEL)
fParamBuffers[j] = def;
//else
// fParamBuffers[j] = min;
else
fParamBuffers[j] = min;

fDescriptor->connect_port(fHandle, i, &fParamBuffers[j]);

@@ -927,11 +936,17 @@ public:
pData->hints |= PLUGIN_CAN_BALANCE;

// extra plugin hints
pData->extraHints &= ~PLUGIN_EXTRA_HINT_CAN_RUN_RACK;
pData->extraHints = 0x0;

if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0))
pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; // FIXME

bufferSizeChanged(pData->engine->getBufferSize());
reloadPrograms(true);

// check latency
// TODO

if (pData->active)
activate();

@@ -983,19 +998,31 @@ public:

void process(float** const inBuffer, float** const outBuffer, const uint32_t frames) override
{
uint32_t i, k;

// --------------------------------------------------------------------------------------------------------
// Check if active

if (! pData->active)
{
// disable any output sound
for (i=0; i < pData->audioOut.count; ++i)
for (uint32_t i=0; i < pData->audioOut.count; ++i)
FLOAT_CLEAR(outBuffer[i], frames);
return;
}

// --------------------------------------------------------------------------------------------------------
// Check if needs reset

if (pData->needsReset)
{
if (pData->latency > 0)
{
for (uint32_t i=0; i < pData->audioIn.count; ++i)
FLOAT_CLEAR(pData->latencyBuffers[i], pData->latency);
}

pData->needsReset = false;
}

// --------------------------------------------------------------------------------------------------------
// Plugin processing (no events)

@@ -1004,6 +1031,8 @@ public:

} // End of Plugin processing (no events)

CARLA_PROCESS_CONTINUE_CHECK;

// --------------------------------------------------------------------------------------------------------
// Control Output

@@ -1013,13 +1042,12 @@ public:
uint16_t param;
float value;

for (k=0; k < pData->param.count; ++k)
for (uint32_t k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type != PARAMETER_OUTPUT)
continue;

if (pData->param.data[k].hints & PARAMETER_IS_STRICT_BOUNDS)
pData->param.ranges[k].fixValue(fParamBuffers[k]);
pData->param.ranges[k].fixValue(fParamBuffers[k]);

if (pData->param.data[k].midiCC > 0)
{
@@ -1029,12 +1057,7 @@ public:
pData->event.portOut->writeControlEvent(0, channel, kEngineControlEventTypeParameter, param, value);
}
}

} // End of Control Output

CARLA_PROCESS_CONTINUE_CHECK;

// --------------------------------------------------------------------------------------------------------
}

bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)
@@ -1050,8 +1073,6 @@ public:
CARLA_SAFE_ASSERT_RETURN(outBuffer != nullptr, false);
}

uint32_t i, k;

// --------------------------------------------------------------------------------------------------------
// Try lock, silence otherwise

@@ -1061,9 +1082,9 @@ public:
}
else if (! pData->singleMutex.tryLock())
{
for (i=0; i < pData->audioOut.count; ++i)
for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
for (k=0; k < frames; ++k)
for (uint32_t k=0; k < frames; ++k)
outBuffer[i][k+timeOffset] = 0.0f;
}

@@ -1073,10 +1094,10 @@ public:
// --------------------------------------------------------------------------------------------------------
// Reset audio buffers

for (i=0; i < pData->audioIn.count; ++i)
for (uint32_t i=0; i < pData->audioIn.count; ++i)
FLOAT_COPY(fAudioInBuffers[i], inBuffer[i]+timeOffset, frames);

for (i=0; i < pData->audioOut.count; ++i)
for (uint32_t i=0; i < pData->audioOut.count; ++i)
FLOAT_CLEAR(fAudioOutBuffers[i], frames);

// --------------------------------------------------------------------------------------------------------
@@ -1088,9 +1109,9 @@ public:
fDescriptor->run(fHandle2, frames);

// --------------------------------------------------------------------------------------------------------
// Special Parameters
// Handle trigger parameters

for (k=0; k < pData->param.count; ++k)
for (uint32_t k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type != PARAMETER_INPUT)
continue;
@@ -1118,12 +1139,12 @@ public:
bool isPair;
float bufValue, oldBufLeft[doBalance ? frames : 1];

for (i=0; i < pData->audioOut.count; ++i)
for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
// Dry/Wet
if (doDryWet)
{
for (k=0; k < frames; ++k)
for (uint32_t k=0; k < frames; ++k)
{
// TODO
//if (k < pData->latency && pData->latency < frames)
@@ -1150,7 +1171,7 @@ public:
float balRangeL = (pData->postProc.balanceLeft + 1.0f)/2.0f;
float balRangeR = (pData->postProc.balanceRight + 1.0f)/2.0f;

for (k=0; k < frames; ++k)
for (uint32_t k=0; k < frames; ++k)
{
if (isPair)
{
@@ -1169,15 +1190,15 @@ public:

// Volume (and buffer copy)
{
for (k=0; k < frames; ++k)
for (uint32_t k=0; k < frames; ++k)
outBuffer[i][k+timeOffset] = fAudioOutBuffers[i][k] * pData->postProc.volume;
}
}
} // End of Post-processing
#else
for (i=0; i < pData->audioOut.count; ++i)
#else // BUILD_BRIDGE
for (uint32_t i=0; i < pData->audioOut.count; ++i)
{
for (k=0; k < frames; ++k)
for (uint32_t k=0; k < frames; ++k)
outBuffer[i][k+timeOffset] = fAudioOutBuffers[i][k];
}
#endif
@@ -1249,18 +1270,11 @@ public:

void sampleRateChanged(const double newSampleRate) override
{
CARLA_ASSERT_INT(newSampleRate > 0.0, int(newSampleRate));
CARLA_ASSERT_INT(newSampleRate > 0.0, (int)newSampleRate);
carla_debug("Lv2Plugin::sampleRateChanged(%g) - start", newSampleRate);

for (uint32_t k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type == PARAMETER_INPUT && pData->param.special[k] == PARAMETER_SPECIAL_SAMPLE_RATE)
{
fParamBuffers[k] = float(newSampleRate);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]);
break;
}
}
// TODO
(void)newSampleRate;

carla_debug("Lv2Plugin::sampleRateChanged(%g) - end", newSampleRate);
}
@@ -1269,7 +1283,7 @@ public:
{
for (uint32_t k=0; k < pData->param.count; ++k)
{
if (pData->param.data[k].type == PARAMETER_INPUT && pData->param.special[k] == PARAMETER_SPECIAL_LV2_FREEWHEEL)
if (pData->param.data[k].type == PARAMETER_SPECIAL && pData->param.special[k] == PARAMETER_SPECIAL_LV2_FREEWHEEL)
{
fParamBuffers[k] = isOffline ? pData->param.ranges[k].max : pData->param.ranges[k].min;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]);
@@ -1328,9 +1342,9 @@ public:

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

bool isRealtimeSafe() const
bool isRealtimeSafe() const noexcept
{
CARLA_ASSERT(fRdfDescriptor != nullptr);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);

for (uint32_t i=0; i < fRdfDescriptor->FeatureCount; ++i)
{
@@ -1341,9 +1355,9 @@ public:
return false;
}

bool needsFixedBuffer() const
bool needsFixedBuffer() const noexcept
{
CARLA_ASSERT(fRdfDescriptor != nullptr);
CARLA_SAFE_ASSERT_RETURN(fRdfDescriptor != nullptr, false);

for (uint32_t i=0; i < fRdfDescriptor->FeatureCount; ++i)
{
@@ -1534,7 +1548,7 @@ public:
}

// set identifier string
CarlaString identifier("V2/");
CarlaString identifier("LV2/");
identifier += uri;

// load settings


+ 1
- 5
source/discovery/Makefile View File

@@ -22,8 +22,7 @@ LINK_FLAGS += $(QTCORE_LIBS)
BUILD_CXX_FLAGS += -DWANT_NATIVE

ifeq ($(CARLA_PLUGIN_SUPPORT),true)
BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI
# -DWANT_LV2
BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2
# -DWANT_VST
# ifeq ($(CARLA_VESTIGE_HEADER),true)
# BUILD_CXX_FLAGS += -DVESTIGE_HEADER
@@ -101,9 +100,6 @@ win64: carla-discovery-win64.exe

# --------------------------------------------------------------

carla-discovery.mm.o: carla-discovery.mm carla-discovery.cpp
$(CXX) $< $(POSIX_BUILD_FLAGS) $(NATIVE_FLAGS) -objc++ -c -o $@

carla-discovery-native: $(OBJS) $(LIBS)
$(CXX) $^ $(POSIX_BUILD_FLAGS) $(NATIVE_FLAGS) $(POSIX_LINK_FLAGS) -o $@



+ 4
- 4
source/discovery/carla-discovery.cpp View File

@@ -17,7 +17,7 @@

#include "CarlaBackendUtils.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaString.hpp"
#include "CarlaMathUtils.hpp"
#include "CarlaMIDI.h"

#ifdef HAVE_JUCE
@@ -1109,14 +1109,14 @@ static void do_lv2_check(const char* const bundle, const bool init)
}
}

int hints = 0x0;
uint hints = 0x0;
int audioIns = 0;
int audioOuts = 0;
int midiIns = 0;
int midiOuts = 0;
int parametersIns = 0;
int parametersOuts = 0;
int programs = rdfDescriptor->PresetCount;
uint programs = rdfDescriptor->PresetCount;

for (uint32_t j=0; j < rdfDescriptor->FeatureCount; ++j)
{
@@ -1172,7 +1172,7 @@ static void do_lv2_check(const char* const bundle, const bool init)
}
}

if (rdfDescriptor->Type[1] & LV2_PLUGIN_INSTRUMENT)
if (LV2_IS_GENERATOR(rdfDescriptor->Type[0], rdfDescriptor->Type[1]))
hints |= PLUGIN_IS_SYNTH;

if (rdfDescriptor->UICount > 0)


+ 4
- 13
source/includes/lv2/atom-helpers.h View File

@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <assert.h>

#include "atom.h"
#include "atom-util.h"

#ifdef __cplusplus
extern "C" {
@@ -59,15 +59,6 @@ struct _LV2_Atom_Buffer
} LV2_Atom_Buffer;


// Pad a size to 64 bits (for LV2 atom:Sequence event sizes).
//
static inline
uint32_t lv2_atom_buffer_pad_size ( uint32_t size )
{
return (size + 7) & (~7);
}


// Clear and initialize an existing LV2 atom:Sequenece buffer.
//
static inline
@@ -163,7 +154,7 @@ bool lv2_atom_buffer_end (
LV2_Atom_Buffer_Iterator *iter, LV2_Atom_Buffer *buf )
{
iter->buf = buf;
iter->offset = lv2_atom_buffer_pad_size(lv2_atom_buffer_get_size(buf));
iter->offset = lv2_atom_pad_size(lv2_atom_buffer_get_size(buf));

return (iter->offset < buf->capacity - sizeof(LV2_Atom_Event));
}
@@ -190,7 +181,7 @@ bool lv2_atom_buffer_increment ( LV2_Atom_Buffer_Iterator *iter )
LV2_Atom_Sequence *atoms = &buf->atoms;
uint32_t size = ((LV2_Atom_Event *) ((char *)
LV2_ATOM_CONTENTS(LV2_Atom_Sequence, atoms) + iter->offset))->body.size;
iter->offset += lv2_atom_buffer_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size);
iter->offset += lv2_atom_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size);

return true;
}
@@ -242,7 +233,7 @@ bool lv2_atom_buffer_write (

memcpy(LV2_ATOM_BODY(&ev->body), data, size);

size = lv2_atom_buffer_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size);
size = lv2_atom_pad_size(uint32_t(sizeof(LV2_Atom_Event)) + size);
atoms->atom.size += size;
iter->offset += size;



+ 1
- 1
source/includes/lv2/atom-util.h View File

@@ -41,7 +41,7 @@ extern "C" {
static inline uint32_t
lv2_atom_pad_size(uint32_t size)
{
return (size + 7) & (~7);
return uint32_t(int32_t(size + 7) & (~7));
}

/** Return the total size of @p atom, including the header. */


+ 5
- 5
source/modules/lilv/lilv-0.16.0/lilv/lilvmm.hpp View File

@@ -302,19 +302,19 @@ struct World {
inline World() : me(lilv_world_new()) {}
inline ~World() { lilv_world_free(me); }

inline LilvNode* new_uri(const char* uri) {
inline LilvNode* new_uri(const char* uri) const {
return lilv_new_uri(me, uri);
}
inline LilvNode* new_string(const char* str) {
inline LilvNode* new_string(const char* str) const {
return lilv_new_string(me, str);
}
inline LilvNode* new_int(int val) {
inline LilvNode* new_int(int val) const {
return lilv_new_int(me, val);
}
inline LilvNode* new_float(float val) {
inline LilvNode* new_float(float val) const {
return lilv_new_float(me, val);
}
inline LilvNode* new_bool(bool val) {
inline LilvNode* new_bool(bool val) const {
return lilv_new_bool(me, val);
}
inline Nodes find_nodes(const LilvNode* subject,


+ 7
- 12
source/utils/CarlaLv2Utils.hpp View File

@@ -331,7 +331,7 @@ public:
return lv2World;
}

const LilvPlugin* getPlugin(const LV2_URI uri) /*const*/
const LilvPlugin* getPlugin(const LV2_URI uri) const
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);

@@ -363,7 +363,7 @@ public:
return cPlugin;
}

const LilvState* getState(const LV2_URI uri, const LV2_URID_Map* const uridMap) /*const*/
const LilvState* getState(const LV2_URI uri, const LV2_URID_Map* const uridMap) const
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);
CARLA_SAFE_ASSERT_RETURN(uridMap != nullptr, nullptr);
@@ -1254,7 +1254,6 @@ bool is_lv2_feature_supported(const LV2_URI uri)
// TODO
return false;

#ifndef BRIDGE_LV2
if (std::strcmp(uri, LV2_CORE__hardRTCapable) == 0)
return true;
if (std::strcmp(uri, LV2_CORE__inPlaceBroken) == 0)
@@ -1269,35 +1268,28 @@ bool is_lv2_feature_supported(const LV2_URI uri)
return true;
if (std::strcmp(uri, LV2_EVENT_URI) == 0)
return true;
#endif
if (std::strcmp(uri, LV2_LOG__log) == 0)
return true;
if (std::strcmp(uri, LV2_OPTIONS__options) == 0)
return true;
if (std::strcmp(uri, LV2_PROGRAMS__Host) == 0)
return true;
#ifndef BRIDGE_LV2
if (std::strcmp(uri, LV2_RTSAFE_MEMORY_POOL__Pool) == 0)
return true;
#endif
if (std::strcmp(uri, LV2_STATE__makePath) == 0)
return true;
if (std::strcmp(uri, LV2_STATE__mapPath) == 0)
return true;
#ifndef BRIDGE_LV2
if (std::strcmp(uri, LV2_PORT_PROPS__supportsStrictBounds) == 0)
return true;
#endif
if (std::strcmp(uri, LV2_URI_MAP_URI) == 0)
return true;
if (std::strcmp(uri, LV2_URID__map) == 0)
return true;
if (std::strcmp(uri, LV2_URID__unmap) == 0)
return true;
#ifndef BRIDGE_LV2
if (std::strcmp(uri, LV2_WORKER__schedule) == 0)
return false; // TODO
#endif
return true;
return false;
}

@@ -1307,7 +1299,10 @@ bool is_lv2_feature_supported(const LV2_URI uri)
static inline
bool is_lv2_ui_feature_supported(const LV2_URI uri)
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', false);

// TODO
return false;

if (is_lv2_feature_supported(uri))
return true;


Loading…
Cancel
Save