From d946f3699c6cdfbb41b4115512ffcfbe3960f8f6 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 6 Oct 2023 14:52:31 +0200 Subject: [PATCH] Fix sample looping --- src/devices.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/devices.c b/src/devices.c index 49c5b86..09e0a2b 100644 --- a/src/devices.c +++ b/src/devices.c @@ -171,7 +171,7 @@ deo_audio(u8 *dev, u8 port) { size_t idx = (dev - (device_data + 0x30)) / 16; if (port == 0xf) { u16 duration = PEEK2(dev + 0x2); - u8 off = (u8)dev[0xf] >> 7; + u8 off = dev[0xf] == 0xff; if (!off) { // Sample. @@ -179,7 +179,7 @@ deo_audio(u8 *dev, u8 port) { u8 *data = &uxn_ram[addr]; u16 len = PEEK2(dev + 0x8); u8 volume = dev[0xd]; - bool loop = !(dev[0xf] & 0x80); + bool loop = !!(dev[0xf] & 0x80); // Pitch. u8 pitch = dev[0xf] & 0x7f; @@ -189,7 +189,6 @@ deo_audio(u8 *dev, u8 port) { u8 decay = dev[0x5]; u8 sustain = dev[0x6]; u8 release = dev[0x7]; - // println("IDX: %d PITCH: %d", idx, pitch); note_on(&audio_ctx.channel[idx], duration, data, len, volume, attack, decay, sustain, release, pitch, loop); } else { -- 2.45.2