commit 1d7c96dd3da43be25504ec0f5c5ac6c845658d22 parent 8f3d7b90209417d9e9a52f212c35a6b883890c18 Author: Bad Diode <bd@badd10de.dev> Date: Tue, 17 Oct 2023 21:17:07 +0200 Update default envelope Diffstat:
M | src/devices/audio.c | | | 14 | ++++++-------- |
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/devices/audio.c b/src/devices/audio.c @@ -91,16 +91,14 @@ env_on(Envelope *env) { env->stage = ENV_DECAY; env->vol = 1.0f; } - if (env->d > 0) { - env->d = (SOUND_TIMER / AUDIO_BUFSIZE) / env->d; - } else { - env->d = (SOUND_TIMER / AUDIO_BUFSIZE) / 10.0f; + if (env->d < 10.0f) { + env->d = 10.0f; } - if (env->r > 0) { - env->r = (SOUND_TIMER / AUDIO_BUFSIZE) / env->r; - } else { - env->r = (SOUND_TIMER / AUDIO_BUFSIZE) / 10.0f; + env->d = (SOUND_TIMER / AUDIO_BUFSIZE) / env->d; + if (env->r < 10.0f) { + env->r = 10.0f; } + env->r = (SOUND_TIMER / AUDIO_BUFSIZE) / env->r; } void