2024-09-08 20:55:46 +00:00
|
|
|
/*
|
|
|
|
Chassis polysynth framework
|
|
|
|
|
|
|
|
Copyright 2024 Gordon JC Pearce <gordonjcp@gjcp.net>
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "chassis.hpp"
|
|
|
|
|
2024-09-11 22:25:41 +00:00
|
|
|
void Chassis::initParameter(uint32_t index, Parameter& parameter) {
|
2024-09-08 20:55:46 +00:00
|
|
|
switch (index) {
|
|
|
|
case paramLFORate:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "LFO Rate";
|
|
|
|
parameter.symbol = "ch_lforate";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 48.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramLFODelay:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "LFO Delay";
|
|
|
|
parameter.symbol = "ch_lfodelay";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 0.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 9;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramVCORange:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
|
|
|
parameter.name = "Range";
|
|
|
|
parameter.symbol = "ch_vcorange";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.max = 2.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 12;
|
2024-09-11 22:25:41 +00:00
|
|
|
parameter.enumValues.count = 3;
|
|
|
|
parameter.enumValues.restrictedMode = true;
|
|
|
|
{
|
|
|
|
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[3];
|
|
|
|
enumValues[0].value = 0.0f;
|
|
|
|
enumValues[0].label = "16'";
|
|
|
|
enumValues[1].value = 1.0f;
|
|
|
|
enumValues[1].label = "8'";
|
|
|
|
enumValues[2].value = 2.0f;
|
|
|
|
enumValues[2].label = "4'";
|
|
|
|
parameter.enumValues.values = enumValues;
|
|
|
|
}
|
|
|
|
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case paramVCOLFO:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "LFO";
|
|
|
|
parameter.symbol = "ch_lfo";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 10.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 13;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramPWMLFO:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "PWM";
|
|
|
|
parameter.symbol = "ch_pwm";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 48.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 14;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramPWMMode:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
2024-09-10 13:57:56 +00:00
|
|
|
parameter.name = "PWM Mode";
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.symbol = "ch_pwmmode";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.max = 1.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 15;
|
2024-09-11 22:25:41 +00:00
|
|
|
parameter.enumValues.count = 2;
|
|
|
|
parameter.enumValues.restrictedMode = true;
|
|
|
|
{
|
|
|
|
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2];
|
|
|
|
enumValues[0].value = 0.0f;
|
|
|
|
enumValues[0].label = "LFO";
|
|
|
|
enumValues[1].value = 1.0f;
|
|
|
|
enumValues[1].label = "MAN";
|
|
|
|
parameter.enumValues.values = enumValues;
|
|
|
|
}
|
|
|
|
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case paramSaw:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
|
|
|
parameter.name = "Saw";
|
|
|
|
parameter.symbol = "ch_saw";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.max = 1.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 17;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramSqr:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
|
|
|
parameter.name = "Square";
|
|
|
|
parameter.symbol = "ch_sqr";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.max = 1.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 16;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramSub:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Sub Osc";
|
|
|
|
parameter.symbol = "ch_sub";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
|
|
|
parameter.ranges.def = 0.0f;
|
|
|
|
parameter.midiCC = 18;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramNoise:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Noise";
|
|
|
|
parameter.symbol = "ch_noise";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
|
|
|
parameter.ranges.def = 0.0f;
|
|
|
|
parameter.midiCC = 19;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramHPF:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
|
|
|
parameter.name = "HPF";
|
|
|
|
parameter.symbol = "ch_hpf";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-12 14:10:16 +00:00
|
|
|
parameter.ranges.max = 3.9f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.ranges.def = 0.0f;
|
|
|
|
parameter.midiCC = 20;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramVCFFreq:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Freq";
|
|
|
|
parameter.symbol = "ch_freq";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 60.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 74;
|
|
|
|
break;
|
|
|
|
case paramVCFReso:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Res";
|
|
|
|
parameter.symbol = "ch_reso";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
|
|
|
parameter.ranges.def = 0.0f;
|
2024-09-09 15:31:43 +00:00
|
|
|
parameter.midiCC = 71;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
|
|
|
case paramVCFMode:
|
2024-09-11 22:25:41 +00:00
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.name = "Polarity";
|
|
|
|
parameter.symbol = "ch_vcfmode";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.max = 1.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 21;
|
2024-09-11 22:25:41 +00:00
|
|
|
parameter.enumValues.count = 2;
|
|
|
|
parameter.enumValues.restrictedMode = true;
|
|
|
|
{
|
|
|
|
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2];
|
|
|
|
enumValues[0].value = 0.0f;
|
|
|
|
enumValues[0].label = "POS";
|
|
|
|
enumValues[1].value = 1.0f;
|
|
|
|
enumValues[1].label = "INV";
|
|
|
|
parameter.enumValues.values = enumValues;
|
|
|
|
}
|
|
|
|
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
|
|
|
case paramVCFEnv:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Env";
|
|
|
|
parameter.symbol = "ch_vcfenv";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 46.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 22;
|
|
|
|
break;
|
|
|
|
case paramVCFLFO:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "LFO";
|
|
|
|
parameter.symbol = "ch_vcflfo";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
|
|
|
parameter.ranges.def = 0.0f;
|
|
|
|
parameter.midiCC = 23;
|
|
|
|
break;
|
|
|
|
case paramVCFKey:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Kybd";
|
|
|
|
parameter.symbol = "ch_vcfkey";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 71.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 24;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramAttack:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Attack";
|
|
|
|
parameter.symbol = "ch_attack";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 27.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 73;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramDecay:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Decay";
|
|
|
|
parameter.symbol = "ch_decay";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 57.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 75;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramSustain:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Sustain";
|
|
|
|
parameter.symbol = "ch_sustain";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 57.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 27;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramRelease:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "Release";
|
|
|
|
parameter.symbol = "ch_release";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.def = 48.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 72;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramEnvGate:
|
2024-09-11 22:25:41 +00:00
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsInteger; // | kParameterIsBoolean;
|
2024-09-10 13:57:56 +00:00
|
|
|
parameter.name = "Env-Gate";
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.symbol = "ch_envgate";
|
|
|
|
parameter.ranges.min = 0.0f;
|
2024-09-11 20:40:11 +00:00
|
|
|
parameter.ranges.max = 1.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
2024-09-08 20:55:46 +00:00
|
|
|
parameter.midiCC = 25;
|
2024-09-11 22:25:41 +00:00
|
|
|
parameter.enumValues.count = 2;
|
|
|
|
parameter.enumValues.restrictedMode = true;
|
|
|
|
{
|
|
|
|
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2];
|
|
|
|
enumValues[0].value = 0.0f;
|
|
|
|
enumValues[0].label = "ENV";
|
|
|
|
enumValues[1].value = 1.0f;
|
|
|
|
enumValues[1].label = "GATE";
|
|
|
|
parameter.enumValues.values = enumValues;
|
|
|
|
}
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case paramVCALevel:
|
|
|
|
parameter.hints = kParameterIsAutomatable;
|
|
|
|
parameter.name = "VCA Level";
|
|
|
|
parameter.symbol = "ch_vcalevel";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
|
|
|
parameter.ranges.def = 40.0f;
|
|
|
|
parameter.midiCC = 26;
|
|
|
|
break;
|
2024-09-09 13:05:43 +00:00
|
|
|
|
2024-09-19 21:33:25 +00:00
|
|
|
case paramChorusMode:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
|
|
|
parameter.name = "Chorus";
|
|
|
|
parameter.symbol = "ch_chorusmode";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 2.0f;
|
|
|
|
parameter.ranges.def = 1.0f;
|
|
|
|
parameter.midiCC = 93;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramPolyMode:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
|
|
|
parameter.name = "Poly";
|
|
|
|
parameter.symbol = "ch_poly";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 2.0f;
|
|
|
|
parameter.ranges.def = 0.0f;
|
|
|
|
parameter.midiCC = 86;
|
|
|
|
parameter.enumValues.count = 3;
|
|
|
|
parameter.enumValues.restrictedMode = true;
|
|
|
|
{
|
|
|
|
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[3];
|
|
|
|
enumValues[0].value = 0.0f;
|
|
|
|
enumValues[0].label = "16'";
|
|
|
|
enumValues[1].value = 1.0f;
|
|
|
|
enumValues[1].label = "8'";
|
|
|
|
enumValues[2].value = 2.0f;
|
|
|
|
enumValues[2].label = "4'";
|
|
|
|
parameter.enumValues.values = enumValues;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-09 13:05:43 +00:00
|
|
|
case paramModWheel:
|
|
|
|
parameter.hints = kParameterIsAutomatable | kParameterIsHidden;
|
|
|
|
parameter.name = "Mod wheel";
|
|
|
|
parameter.symbol = "ch_modwheel";
|
|
|
|
parameter.ranges.min = 0.0f;
|
|
|
|
parameter.ranges.max = 127.0f;
|
|
|
|
parameter.ranges.def = 0.0f;
|
|
|
|
parameter.midiCC = 1;
|
|
|
|
break;
|
2024-09-08 20:55:46 +00:00
|
|
|
}
|
2024-09-08 21:21:03 +00:00
|
|
|
// chorus, porta, bend range, key mode still to do
|
2024-09-08 20:55:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
if (value > 127.0f) value = 127.0f;
|
|
|
|
|
|
|
|
switch (index) {
|
|
|
|
case paramLFORate:
|
|
|
|
s.patchRam.lfoRate = value;
|
|
|
|
break;
|
|
|
|
case paramLFODelay:
|
|
|
|
s.patchRam.lfoDelay = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case paramVCOLFO:
|
|
|
|
s.patchRam.vcoLfo = value;
|
|
|
|
break;
|
|
|
|
case paramPWMLFO:
|
2024-09-09 13:05:43 +00:00
|
|
|
s.patchRam.pwmLfo = value / 1.27;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
2024-09-08 21:21:03 +00:00
|
|
|
case paramSub:
|
|
|
|
s.patchRam.sub = value;
|
|
|
|
break;
|
|
|
|
case paramNoise:
|
|
|
|
s.patchRam.noise = value;
|
|
|
|
break;
|
2024-09-08 20:55:46 +00:00
|
|
|
|
2024-09-08 21:21:03 +00:00
|
|
|
case paramVCFFreq:
|
|
|
|
s.patchRam.vcfFreq = value;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
2024-09-08 21:21:03 +00:00
|
|
|
case paramVCFReso:
|
|
|
|
s.patchRam.vcfReso = value;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
2024-09-08 21:21:03 +00:00
|
|
|
case paramVCFEnv:
|
|
|
|
s.patchRam.vcfEnv = value;
|
|
|
|
break;
|
|
|
|
case paramVCFLFO:
|
|
|
|
s.patchRam.vcfLfo = value;
|
|
|
|
break;
|
|
|
|
case paramVCFKey:
|
|
|
|
s.patchRam.vcfKey = value;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
2024-09-08 21:21:03 +00:00
|
|
|
|
|
|
|
case paramVCALevel:
|
|
|
|
s.patchRam.vca = value;
|
|
|
|
break;
|
|
|
|
|
2024-09-08 20:55:46 +00:00
|
|
|
case paramAttack:
|
|
|
|
s.patchRam.env_a = value;
|
|
|
|
break;
|
|
|
|
case paramDecay:
|
|
|
|
s.patchRam.env_d = value;
|
|
|
|
break;
|
|
|
|
case paramSustain:
|
|
|
|
s.patchRam.env_s = value;
|
|
|
|
break;
|
|
|
|
case paramRelease:
|
|
|
|
s.patchRam.env_r = value;
|
|
|
|
break;
|
2024-09-08 21:21:03 +00:00
|
|
|
|
|
|
|
// 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;
|
2024-09-11 22:25:41 +00:00
|
|
|
s.patchRam.switch1 |= (1 << (int)(value - 1));
|
2024-09-08 21:21:03 +00:00
|
|
|
break;
|
|
|
|
case paramSqr: // bit 3 of switch 1
|
|
|
|
s.patchRam.switch1 &= 0xf7;
|
2024-09-11 22:25:41 +00:00
|
|
|
s.patchRam.switch1 |= (value >= 0.5) << 3;
|
2024-09-08 21:21:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case paramSaw: // bit 4 of switch 1
|
|
|
|
s.patchRam.switch1 &= 0xef;
|
2024-09-11 22:25:41 +00:00
|
|
|
s.patchRam.switch1 |= (value >= 0.5) << 4;
|
2024-09-08 21:21:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// missing chorus switch
|
|
|
|
|
|
|
|
// switch 2 params
|
|
|
|
case paramPWMMode: // bit 0 of switch 2
|
|
|
|
s.patchRam.switch2 &= 0xfe;
|
2024-09-11 22:25:41 +00:00
|
|
|
s.patchRam.switch2 |= (value >= 0.5);
|
2024-09-08 21:21:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case paramVCFMode: // bit 1 of switch 2
|
|
|
|
s.patchRam.switch2 &= 0xfd;
|
2024-09-11 22:25:41 +00:00
|
|
|
s.patchRam.switch2 |= (value >= 0.5) << 1;
|
2024-09-08 21:21:03 +00:00
|
|
|
break;
|
2024-09-08 20:55:46 +00:00
|
|
|
case paramEnvGate:
|
|
|
|
s.patchRam.switch2 &= 0xfb;
|
2024-09-11 22:25:41 +00:00
|
|
|
s.patchRam.switch2 |= (value >= 0.5) << 2;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
2024-09-08 21:21:03 +00:00
|
|
|
|
|
|
|
case paramHPF: // bits 3-4 of switch 2
|
|
|
|
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
2024-09-12 14:10:16 +00:00
|
|
|
printf("setPV %d %f\n", index, value);
|
2024-09-08 21:21:03 +00:00
|
|
|
if (value > 3) value = 3;
|
2024-09-12 14:10:16 +00:00
|
|
|
s.patchRam.switch2 &= 0xe7;
|
2024-09-19 21:33:25 +00:00
|
|
|
s.patchRam.switch2 |= (3 - (int)value) << 3;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
2024-09-09 13:05:43 +00:00
|
|
|
|
|
|
|
case paramModWheel:
|
|
|
|
s.ff64 = (int)value << 1;
|
|
|
|
break;
|
2024-09-19 21:33:25 +00:00
|
|
|
case paramPolyMode:
|
|
|
|
s.polymode = (int)value;
|
|
|
|
break;
|
2024-09-08 20:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float Chassis::getParameterValue(uint32_t index) const {
|
|
|
|
switch (index) {
|
2024-09-10 13:57:56 +00:00
|
|
|
case paramLFORate:
|
|
|
|
return s.patchRam.lfoRate;
|
|
|
|
break;
|
|
|
|
case paramLFODelay:
|
|
|
|
return s.patchRam.lfoDelay;
|
|
|
|
break;
|
|
|
|
case paramVCORange:
|
|
|
|
// FIXME this needs to be better generally
|
2024-09-11 20:40:11 +00:00
|
|
|
switch (s.patchRam.switch1 & 0x07) {
|
2024-09-11 22:25:41 +00:00
|
|
|
case 1:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
return 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 1;
|
2024-09-11 20:40:11 +00:00
|
|
|
}
|
2024-09-10 13:57:56 +00:00
|
|
|
break;
|
|
|
|
case paramVCOLFO:
|
|
|
|
return s.patchRam.vcoLfo;
|
|
|
|
break;
|
|
|
|
case paramPWMLFO:
|
|
|
|
return s.patchRam.pwmLfo * 1.27f;
|
|
|
|
break;
|
2024-09-11 22:25:41 +00:00
|
|
|
|
2024-09-10 13:57:56 +00:00
|
|
|
case paramPWMMode:
|
2024-09-11 22:25:41 +00:00
|
|
|
return (s.patchRam.switch2 & 0x01) != 0;
|
2024-09-10 13:57:56 +00:00
|
|
|
break;
|
2024-09-08 20:55:46 +00:00
|
|
|
case paramSaw:
|
2024-09-11 22:25:41 +00:00
|
|
|
return (s.patchRam.switch1 & 0x10) != 0;
|
2024-09-08 20:55:46 +00:00
|
|
|
break;
|
|
|
|
case paramSqr:
|
2024-09-11 22:25:41 +00:00
|
|
|
return (s.patchRam.switch1 & 0x08) != 0;
|
2024-09-10 13:57:56 +00:00
|
|
|
|
|
|
|
case paramSub:
|
|
|
|
return s.patchRam.sub;
|
|
|
|
break;
|
|
|
|
case paramNoise:
|
|
|
|
return s.patchRam.noise;
|
|
|
|
break;
|
|
|
|
case paramHPF:
|
2024-09-19 21:33:25 +00:00
|
|
|
return 3 - ((s.patchRam.switch2 & 0x18) >> 3);
|
2024-09-10 13:57:56 +00:00
|
|
|
break;
|
|
|
|
case paramVCFFreq:
|
|
|
|
return s.patchRam.vcfFreq;
|
|
|
|
break;
|
|
|
|
case paramVCFReso:
|
|
|
|
return s.patchRam.vcfReso;
|
|
|
|
break;
|
|
|
|
case paramVCFEnv:
|
|
|
|
return s.patchRam.vcfEnv;
|
|
|
|
break;
|
|
|
|
case paramVCFLFO:
|
|
|
|
return s.patchRam.vcfLfo;
|
|
|
|
break;
|
|
|
|
case paramVCFKey:
|
|
|
|
return s.patchRam.vcfKey;
|
|
|
|
break;
|
|
|
|
case paramVCFMode:
|
2024-09-11 22:25:41 +00:00
|
|
|
return (s.patchRam.switch2 & 0x02) != 0;
|
2024-09-10 13:57:56 +00:00
|
|
|
break;
|
|
|
|
|
2024-09-08 20:55:46 +00:00
|
|
|
case paramAttack:
|
|
|
|
return s.patchRam.env_a;
|
|
|
|
break;
|
|
|
|
case paramDecay:
|
|
|
|
return s.patchRam.env_d;
|
|
|
|
break;
|
|
|
|
case paramSustain:
|
|
|
|
return s.patchRam.env_s;
|
|
|
|
break;
|
|
|
|
case paramRelease:
|
|
|
|
return s.patchRam.env_r;
|
|
|
|
break;
|
2024-09-10 13:57:56 +00:00
|
|
|
|
|
|
|
case paramEnvGate:
|
2024-09-11 22:25:41 +00:00
|
|
|
return (s.patchRam.switch2 & 0x04) != 0;
|
2024-09-10 13:57:56 +00:00
|
|
|
|
|
|
|
case paramVCALevel:
|
|
|
|
return s.patchRam.vca;
|
|
|
|
break;
|
2024-09-08 20:55:46 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|