Browse code

Fix memory bug and restore previous looping behaviour

Bad Diode authored on 17/10/2023 15:12:31 • neauoire committed on 03/11/2023 00:30:14
Showing 2 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 ( dev/audio-tests )
2 2
 
3
-%GET-NOTE { #00 SWP ;melody ADD2 LDA #80 ORA }
3
+%GET-NOTE { #00 SWP ;melody ADD2 LDA }
4 4
 
5 5
 ( devices )
6 6
 
... ...
@@ -68,7 +68,7 @@ BRK
68 68
 BRK
69 69
 
70 70
 @play-kick ( -> )
71
-	#3c     .Audio0/pitch    DEO
71
+	#3c #80 ORA .Audio0/pitch    DEO
72 72
 BRK
73 73
 
74 74
 @on-audio1 ( -> )
... ...
@@ -276,7 +276,7 @@ audio_handler(void *ctx, Uint8 *out_stream, int len) {
276 276
         }
277 277
     }
278 278
     int i;
279
-    for (i = 0; i < len; i++) {
279
+    for (i = 0; i < len / 2; i++) {
280 280
         stream[i] <<= 4;
281 281
     }
282 282
 }
... ...
@@ -292,7 +292,7 @@ audio_start(int idx, Uint8 *d, Uxn *u)
292 292
         Uint8 *data = &u->ram[addr];
293 293
         Uint16 len = PEEK2(d + 0xa);
294 294
         Uint8 volume = d[0xe];
295
-        bool loop = !!(d[0xf] & 0x80);
295
+        bool loop = !(d[0xf] & 0x80);
296 296
         Uint8 pitch = d[0xf] & 0x7f;
297 297
         Uint16 adsr = PEEK2(d + 0x8);
298 298
         Uint8 attack = (adsr >> 12) & 0xF;