re-structure menu, darken UI

This commit is contained in:
Armin 2026-09-08 21:57:34 +02:00
commit 4b44841049
16 changed files with 1217 additions and 304 deletions

View file

@ -59,7 +59,13 @@ SynthEngine::Voice* SynthEngine::acquireVoice()
return &voices[i];
stealIdx = (stealIdx + 1) % lim;
return &voices[stealIdx];
Voice* v = &voices[stealIdx];
if (v->active)
{
v->amp.noteOff();
v->flt.noteOff();
}
return v;
}
void SynthEngine::noteOn (int midiNote, float velocity)
@ -121,11 +127,16 @@ void SynthEngine::render (const VParams& p, float* left, float* right, int num)
: 1.0f - std::exp (-1.0f / (p.glide * (float) sr));
const float detuneRatio = std::exp2f (p.detune / 1200.0f);
const float tuneRatio = std::exp2f (p.tune / 12.0f);
const float maxFc = 18000.0f, minFc = 30.0f;
const float maxFc = 0.4f * (float) sr;
const float minFc = 30.0f;
for (int s = 0; s < num; ++s)
{
float mixL = 0.0f, mixR = 0.0f;
int activeCount = 0;
for (auto& v : voices)
if (v.active) ++activeCount;
const float voiceGain = activeCount > 1 ? 1.0f / std::sqrtf ((float) activeCount) : 1.0f;
for (auto& v : voices)
{
@ -213,7 +224,7 @@ void SynthEngine::render (const VParams& p, float* left, float* right, int num)
ampMod = 1.0f - p.lfoDepth * 0.5f * (1.0f + lfo);
v.outSmooth += (filtered - v.outSmooth) * 0.12f;
float o = v.outSmooth * (ae * ampMod) * v.vel;
float o = v.outSmooth * (ae * ampMod) * v.vel * voiceGain;
if (! std::isfinite (o)) o = 0.0f;
mixL += o * v.panL;
@ -228,8 +239,10 @@ void SynthEngine::render (const VParams& p, float* left, float* right, int num)
if (! std::isfinite (mixL)) mixL = 0.0f;
if (! std::isfinite (mixR)) mixR = 0.0f;
mixL = std::tanh (mixL);
mixR = std::tanh (mixR);
// Soft limiter before tanh for cleaner saturation
mixL = std::tanh (mixL * 0.8f);
mixR = std::tanh (mixR * 0.8f);
left[s] += mixL;
right[s] += mixR;