levels balanced a bit better

This commit is contained in:
Gordon JC Pearce 2026-01-08 16:17:42 +00:00
parent e3c54e3ef1
commit 4077447102
2 changed files with 9 additions and 10 deletions

View File

@ -85,7 +85,7 @@ void Module::runLFO() {
pw = (lfoState & 0x02) ? lfoPhase + 0x2000 : 0x2000 - lfoPhase; // PW LFO is unipolar
pw = (patchRam.switch2 & 0x01) ? 0x3fff : pw; // either LFO or "all on"
pw = 0x3fff - ((pw * patchRam.pwmLfo) >> 7); // scaled by PWM pot
pw = 0x3fff - ((pw * (int)(patchRam.pwmLfo*1.45)) >> 7); // FIXME tidy up this bit
}
void Module::run(Voice* voices, uint32_t blockSize) {
@ -104,12 +104,12 @@ void Module::run(Voice* voices, uint32_t blockSize) {
// originally I had 0.28, 0.36, 0.4
// measurement suggests that saw and square are around 100mV each with sub 160mV
square = (patchRam.switch1 & 0x08) ? 0.3 : 0;
saw = (patchRam.switch1 & 0x10) ? .3 : 0;
sub = (patchRam.sub / 127.0f) * 0.48;
square = (patchRam.switch1 & 0x08) ? 1 : 0;
saw = (patchRam.switch1 & 0x10) ? 1 : 0;
sub = (patchRam.sub / 127.0f) * 1.4;
res = patchRam.vcfReso / 127.0;
noise = (patchRam.noise / 127.0) * 0.4;
noise = (patchRam.noise / 127.0);
// FIXME the exp in these is expensive, don't call it all the time
chorus->setChorus(patchRam.switch1 & 0x60);
@ -143,7 +143,6 @@ void Module::run(Voice* voices, uint32_t blockSize) {
pitchBase += lfoToVco;
pitchBase += /* pitch bend FIXME */ 0;
// int16_t vcf = (patchRam.vcfEnv << 7) * ((patchRam.switch2 & 0x02) ? -1 : 1);
vcfBase = (patchRam.vcfFreq << 7) + /* vcf bend FIXME */ 0;
vcfBase += lfoToVcf;
if (vcfBase > 0x3fff) vcfBase = 0x3fff;
@ -183,7 +182,7 @@ void Module::run(Voice* voices, uint32_t blockSize) {
v->omega = px / (sampleRate * 8.0f); // FIXME recalculate table using proper scaler
// per voice we need to calculate the key follow amount and envelope amount
v->vcfCut = vcfBase + (((v->env * patchRam.vcfEnv)>>7) * ((patchRam.switch1 & 0x02) ? -1 : 1));
v->vcfCut = vcfBase + (((v->env * patchRam.vcfEnv)>>7) * ((patchRam.switch2 & 0x02) ? -1 : 1));
v->vcfCut += (int)((v->note - 36) * (patchRam.vcfKey << 1) * 0.375);

View File

@ -72,7 +72,7 @@ void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) {
float r = 5 * m->res;
float amp = vcaEnv / 4096.0f;
float amp = vcaEnv / 32768.0f;
for (uint32_t i = 0; i < samples; i++) {
out = delay;
@ -117,8 +117,8 @@ void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) {
fb = y3;
// hard clip
fb = ((out * 0.5) - fb) * r;
if (fb > 2) fb = 2;
if (fb < -2) fb = -2;
if (fb > 6) fb = 6;
if (fb < -6) fb = -6;
y0 = ((out + fb - y0) * vcfRC) + y0;
y1 = ((y0 - y1) * vcfRC) + y1;