From c4ec4a6340ef2552eb38b14a103a5ff9c552e434 Mon Sep 17 00:00:00 2001 From: neauoire Date: Fri, 20 Oct 2023 11:51:17 -0400 Subject: [PATCH] (audio.c) Default duration is sample length --- src/devices/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/audio.c b/src/devices/audio.c index 63d5162..f5c0b45 100644 --- a/src/devices/audio.c +++ b/src/devices/audio.c @@ -108,7 +108,7 @@ env_off(Envelope *env) { void note_on(AudioChannel *channel, Uint16 duration, Uint8 *data, Uint16 len, Uint8 vol, Uint8 attack, Uint8 decay, Uint8 sustain, Uint8 release, Uint8 pitch, bool loop) { - channel->duration = duration; + channel->duration = duration > 0 ? duration : len / 44.1f; channel->vol_l = (vol >> 4) / 15.0f; channel->vol_r = (vol & 0xf) / 15.0f;