From 1d7c96dd3da43be25504ec0f5c5ac6c845658d22 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 17 Oct 2023 21:17:07 +0200 Subject: [PATCH] Update default envelope --- src/devices/audio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/devices/audio.c b/src/devices/audio.c index 6b82d55..c2d02dd 100644 --- 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