From 3f63138b85fc3cc69fe877635384cd80273a784b Mon Sep 17 00:00:00 2001 From: Gordon JC Pearce Date: Sun, 8 Sep 2024 22:21:03 +0100 Subject: [PATCH] all current parameters can be set --- plugin/parameters.cpp | 81 ++++++++++++++++++++++++++++++++----------- plugin/voice.hpp | 2 +- 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/plugin/parameters.cpp b/plugin/parameters.cpp index 6c13d2d..12555ed 100644 --- a/plugin/parameters.cpp +++ b/plugin/parameters.cpp @@ -16,7 +16,6 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #include "chassis.hpp" void Chassis::initParameter(uint32_t index, Parameter ¶meter) { @@ -246,9 +245,9 @@ void Chassis::initParameter(uint32_t index, Parameter ¶meter) { parameter.midiCC = 26; break; } + // chorus, porta, bend range, key mode still to do } - void Chassis::setParameterValue(uint32_t index, float value) { // should be trapped by host, but let's be safe if (value < 0.0f) value = 0.0f; @@ -262,31 +261,39 @@ void Chassis::setParameterValue(uint32_t index, float value) { s.patchRam.lfoDelay = value; break; - case paramVCORange: - // bits 0-2 of switch 1 - // doesn't look great in Carla because of odd behaviour with small integer knobs - s.patchRam.switch1 &= 0xf8; - s.patchRam.switch1 |= (1 << (int)value); - break; - case paramVCOLFO: s.patchRam.vcoLfo = value; break; case paramPWMLFO: s.patchRam.pwmLfo = value; break; - - case paramSaw: - s.patchRam.switch1 &= 0xef; - s.patchRam.switch1 |= (value > 63) << 4; - break; - case paramSqr: - s.patchRam.switch1 &= 0xf7; - s.patchRam.switch1 |= (value > 63) << 3; - break; case paramSub: s.patchRam.sub = value; break; + case paramNoise: + s.patchRam.noise = value; + break; + + case paramVCFFreq: + s.patchRam.vcfFreq = value; + break; + case paramVCFReso: + s.patchRam.vcfReso = value; + break; + case paramVCFEnv: + s.patchRam.vcfEnv = value; + break; + case paramVCFLFO: + s.patchRam.vcfLfo = value; + break; + case paramVCFKey: + s.patchRam.vcfKey = value; + break; + + case paramVCALevel: + s.patchRam.vca = value; + break; + case paramAttack: s.patchRam.env_a = value; break; @@ -299,12 +306,46 @@ void Chassis::setParameterValue(uint32_t index, float value) { case paramRelease: s.patchRam.env_r = value; break; + + + // switch 1 params + case paramVCORange: // bits 0-2 of switch 1 + // doesn't look great in Carla because of odd behaviour with small integer knobs + s.patchRam.switch1 &= 0xf8; + s.patchRam.switch1 |= (1 << (int)value); + break; + case paramSqr: // bit 3 of switch 1 + s.patchRam.switch1 &= 0xf7; + s.patchRam.switch1 |= (value > 63) << 3; + break; + + case paramSaw: // bit 4 of switch 1 + s.patchRam.switch1 &= 0xef; + s.patchRam.switch1 |= (value > 63) << 4; + break; + + // missing chorus switch + + // switch 2 params + case paramPWMMode: // bit 0 of switch 2 + s.patchRam.switch2 &= 0xfe; + s.patchRam.switch2 |= (value > 63); + break; + + case paramVCFMode: // bit 1 of switch 2 + s.patchRam.switch2 &= 0xfd; + s.patchRam.switch2 |= (value > 63) << 1; + break; case paramEnvGate: s.patchRam.switch2 &= 0xfb; s.patchRam.switch2 |= (value > 63) << 2; break; - case paramVCALevel: - s.patchRam.vca = value; + + case paramHPF: // bits 3-4 of switch 2 + // doesn't look great in Carla because of odd behaviour with small integer knobs + if (value > 3) value = 3; + s.patchRam.switch2 &= 0xf3; + s.patchRam.switch2 |= (int)value << 2; break; } } diff --git a/plugin/voice.hpp b/plugin/voice.hpp index 6d64506..cc55dc5 100644 --- a/plugin/voice.hpp +++ b/plugin/voice.hpp @@ -129,7 +129,7 @@ class Synth { uint8_t pwmLfo = 55; uint8_t noise = 0; uint8_t vcfFreq = 85; - uint8_t vcfResp = 0; + uint8_t vcfReso = 0; uint8_t vcfEnv = 0; uint8_t vcfLfo = 0; uint8_t vcfKey = 108;