raw play sorta works

This commit is contained in:
Brooke Vibber 2022-12-08 06:33:05 -08:00
parent d2bc874011
commit 48a91b96ef
2 changed files with 11 additions and 4 deletions

View file

@ -158,6 +158,12 @@ wait_loop:
sty COLPF2 sty COLPF2
.endmacro .endmacro
.macro audio_play_raw
ldy VCOUNT
lda (sample_ptr),y ; 5/6 cyc
sta AUDC1 ; 4 cyc
.endmacro
.macro audio_play_lo .macro audio_play_lo
lda audiotemp ; 3 cyc lda audiotemp ; 3 cyc
and #$0f ; 2 cyc and #$0f ; 2 cyc
@ -199,9 +205,10 @@ wait_loop:
.macro run_frame palette1, palette2, palette3 .macro run_frame palette1, palette2, palette3
.scope .scope
each_scanline_pair: each_scanline_pair:
audio_prep ;audio_prep
inner_scanline palette1, palette2, palette3 inner_scanline palette1, palette2, palette3
audio_play_lo audio_play_raw
;audio_play_lo
inner_scanline palette1, palette2, palette3 inner_scanline palette1, palette2, palette3
;audio_play_hi ; too slow ;audio_play_hi ; too slow

View file

@ -24,6 +24,7 @@ function to4bit(val8) {
function pack(audio) { function pack(audio) {
let packed = []; let packed = [];
/*
for (let i = 0; i < audio.length; i += 2) { for (let i = 0; i < audio.length; i += 2) {
// little-endian 4-bit samples // little-endian 4-bit samples
let low = to4bit(audio[i]); let low = to4bit(audio[i]);
@ -31,14 +32,13 @@ function pack(audio) {
let byte = low | (high << 4); let byte = low | (high << 4);
packed.push(byte); packed.push(byte);
} }
/* */
// raw push bytes // raw push bytes
for (let i = 0; i < audio.length; i += 2) { for (let i = 0; i < audio.length; i += 2) {
let val = to4bit(audio[i]); let val = to4bit(audio[i]);
let byte = val | 0x10; let byte = val | 0x10;
packed.push(byte); packed.push(byte);
} }
*/
return packed; return packed;
} }