removed a lot of debugging printfs
This commit is contained in:
parent
3980a1c966
commit
1c8f451c3a
@ -40,7 +40,7 @@ void Chassis::initProgramName(uint32_t index, String &programName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::loadProgram(uint32_t index) {
|
void Chassis::loadProgram(uint32_t index) {
|
||||||
memmove(&s.patchRam, (uint8_t *)patchData + (index *18), 18);
|
memmove(&s.patchRam, (uint8_t *)patchData + (index * 18), 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Processing functions
|
// Processing functions
|
||||||
@ -49,8 +49,6 @@ void Chassis::activate() {
|
|||||||
// calculate filter coefficients and stuff
|
// calculate filter coefficients and stuff
|
||||||
printf("called activate()\n");
|
printf("called activate()\n");
|
||||||
|
|
||||||
// printf("p = %s", patchName[0].c_str());
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 104; i++) {
|
for (uint8_t i = 0; i < 104; i++) {
|
||||||
s.pitchCV[i] = (440.0f * powf(2, (i - 49) / 12.0f)) / sampleRate;
|
s.pitchCV[i] = (440.0f * powf(2, (i - 49) / 12.0f)) / sampleRate;
|
||||||
}
|
}
|
||||||
@ -59,7 +57,6 @@ void Chassis::activate() {
|
|||||||
void Chassis::deactivate() {
|
void Chassis::deactivate() {
|
||||||
// zero out the outputs, maybe
|
// zero out the outputs, maybe
|
||||||
printf("called deactivate()\n");
|
printf("called deactivate()\n");
|
||||||
// printf("%02x", assign[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::noteOn(uint8_t note) {
|
void Chassis::noteOn(uint8_t note) {
|
||||||
@ -69,10 +66,8 @@ void Chassis::noteOn(uint8_t note) {
|
|||||||
vPtr++;
|
vPtr++;
|
||||||
if (vPtr == NUM_VOICES) vPtr = 0;
|
if (vPtr == NUM_VOICES) vPtr = 0;
|
||||||
if (s.voice[vPtr].isFree()) {
|
if (s.voice[vPtr].isFree()) {
|
||||||
// printf("voice %d is free, existing note = %d, note = %d\n", vPtr, s.voice[i].note, note);
|
|
||||||
// if it's an existing note don't reset
|
// if it's an existing note don't reset
|
||||||
s.voice[vPtr].on(note, s.voice[i].note != note);
|
s.voice[vPtr].on(note, s.voice[i].note != note);
|
||||||
// printf("note on %d for voice %d\n", note, vPtr);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,23 +80,19 @@ void Chassis::noteOn(uint8_t note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::noteOff(uint8_t note) {
|
void Chassis::noteOff(uint8_t note) {
|
||||||
// printf("noteoff %d\n", note);
|
|
||||||
s.keyon = false;
|
s.keyon = false;
|
||||||
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||||
if (s.voice[i].note == note && !s.voice[i].isFree()) {
|
if (s.voice[i].note == note && !s.voice[i].isFree()) {
|
||||||
s.voice[i].off();
|
s.voice[i].off();
|
||||||
// printf("note off %d for voice %d\n", note, i);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::doMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) {
|
void Chassis::doMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) {
|
||||||
// printf("doMidi() handling events from %d to %d\n", lastEvent, timeLimit);
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
for (i = lastEvent; i < count; i++) {
|
for (i = lastEvent; i < count; i++) {
|
||||||
// printf("doMidi event number %d of %d %02x %02x\n", i, count, ev[i].data[0], ev[i].data[1]);
|
|
||||||
if (ev[i].frame > timeLimit) break;
|
if (ev[i].frame > timeLimit) break;
|
||||||
switch (ev[i].data[0]) {
|
switch (ev[i].data[0]) {
|
||||||
case 0x90:
|
case 0x90:
|
||||||
@ -116,14 +107,10 @@ void Chassis::doMidi(const MidiEvent *ev, uint32_t count, uint32_t timeLimit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) {
|
void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEvent *midiEvents, uint32_t midiEventCount) {
|
||||||
// if (midiEventCount > 0) printf("\n--------------------\n");
|
|
||||||
|
|
||||||
uint32_t framePos = 0;
|
uint32_t framePos = 0;
|
||||||
uint32_t sizeThisTime;
|
uint32_t sizeThisTime;
|
||||||
s.framesLeft = frames;
|
s.framesLeft = frames;
|
||||||
|
|
||||||
// printf("\n------------\ncalled run() for %d frames\n",frames);
|
|
||||||
|
|
||||||
// flatten the left channel to use as temporary storage, since
|
// flatten the left channel to use as temporary storage, since
|
||||||
// the synth engine only generates a mono channel
|
// the synth engine only generates a mono channel
|
||||||
bzero(outputs[0], sizeof(float) * frames);
|
bzero(outputs[0], sizeof(float) * frames);
|
||||||
@ -138,7 +125,6 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
|
|||||||
s.blockLeft = sampleRate / 238;
|
s.blockLeft = sampleRate / 238;
|
||||||
doMidi(midiEvents, midiEventCount, framePos + s.blockLeft);
|
doMidi(midiEvents, midiEventCount, framePos + s.blockLeft);
|
||||||
|
|
||||||
// printf("compute params and reset block size\n");
|
|
||||||
s.lfoDelay();
|
s.lfoDelay();
|
||||||
s.runLFO();
|
s.runLFO();
|
||||||
|
|
||||||
@ -155,17 +141,13 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("voice %d note = %02x ff71 = %04x\n",i, s.voice[i].note, s.voice[i].ff71 );
|
|
||||||
s.voice[i].envelope(s);
|
s.voice[i].envelope(s);
|
||||||
s.voice[i].calcFilter(s);
|
s.voice[i].calcFilter(s);
|
||||||
// printf("voice %d vcf level = %04x\n", i, s.voice[i].vcfenv );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sizeThisTime = (s.framesLeft < s.blockLeft) ? s.framesLeft : s.blockLeft;
|
sizeThisTime = (s.framesLeft < s.blockLeft) ? s.framesLeft : s.blockLeft;
|
||||||
|
|
||||||
// printf("sL = %d bL = %d, calculating %d frames at %d\n", s.framesLeft, s.blockLeft, sizeThisTime, framePos);
|
|
||||||
|
|
||||||
// run each synth voice
|
// run each synth voice
|
||||||
|
|
||||||
for (uint8_t i = 0; i < NUM_VOICES; i++) {
|
for (uint8_t i = 0; i < NUM_VOICES; i++) {
|
||||||
@ -176,7 +158,6 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
|
|||||||
s.framesLeft -= sizeThisTime;
|
s.framesLeft -= sizeThisTime;
|
||||||
s.blockLeft -= sizeThisTime;
|
s.blockLeft -= sizeThisTime;
|
||||||
}
|
}
|
||||||
// printf("and now run the rest of the process for %d frames\n\n", frames);
|
|
||||||
|
|
||||||
// copy left to right
|
// copy left to right
|
||||||
memmove(outputs[1], outputs[0], sizeof(float) * frames);
|
memmove(outputs[1], outputs[0], sizeof(float) * frames);
|
||||||
|
@ -308,8 +308,6 @@ void Chassis::setParameterValue(uint32_t index, float value) {
|
|||||||
if (value < 0.0f) value = 0.0f;
|
if (value < 0.0f) value = 0.0f;
|
||||||
if (value > 127.0f) value = 127.0f;
|
if (value > 127.0f) value = 127.0f;
|
||||||
|
|
||||||
printf("setparam %d %f\n", index, value);
|
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case paramLFORate:
|
case paramLFORate:
|
||||||
s.patchRam.lfoRate = value;
|
s.patchRam.lfoRate = value;
|
||||||
@ -393,10 +391,8 @@ void Chassis::setParameterValue(uint32_t index, float value) {
|
|||||||
s.patchRam.switch2 |= (value >= 0.5) << 1;
|
s.patchRam.switch2 |= (value >= 0.5) << 1;
|
||||||
break;
|
break;
|
||||||
case paramEnvGate:
|
case paramEnvGate:
|
||||||
//printf("setting envgate %f %02x", value, s.patchRam.switch2);
|
|
||||||
s.patchRam.switch2 &= 0xfb;
|
s.patchRam.switch2 &= 0xfb;
|
||||||
s.patchRam.switch2 |= (value >= 0.5) << 2;
|
s.patchRam.switch2 |= (value >= 0.5) << 2;
|
||||||
// printf(" set envgate %f %02x", value, s.patchRam.switch2);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case paramHPF: // bits 3-4 of switch 2
|
case paramHPF: // bits 3-4 of switch 2
|
||||||
@ -413,7 +409,6 @@ void Chassis::setParameterValue(uint32_t index, float value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float Chassis::getParameterValue(uint32_t index) const {
|
float Chassis::getParameterValue(uint32_t index) const {
|
||||||
//printf("getparametervalue %d\n", index);
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case paramLFORate:
|
case paramLFORate:
|
||||||
return s.patchRam.lfoRate;
|
return s.patchRam.lfoRate;
|
||||||
@ -492,7 +487,6 @@ float Chassis::getParameterValue(uint32_t index) const {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case paramEnvGate:
|
case paramEnvGate:
|
||||||
//printf("envgate %d\n", s.patchRam.switch2 & 0x04);
|
|
||||||
return (s.patchRam.switch2 & 0x04) != 0;
|
return (s.patchRam.switch2 & 0x04) != 0;
|
||||||
|
|
||||||
case paramVCALevel:
|
case paramVCALevel:
|
||||||
|
@ -36,13 +36,10 @@ static inline float poly3blep1(float t) {
|
|||||||
void Voice::run(Synth &s, float *buffer, uint32_t samples) {
|
void Voice::run(Synth &s, float *buffer, uint32_t samples) {
|
||||||
float y, out, t;
|
float y, out, t;
|
||||||
|
|
||||||
// 325, because it needs PW to be from 0 to 0.5
|
|
||||||
// but really the control range is limited from 0 to 100
|
|
||||||
// there's a resistor on the panel board to sprag the range
|
|
||||||
float pw = s.ff4f / 32768.0f;
|
float pw = s.ff4f / 32768.0f;
|
||||||
|
|
||||||
float fb, res = s.patchRam.vcfReso / 28.0f; // guess
|
float fb, res = s.patchRam.vcfReso / 28.0f; // guess
|
||||||
// float cut = s.patchRam.vcfFreq / 400.0f; // guess
|
|
||||||
|
|
||||||
float cut = 248.0f * (powf(2, (vcfenv - 0x1880) / 1143.0f));
|
float cut = 248.0f * (powf(2, (vcfenv - 0x1880) / 1143.0f));
|
||||||
// now radians
|
// now radians
|
||||||
@ -57,9 +54,7 @@ void Voice::run(Synth &s, float *buffer, uint32_t samples) {
|
|||||||
|
|
||||||
float gain = 0.5 * powf(2, (s.patchRam.vca / 64.0f) - 1);
|
float gain = 0.5 * powf(2, (s.patchRam.vca / 64.0f) - 1);
|
||||||
|
|
||||||
//printf("patchram.switches= %3d %3d\n", s.patchRam.switch1, s.patchRam.switch2);
|
float vcaEnv = (s.patchRam.switch2 & 0x04) ? (float)ff11 : (env / 16384.0f);
|
||||||
|
|
||||||
float vcaEnv = (s.patchRam.switch2 & 0x04) ? (float)ff11:(env / 16384.0f);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < samples; i++) {
|
for (uint32_t i = 0; i < samples; i++) {
|
||||||
y = delay;
|
y = delay;
|
||||||
|
Loading…
Reference in New Issue
Block a user