diff --git a/plugin/DistrhoPluginInfo.h b/plugin/DistrhoPluginInfo.h index 95a3a43..85637f0 100644 --- a/plugin/DistrhoPluginInfo.h +++ b/plugin/DistrhoPluginInfo.h @@ -32,8 +32,7 @@ enum Parameters { - program, - mix, + paramProg, kParameterCount }; diff --git a/plugin/barrverb.cpp b/plugin/barrverb.cpp index e2aa702..3aee254 100644 --- a/plugin/barrverb.cpp +++ b/plugin/barrverb.cpp @@ -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 ¶meter) { + 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 diff --git a/plugin/barrverb.hpp b/plugin/barrverb.hpp index 3cc1f22..677e9ca 100644 --- a/plugin/barrverb.hpp +++ b/plugin/barrverb.hpp @@ -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 ¶meter) 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); };