lv2export: expose lights as control output ports, always connect cv

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-06-01 16:17:15 +01:00
parent 848237c9c5
commit becfa5d39d
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
4 changed files with 63 additions and 45 deletions

View file

@ -105,13 +105,13 @@ struct PluginLv2 {
// FIXME for CV ports we need to detect if something is connected
for (int i=numInputs; --i >=0;)
{
if (!kCvInputs[i])
module->inputs[i].channels = 1;
// if (!kCvInputs[i])
module->inputs[i].channels = 1;
}
for (int i=numOutputs; --i >=0;)
{
if (!kCvOutputs[i])
module->outputs[i].channels = 1;
// if (!kCvOutputs[i])
module->outputs[i].channels = 1;
}
d_stdout("Loaded " SLUG " :: %i inputs, %i outputs, %i params and %i lights",
@ -130,12 +130,6 @@ struct PluginLv2 {
ports[port] = dataLocation;
}
void lv2_activate()
{
contextSet(&context);
module->onReset();
}
void lv2_run(const uint32_t sampleCount)
{
if (sampleCount == 0)
@ -171,6 +165,9 @@ struct PluginLv2 {
++args.frame;
}
for (int i=numLights; --i >=0;)
*static_cast<float*>(ports[numInputs+numOutputs+numParams+i]) = module->lights[i].getBrightness();
frameCount += sampleCount;
}
};
@ -189,11 +186,6 @@ static void lv2_connect_port(LV2_Handle instance, uint32_t port, void* dataLocat
instancePtr->lv2_connect_port(port, dataLocation);
}
static void lv2_activate(LV2_Handle instance)
{
instancePtr->lv2_activate();
}
static void lv2_run(LV2_Handle instance, uint32_t sampleCount)
{
instancePtr->lv2_run(sampleCount);
@ -219,7 +211,7 @@ static const LV2_Descriptor sLv2Descriptor = {
"urn:cardinal:" SLUG,
lv2_instantiate,
lv2_connect_port,
lv2_activate,
NULL, // activate
lv2_run,
NULL, // deactivate
lv2_cleanup,