This commit is contained in:
Gordon JC Pearce 2024-09-09 14:05:43 +01:00
parent af49dcf7b6
commit f8d07cfa3d
4 changed files with 34 additions and 14 deletions

View File

@ -39,8 +39,8 @@ void Chassis::activate() {
// calculate filter coefficients and stuff
printf("called activate()\n");
for (uint8_t i=0; i<104; i++) {
s.pitchCV[i] = (261.63 * powf(2, (i-24) / 12.0f)) / sampleRate;
for (uint8_t i = 0; i < 104; i++) {
s.pitchCV[i] = (261.63 * powf(2, (i - 24) / 12.0f)) / sampleRate;
}
}
@ -132,13 +132,17 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
for (uint32_t i = 0; i < NUM_VOICES; i++) {
s.voice[i].calcPitch(s);
switch(s.patchRam.switch1 & 0x03) {
case 1: s.voice[i].omega /= 4; break;
case 2: s.voice[i].omega /= 2;
default: break;
}
switch (s.patchRam.switch1 & 0x03) {
case 1:
s.voice[i].omega /= 4;
break;
case 2:
s.voice[i].omega /= 2;
default:
break;
}
//printf("voice %d note = %02x ff71 = %04x\n",i, s.voice[i].note, s.voice[i].ff71 );
// printf("voice %d note = %02x ff71 = %04x\n",i, s.voice[i].note, s.voice[i].ff71 );
s.voice[i].gate(s);
}
}

View File

@ -61,6 +61,8 @@ class Chassis : public Plugin {
paramSustain,
paramRelease,
paramModWheel,
parameterCount
};

View File

@ -244,6 +244,16 @@ void Chassis::initParameter(uint32_t index, Parameter &parameter) {
parameter.ranges.def = 40.0f;
parameter.midiCC = 26;
break;
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;
}
// chorus, porta, bend range, key mode still to do
}
@ -265,7 +275,7 @@ void Chassis::setParameterValue(uint32_t index, float value) {
s.patchRam.vcoLfo = value;
break;
case paramPWMLFO:
s.patchRam.pwmLfo = value/1.27;
s.patchRam.pwmLfo = value / 1.27;
break;
case paramSub:
s.patchRam.sub = value;
@ -307,7 +317,6 @@ void Chassis::setParameterValue(uint32_t index, float value) {
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
@ -347,6 +356,10 @@ void Chassis::setParameterValue(uint32_t index, float value) {
s.patchRam.switch2 &= 0xf3;
s.patchRam.switch2 |= (int)value << 2;
break;
case paramModWheel:
s.ff64 = (int)value << 1;
break;
}
}

View File

@ -34,7 +34,7 @@ class Voice {
void run(Synth &s, float *buffer, uint32_t samples);
void gate(Synth &s);
void calcPitch(Synth &s);
uint16_t ff71 = 0; // stores pitch + fraction
uint16_t ff71 = 0; // stores pitch + fraction
float omega;
@ -107,6 +107,7 @@ class Synth {
uint32_t framesLeft = 0;
bool keyon;
uint8_t ff63 = 0;
// RAM from ff00h to ffffh is cleared to zero
// this is in the startup routine at 0280h
@ -120,9 +121,9 @@ class Synth {
uint16_t ff56 = 0; // LFO Delay envelope
uint16_t ff5a = 0; // LFO Delay holdoff
uint8_t ff64 = 0; // LFO mod sens amount
uint8_t ff6e = 0; // fractional pitch temp
uint8_t ff6e = 0; // fractional pitch temp
uint16_t ff6f = 0; // computed pitch amount
//uint16_t ff71 = 0; // unsure, to do with pitch
// uint16_t ff71 = 0; // unsure, to do with pitch
// okay, not the greatest, this right here
// this struct contains the bytes that make up a Juno 106 patch in
@ -184,7 +185,7 @@ class Synth {
0x0b18, 0x0b7c, 0x0be0, 0x0c58, 0x0cd0, 0x0d48, 0x0dde, 0x0e74, 0x0f0a,
0x0fa0, 0x1000};
uint16_t attackTable[128] = {
uint16_t attackTable[128] = {
0x4000, 0x2000, 0x1000, 0x0aaa, 0x0800, 0x0666, 0x0555, 0x0492, 0x0400,
0x038e, 0x0333, 0x02e9, 0x02ab, 0x0276, 0x0249, 0x0222, 0x0200, 0x01e2,
0x01c7, 0x01af, 0x0199, 0x0186, 0x0174, 0x0164, 0x0155, 0x0148, 0x013b,