removed a lot of debugging printfs

This commit is contained in:
Gordon JC Pearce 2024-09-11 23:30:06 +01:00
parent 3980a1c966
commit 1c8f451c3a
3 changed files with 3 additions and 33 deletions

View File

@ -49,8 +49,6 @@ void Chassis::activate() {
// calculate filter coefficients and stuff
printf("called activate()\n");
// printf("p = %s", patchName[0].c_str());
for (uint8_t i = 0; i < 104; i++) {
s.pitchCV[i] = (440.0f * powf(2, (i - 49) / 12.0f)) / sampleRate;
}
@ -59,7 +57,6 @@ void Chassis::activate() {
void Chassis::deactivate() {
// zero out the outputs, maybe
printf("called deactivate()\n");
// printf("%02x", assign[1]);
}
void Chassis::noteOn(uint8_t note) {
@ -69,10 +66,8 @@ void Chassis::noteOn(uint8_t note) {
vPtr++;
if (vPtr == NUM_VOICES) vPtr = 0;
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
s.voice[vPtr].on(note, s.voice[i].note != note);
// printf("note on %d for voice %d\n", note, vPtr);
break;
}
}
@ -85,23 +80,19 @@ void Chassis::noteOn(uint8_t note) {
}
void Chassis::noteOff(uint8_t note) {
// printf("noteoff %d\n", note);
s.keyon = false;
for (uint32_t i = 0; i < NUM_VOICES; i++) {
if (s.voice[i].note == note && !s.voice[i].isFree()) {
s.voice[i].off();
// printf("note off %d for voice %d\n", note, i);
break;
}
}
}
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;
if (count == 0) return;
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;
switch (ev[i].data[0]) {
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) {
// if (midiEventCount > 0) printf("\n--------------------\n");
uint32_t framePos = 0;
uint32_t sizeThisTime;
s.framesLeft = frames;
// printf("\n------------\ncalled run() for %d frames\n",frames);
// flatten the left channel to use as temporary storage, since
// the synth engine only generates a mono channel
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;
doMidi(midiEvents, midiEventCount, framePos + s.blockLeft);
// printf("compute params and reset block size\n");
s.lfoDelay();
s.runLFO();
@ -155,17 +141,13 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
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].calcFilter(s);
// printf("voice %d vcf level = %04x\n", i, s.voice[i].vcfenv );
}
}
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
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.blockLeft -= sizeThisTime;
}
// printf("and now run the rest of the process for %d frames\n\n", frames);
// copy left to right
memmove(outputs[1], outputs[0], sizeof(float) * frames);

View File

@ -308,8 +308,6 @@ void Chassis::setParameterValue(uint32_t index, float value) {
if (value < 0.0f) value = 0.0f;
if (value > 127.0f) value = 127.0f;
printf("setparam %d %f\n", index, value);
switch (index) {
case paramLFORate:
s.patchRam.lfoRate = value;
@ -393,10 +391,8 @@ void Chassis::setParameterValue(uint32_t index, float value) {
s.patchRam.switch2 |= (value >= 0.5) << 1;
break;
case paramEnvGate:
//printf("setting envgate %f %02x", value, s.patchRam.switch2);
s.patchRam.switch2 &= 0xfb;
s.patchRam.switch2 |= (value >= 0.5) << 2;
// printf(" set envgate %f %02x", value, s.patchRam.switch2);
break;
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 {
//printf("getparametervalue %d\n", index);
switch (index) {
case paramLFORate:
return s.patchRam.lfoRate;
@ -492,7 +487,6 @@ float Chassis::getParameterValue(uint32_t index) const {
break;
case paramEnvGate:
//printf("envgate %d\n", s.patchRam.switch2 & 0x04);
return (s.patchRam.switch2 & 0x04) != 0;
case paramVCALevel:

View File

@ -36,13 +36,10 @@ static inline float poly3blep1(float t) {
void Voice::run(Synth &s, float *buffer, uint32_t samples) {
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 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));
// now radians
@ -57,8 +54,6 @@ void Voice::run(Synth &s, float *buffer, uint32_t samples) {
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);
for (uint32_t i = 0; i < samples; i++) {