~rabbits/uxn-playdate

d946f3699c6cdfbb41b4115512ffcfbe3960f8f6 — Bad Diode 11 months ago fed4b6e
Fix sample looping
1 files changed, 2 insertions(+), 3 deletions(-)

M src/devices.c
M src/devices.c => src/devices.c +2 -3
@@ 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 {