From 62672644679cb96a401c9ba28af673f9f9b2b023 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Fri, 2 Feb 2018 16:41:10 -0800 Subject: [PATCH] Pass yieldtime into GetKey --- src/inc/sndseq.plh | 2 +- src/libsrc/sndseq.pla | 13 +++++-------- src/samplesrc/playseq.pla | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/inc/sndseq.plh b/src/inc/sndseq.plh index cdc1f68..3110a0e 100644 --- a/src/inc/sndseq.plh +++ b/src/inc/sndseq.plh @@ -1,4 +1,4 @@ import sndseq predef spkrTone(pitch, duration)#0, spkrPWM(sample, speed, len)#0 - predef musicPlay(track, rept)#0, musicStop#0, musicGetKey(backgroundProc)#1 + predef musicPlay(track, rept)#0, musicStop#0, musicGetKey(yield,backgroundProc)#1 end diff --git a/src/libsrc/sndseq.pla b/src/libsrc/sndseq.pla index 1a60976..2fb8c72 100755 --- a/src/libsrc/sndseq.pla +++ b/src/libsrc/sndseq.pla @@ -763,17 +763,14 @@ export def musicStop#0 musicSequence = @noSequence end // -// Get a keystroke and convert it to upper case +// Play until keystroke // -export def musicGetKey(backgroundProc)#1 - byte key - +export def musicGetKey(yield, backgroundProc)#1 while ^$C000 < 128 - musicSequence($08, backgroundProc)#0 // Call background proc every half second + musicSequence(yield, backgroundProc)#0 // Call background proc every half second loop - key = ^$C000 & $7F ^$C010 - return key + return ^$C000 end done @@ -798,7 +795,7 @@ musicStop() The getUpperKey routine will call a dummy sequence routine that will keep the correct timing for any background processing -getKey() +musicGetKey(yieldtime, yieldproc) Wait for a keypress and return the character While waiting for the keypress, the track sequence will be played though either the MockingBoard (if present) or the internal speaker. Optionally, diff --git a/src/samplesrc/playseq.pla b/src/samplesrc/playseq.pla index 5f502be..f3af6c6 100644 --- a/src/samplesrc/playseq.pla +++ b/src/samplesrc/playseq.pla @@ -22,7 +22,7 @@ if ^arg fileio:read(ref, heapmark(), heapavail()) fileio:close(ref) musicPlay(heapmark(), TRUE) - musicGetKey(@backgroundProc) + musicGetKey(8, @backgroundProc) // Yield every 8/16 second musicStop else puts("File not found.\n")