rescale-time

This commit is contained in:
~d6 2024-08-14 00:34:02 -04:00
parent 3d0ca1c548
commit 03c6d96e62
1 changed files with 25 additions and 6 deletions

View File

@ -27,6 +27,10 @@
( each channel can loop independently; there is no need to keep their )
( lengths in sync with each other. )
( TODO: next-t should be relative, not absolute. )
( requires more book-keeping but makes longer notes possible )
( also makes rescale-time simpler )
|30 @Audio1 [ &vect $2 &pos $2 &out $1 &dur $2 &pad $1 &adsr $2 &len $2 &addr $2 &vol $1 &pitch $1 ]
|40 @Audio2 [ &vect $2 &pos $2 &out $1 &dur $2 &pad $1 &adsr $2 &len $2 &addr $2 &vol $1 &pitch $1 ]
|50 @Audio3 [ &vect $2 &pos $2 &out $1 &dur $2 &pad $1 &adsr $2 &len $2 &addr $2 &vol $1 &pitch $1 ]
@ -124,14 +128,28 @@
STHr #08 ORA DEO2 ( ; <-adsr )
JMP2r
@rescale-time ( -> )
.time LDZ2 #0200 GTH2 ?{ JMP2r }
.time adjust-zp-t
.events adjust-ch-next-t
.ch-1 adjust-ch-next-t
.ch-2 adjust-ch-next-t
.ch-3 adjust-ch-next-t
.ch-4 !adjust-ch-next-t
@adjust-ch-next-t ( ch^ -> )
.ch/next-t ADD ( >> )
@adjust-zp-t ( zp^ -> )
LDZ2k #0100 SUB2 ROT STZ2 JMP2r
@change-pulse ( ms* -> )
DUP2 .ch-1 update-ch-pulse
DUP2 .ch-2 update-ch-pulse
DUP2 .ch-3 update-ch-pulse
DUP2 .ch-4 update-ch-pulse
DUP2 .ch-1 adjust-ch-pulse
DUP2 .ch-2 adjust-ch-pulse
DUP2 .ch-3 adjust-ch-pulse
DUP2 .ch-4 adjust-ch-pulse
.dur STZ2 JMP2r
@update-ch-pulse ( ms* ch^ -> )
@adjust-ch-pulse ( ms* ch^ -> )
.ch/next-t ADD STHk LDZ2 ( ms* next-ms* [next-t^] )
.dur LDZ2 DIV2 ( ms* next-p* [next-t^] )
MUL2 STHr STZ2 JMP2r ( )
@ -145,6 +163,7 @@
.ch/next-t ADD LDZ2 .time LDZ2 NEQ2k ?&neq
POP2 POP2 BRK
&neq POP2 .time STZ2
rescale-time
advance-events
.ch-1 play-ch
.ch-2 play-ch
@ -179,7 +198,7 @@
@track-end
@slowdown ( -> )
.dur LDZ2 #0008 ADD2 !change-pulse
.dur LDZ2 #0008 ADD2 #010e DEO !change-pulse
@saw ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00