From c39db007d200a446ba9df41714ad84213db4dbff Mon Sep 17 00:00:00 2001 From: d_m Date: Thu, 29 Aug 2024 22:34:35 -0400 Subject: [PATCH] Able to play .flac files. --- gui/m291/src/m291.tal | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gui/m291/src/m291.tal b/gui/m291/src/m291.tal index 4c09bbc..529510f 100644 --- a/gui/m291/src/m291.tal +++ b/gui/m291/src/m291.tal @@ -34,7 +34,7 @@ #0100 .Screen/width DEO2 ( | .. ) message/ - ;dict/mpg-cmd .Console/addr DEO2 + ;dict/flac-cmd .Console/addr DEO2 [ LIT2 03 -Console/mode ] DEO [ LIT2 01 -Console/exec ] DEO [ LIT2 00 -playing ] STZ @@ -282,6 +282,7 @@ !message/ +( TODO: flac123 id3 format is different and more limited, sadly ) @handle-id3 ( buf* char -- ) POP [ LIT ". ] find-next INC2 LDA2k ( | parse lines ) @@ -293,6 +294,7 @@ OVR2 [ LIT ": ] find-next INC2 ;id3/album } POP2 POP2 !message/ +( TODO: flac123 doesn't use "@P 3" so we'd need to use "@P 0" ) @handle-pause ( buf* char -- ) POP INC2 INC2 LDA ( stop ) DUP [ LIT "0 ] NEQ ?{ } @@ -354,7 +356,7 @@ @ ( line* -- ) #0005 ADD2 LDAk [ LIT ". ] EQU ?&hidden is-folder ?&folder - is-mp3 ?&mp3 + is-flac ?&flac POP2 JMP2r &folder ( line* -- ) @@ -366,7 +368,7 @@ .lines/folders LDZ INC .lines/folders STZ JMP2r - &mp3 ( line* -- ) + &flac ( line* -- ) DUP2 llen ( CELLSIZE ) #007f LTH2 ?{ POP2 JMP2r } ;mem/tracks [ LIT2 00 -lines/tracks ] LDZ @@ -433,6 +435,9 @@ @is-mp3 ( line* -- line*f ) DUP2 lcap/ #0003 SUB2 ;dict/mp3-ext !scmp3 +@is-flac ( line* -- line*f ) + DUP2 lcap/ #0004 SUB2 ;dict/flac-ext !scmp4 + @pos-to-seconds ( pos* -- seconds* ) .secfrom LDZ2 .secto LDZ2 ADD2 #00e7 DIV2k STH2k MUL2 SUB2 OVR2 STH2 MUL2r MUL2 #00e7 DIV2 STH2r ADD2 JMP2r @@ -846,6 +851,11 @@ LDAkr LDAk STHr NEQ ?{ INC2r INC2 } LDA2r LDA2 STH2r EQU2 JMP2r +@scmp4 ( a* b* -- f ) + STH2 + LDA2kr LDA2k STH2r NEQ2 ?{ INC2r INC2r INC2 INC2 } + LDA2r LDA2 STH2r EQU2 JMP2r + @ ( src* dst* -: ) STH2 &>w ( src* `dst* -- ) @@ -940,8 +950,9 @@ @dict &home-path "./ $1 &mp3-ext "mp3 $1 + &flac-ext "flac $1 &empty "(empty) $1 - &mpg-cmd "mpg123 20 "-R $1 + &flac-cmd "flac123 20 "-R $1 &load-cmd "load 20 $1 &jump-cmd "jump 20 $1 &pause-cmd "pause 0a $1