Commit e389101f authored by Anton Ertl's avatar Anton Ertl

Merge branch 'master' of git.sv.gnu.org:/srv/git/gforth

parents ca216dee 9d771134
......@@ -122,6 +122,10 @@ $100 buffer: opus-error$
! -2 throw ;] do-debug
THEN ;
: read-idx-block ( -- )
idx-block $@ drop ?dup-IF
idx-pos# swap idx-frames c@ dup >r /
r> 2* idx-head + * 0 play-idx reposition-file throw
THEN
$10 idx-block $!len
idx-block $@ play-idx read-file throw drop
idx-block $@ drop idx-frames c@ 2* idx-block $alloc 2dup erase
......@@ -162,7 +166,8 @@ Semaphore opus-block-sem
: 1-opus-block ( -- )
?read-idx-block read-opus-block
read-opus $@len IF dec-opus-block THEN
read-opus $@len IF dec-opus-block
ELSE "" $make [: opus-blocks >stack ;] opus-block-sem c-section THEN
1 +to idx-pos# ;
: opus-block-task ( -- )
......@@ -185,7 +190,7 @@ Semaphore opus-block-sem
opus-task ?dup-IF wake ELSE opus-block-task THEN ;
: open-play+ ( addr u -- ) { | w^ play$ w^ idx$ }
2dup play$ $! ".opus" play$ $+!
idx$ $! ".idx" idx$ $+!
idx$ $! ".aidx" idx$ $+!
play$ $@ idx$ $@ open-play
play$ $free idx$ $free ;
: open-rec ( addr-rec u addr-idx u -- )
......@@ -193,7 +198,7 @@ Semaphore opus-block-sem
w/o create-file throw to rec-file ;
: open-rec+ ( addr u -- ) { | w^ rec$ w^ idx$ }
2dup rec$ $! ".opus" rec$ $+!
idx$ $! ".idx" idx$ $+!
idx$ $! ".aidx" idx$ $+!
rec$ $@ idx$ $@ open-rec
rec$ $free idx$ $free ;
: close-rec ( -- )
......
......@@ -32,7 +32,7 @@ $100 buffer: pa-error$
THEN drop ;
debug: pulse( \ )
+db pulse( \ )
\ +db pulse( \ )
0 Value pa-ml
0 Value pa-api
......@@ -233,16 +233,22 @@ Defer write-record
data @ n @
n @ IF pa_stream_drop ?pa-ior THEN ;
: pause-stream ( stream -- )
1 0 0 pa_stream_cork ?pa-ior ;
: resume-stream ( stream -- )
0 0 0 pa_stream_cork ?pa-ior ;
: read-stream { stream bytes xt: read-record -- }
read-record { w^ buf }
BEGIN buf $@len bytes u< WHILE
pause \ give the other task a chance to do something
read-record { w^ buf2 }
buf2 $@ buf $+! buf2 $free
REPEAT
buf @ IF
read-record { w^ buf2 } buf2 $@len WHILE
buf2 $@ buf $+! buf2 $free
REPEAT THEN
buf $@len IF
stream buf $@ pa-free-cb #0. PA_SEEK_RELATIVE
pa_stream_write ?pa-ior
ELSE
stream pause-stream
THEN ;
: play-buffer! ( channels buffer -- )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment