commit c4ec4a6340ef2552eb38b14a103a5ff9c552e434
parent 328f52128bc7317aea7d0730bf963926c4e168b6
Author: neauoire <aliceffekt@gmail.com>
Date: Fri, 20 Oct 2023 11:51:17 -0400
(audio.c) Default duration is sample length
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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;