all current parameters can be set

This commit is contained in:
Gordon JC Pearce 2024-09-08 22:21:03 +01:00
parent 3c9edede8d
commit 3f63138b85
2 changed files with 62 additions and 21 deletions

View File

@ -16,7 +16,6 @@
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "chassis.hpp"
void Chassis::initParameter(uint32_t index, Parameter &parameter) {
@ -246,9 +245,9 @@ void Chassis::initParameter(uint32_t index, Parameter &parameter) {
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;
}
}

View File

@ -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;