commit e6cf770d2e8b3a9a723cb45af81197d4ca81dd21
parent 4b64ced6699d892de817f802c08da4a63e5ed628
Author: Bad Diode <bd@badd10de.dev>
Date: Tue, 17 Oct 2023 17:12:31 +0200
Fix memory bug and restore previous looping behaviour
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/projects/examples/devices/audio-tests.tal b/projects/examples/devices/audio-tests.tal
@@ -1,6 +1,6 @@
( dev/audio-tests )
-%GET-NOTE { #00 SWP ;melody ADD2 LDA #80 ORA }
+%GET-NOTE { #00 SWP ;melody ADD2 LDA }
( devices )
@@ -68,7 +68,7 @@ BRK
BRK
@play-kick ( -> )
- #3c .Audio0/pitch DEO
+ #3c #80 ORA .Audio0/pitch DEO
BRK
@on-audio1 ( -> )
diff --git a/src/devices/audio.c b/src/devices/audio.c
@@ -276,7 +276,7 @@ audio_handler(void *ctx, Uint8 *out_stream, int len) {
}
}
int i;
- for (i = 0; i < len; i++) {
+ for (i = 0; i < len / 2; i++) {
stream[i] <<= 4;
}
}
@@ -292,7 +292,7 @@ audio_start(int idx, Uint8 *d, Uxn *u)
Uint8 *data = &u->ram[addr];
Uint16 len = PEEK2(d + 0xa);
Uint8 volume = d[0xe];
- bool loop = !!(d[0xf] & 0x80);
+ bool loop = !(d[0xf] & 0x80);
Uint8 pitch = d[0xf] & 0x7f;
Uint16 adsr = PEEK2(d + 0x8);
Uint8 attack = (adsr >> 12) & 0xF;