mirror of
https://github.com/dschmenk/PLASMA.git
synced 2026-01-27 04:16:22 +00:00
Simplify music sequence parameters
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,4 @@
|
||||
include "inc/cmdsys.plh"
|
||||
include "inc/lines.plh"
|
||||
include "inc/args.plh"
|
||||
include "inc/fileio.plh"
|
||||
include "dhgr.tk/inc/dhgrlib.plh"
|
||||
include "dhgr.tk/inc/dhgrutils.plh"
|
||||
@@ -9,27 +7,13 @@ include "inc/sndseq.plh"
|
||||
sysflags resxtxt1|reshgr1|resxhgr1
|
||||
|
||||
var strWidth, strHeight
|
||||
byte ref
|
||||
var seq, len
|
||||
char darthstr = "DartH GRaphics"
|
||||
|
||||
def backgroundProc#0
|
||||
return
|
||||
end
|
||||
|
||||
dcgrFont(fontRead("trade54.fon"))
|
||||
strWidth, strHeight = dcgrStrExtents(@darthstr)
|
||||
dhgrMode(DHGR_COLOR_MODE)
|
||||
screenRead("darth.dhgr")
|
||||
ref = fileio:open("imperial.seq")
|
||||
if ref
|
||||
seq = heapalloc(heapavail - 256)
|
||||
len = fileio:read(ref, seq, heapmark - seq)
|
||||
fileio:close(ref)
|
||||
heaprelease(seq + len)
|
||||
musicPlay(seq, FALSE)
|
||||
musicGetKey(16, @backgroundProc) // Yield every 16/16 second
|
||||
fin
|
||||
musicPlay(musicRead("imperial.seq"), FALSE)
|
||||
musicGetKey(16, NULL) // Yield every 16/16 second
|
||||
dcgrColor(CLR_WHITE)
|
||||
dcgrStr((140 - strWidth) / 2, (strHeight * 7) / 8, @darthstr)
|
||||
getc
|
||||
|
||||
@@ -2,5 +2,6 @@ import sndseq
|
||||
word musicSequence // musicSequence(yield, backgroundProc)#0
|
||||
word spkrTone // spkrTone(pitch, duration)#0
|
||||
word spkrPWM // spkrPWM(sample, speed, len)#0
|
||||
predef musicPlay(track, rept)#0, musicStop#0, musicGetKey(yield, backgroundProc)#1
|
||||
predef musicPlay(track, rept)#0, musicStop#0
|
||||
predef musicGetKey(yield, backgroundProc)#1, musicRead(filename)#1
|
||||
end
|
||||
|
||||
@@ -366,6 +366,8 @@ asm a2keypressed
|
||||
DEY
|
||||
+ STY ESTKL,X
|
||||
STY ESTKH,X
|
||||
end
|
||||
asm nopBackground#0
|
||||
RTS
|
||||
end
|
||||
def a3keypressed
|
||||
@@ -833,15 +835,35 @@ export def musicGetKey(yield, backgroundProc)#1
|
||||
char key
|
||||
|
||||
key = 0
|
||||
repeat
|
||||
musicSequence(yield, backgroundProc)#0 // Call background proc every half second
|
||||
if keypressed()
|
||||
key = getc
|
||||
seqRepeat = FALSE
|
||||
fin
|
||||
until not seqRepeat
|
||||
if backgroundProc == NULL; backgroundProc = @nopBackground; fin
|
||||
if seqTrack
|
||||
repeat
|
||||
musicSequence(yield, backgroundProc)#0 // Call background proc every half second
|
||||
if keypressed()
|
||||
key = getc
|
||||
seqRepeat = FALSE
|
||||
fin
|
||||
until not seqRepeat
|
||||
fin
|
||||
return key
|
||||
end
|
||||
//
|
||||
// Read sequence onto heap
|
||||
//
|
||||
export def musicRead(filename)#1
|
||||
byte ref
|
||||
word seq, len
|
||||
|
||||
seq = NULL
|
||||
ref = fileio:open(filename)
|
||||
if ref
|
||||
seq = heapalloc(heapavail - 256)
|
||||
len = fileio:read(ref, seq, heapmark - seq)
|
||||
fileio:close(ref)
|
||||
heaprelease(seq + len)
|
||||
fin
|
||||
return seq
|
||||
end
|
||||
|
||||
when MACHID & MACHID_MODEL
|
||||
is MACHID_III
|
||||
|
||||
Reference in New Issue
Block a user