Added code to copy the UI control data into the plugin.

lv2
Elliott Liggett 2021-08-08 00:37:03 -07:00
rodzic 42dc2439e0
commit 5447af6225
2 zmienionych plików z 32 dodań i 3 usunięć

Wyświetl plik

@ -351,6 +351,7 @@ void audioPlugin::runPlugin(int samples)
convertInputBuffer();
copyControlsToPluginInterface();
lilv_instance_run(instance, inputBufferSampleCount);
convertOutputBuffer();
@ -380,7 +381,33 @@ void audioPlugin::handleAdjustedPluginControls(controlsType control)
// Access the local vector of controls, called "controls".
// Alter the control->controlsIndex member to have equal value.
(void)control;
if(control.controlsIndex <= (unsigned int)controls.size())
{
controls[control.controlsIndex].value = control.value;
} else {
emit pluginErrorMessage(QString("Error in plugin [%1]: Asked to adjust control at index %2 when the max index is %3.")\
.arg(pluginNameAsQString)\
.arg(control.controlsIndex)\
.arg(controls.size()));
}
}
void audioPlugin::copyControlsToPluginInterface()
{
// Haven't figured out exactly how to do this one yet. Something like this:
// Loop across all ports, modify if matching index.
// Should I have used the n_params variable here instead of portIndex?
// I have assumed that "value" is the control value.
controlsType c;
for(int i=0; i < controls.size(); i++)
{
c = controls.at(i);
this->ports[ c.portIndex ].value = c.value;
}
}
void audioPlugin::convertInputBuffer()

Wyświetl plik

@ -94,10 +94,12 @@ public slots:
void getPluginControlPorts();
void handleAdjustedPluginControls(controlsType control);
// These functions are not complete yet:
void selectPluginByName(QString pluginName);
void selectPluginByLabel(QString pluginLabel);
void selectPluginByID(int pluginId);
void debugThis();
void debugThis(); // nice debug info here
private:
pluginType kind;
@ -146,7 +148,7 @@ private:
void createControls();
void deleteControls();
void copyControls();
void copyControlsToPluginInterface();
bool activatePlugin();
// Plugin world items: