From fca3b46d81082ebb11927f15c1ce224fba4788bb Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 17 Oct 2023 21:01:18 +0200 Subject: [PATCH] Add minimum decay/release of 10ms --- src/devices/audio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/devices/audio.c b/src/devices/audio.c index 7402329..6b82d55 100644 --- a/src/devices/audio.c +++ b/src/devices/audio.c @@ -93,12 +93,13 @@ env_on(Envelope *env) { } if (env->d > 0) { env->d = (SOUND_TIMER / AUDIO_BUFSIZE) / env->d; - } else if (env->stage == ENV_DECAY) { - env->stage = ENV_SUSTAIN; - env->vol = env->s; + } else { + env->d = (SOUND_TIMER / AUDIO_BUFSIZE) / 10.0f; } if (env->r > 0) { env->r = (SOUND_TIMER / AUDIO_BUFSIZE) / env->r; + } else { + env->r = (SOUND_TIMER / AUDIO_BUFSIZE) / 10.0f; } }