lv2 variant works in Ardour

This commit is contained in:
Gordon JC Pearce 2024-08-22 23:05:08 +01:00
parent 752f894cbd
commit 23ef788b81
3 changed files with 37 additions and 5 deletions

View File

@ -32,8 +32,7 @@
enum Parameters {
program,
mix,
paramProg,
kParameterCount
};

View File

@ -21,7 +21,7 @@
START_NAMESPACE_DISTRHO
BarrVerb::BarrVerb() : Plugin(kParameterCount, 64, 0) { // two parameters, one program, no states
BarrVerb::BarrVerb() : Plugin(kParameterCount, 64, 0) { // one parameter, 64 programs, no states
lowpass = new float[getBufferSize()];
ram = new int16_t[16384];
@ -77,6 +77,31 @@ BarrVerb::BarrVerb() : Plugin(kParameterCount, 64, 0) { // two parameters, one
// Initialisation functions
void BarrVerb::initParameter(uint32_t index, Parameter &parameter) {
if (index == paramProgram) {
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
parameter.name = "Program";
parameter.symbol = "program";
parameter.ranges.def = 20.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 64.0f;
}
}
void BarrVerb::setParameterValue(uint32_t index, float value) {
if (index == paramProgram) {
program = value;
prog_offset = (((int)value-1) & 0x3f) << 7;
}
}
float BarrVerb::getParameterValue(uint32_t index) const {
if (index == paramProgram) {
return program;
}
return 0;
}
void BarrVerb::initAudioPort(bool input, uint32_t index, AudioPort &port) {
port.groupId = kPortGroupStereo;
Plugin::initAudioPort(input, index, port);
@ -88,8 +113,8 @@ void BarrVerb::initProgramName(uint32_t index, String &programName) {
}
void BarrVerb::loadProgram(uint32_t index) {
printf("called loadProgram(%d)\n", index);
prog_offset = (index & 0x3f) << 7;
program = index + 1;
}
// Processing functions

View File

@ -26,7 +26,7 @@ START_NAMESPACE_DISTRHO
class BarrVerb : public Plugin {
public:
enum Parameters {
program,
paramProgram,
kParameterCount
};
@ -44,9 +44,16 @@ class BarrVerb : public Plugin {
// Initialisation
void initAudioPort(bool input, uint32_t index, AudioPort &port) override;
void initParameter(uint32_t index, Parameter &parameter) override;
void setParameterValue(uint32_t index, float value) override;
float getParameterValue(uint32_t index) const override;
void initProgramName(uint32_t index, String &programName) override;
void loadProgram(uint32_t index) override;
// Processing
void activate() override;
void deactivate() override;
@ -63,6 +70,7 @@ class BarrVerb : public Plugin {
int16_t *ram;
float *lowpass;
uint8_t program;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(BarrVerb);
};