Fix memory bug and restore previous looping behaviour

This commit is contained in:
Bad Diode 2023-10-17 17:12:31 +02:00
parent 7365da67ca
commit 28393a41a5
2 changed files with 4 additions and 4 deletions

View File

@ -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 ( -> )

View File

@ -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;