(audio-test) Fixed durations

This commit is contained in:
neauoire 2023-10-21 11:10:33 -04:00
parent 6a091365a2
commit f1d903c775
1 changed files with 380 additions and 410 deletions

View File

@ -1,9 +1,5 @@
( dev/audio-tests )
%GET-NOTE { #00 SWP ;melody ADD2 LDA }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
@ -12,96 +8,73 @@
|60 @Audio3 [ &vector $2 &position $2 &output $1 &duration $2 &pad $1 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller &vector $2 &button $1 &key $1
( variables )
|0000
@progress1 $1
@progress2 $1
@progress3 $1
|0100 ( -> )
( theme )
|0100 @on-reset ( -> )
( | theme )
#0f8f .System/r DEO2
#0f8f .System/g DEO2
#0f80 .System/b DEO2
( vectors )
( | vectors )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
#0000 .Audio0/vector DEO2
;on-audio1 .Audio1/vector DEO2
;on-audio2 .Audio2/vector DEO2
;on-audio3 .Audio3/vector DEO2
( setup synth )
( | setup kick )
;kick .Audio0/addr DEO2
;kick/end ;kick SUB2
.Audio0/length DEO2
;kick/end ;kick SUB2 .Audio0/length DEO2
#ff .Audio0/volume DEO
#00ff .Audio0/adsr DEO2
( | setup sine )
;sine .Audio1/addr DEO2
;sine/end ;sine SUB2
.Audio1/length DEO2
#ff .Audio1/volume DEO
#01ff .Audio1/adsr DEO2
#03a0 .Audio1/duration DEO2
#00c0 .Audio1/duration DEO2
( | setup sine )
;sine .Audio2/addr DEO2
;sine/end ;sine SUB2
.Audio2/length DEO2
#ff .Audio2/volume DEO
#2200 .Audio2/adsr DEO2
#01d0 .Audio2/duration DEO2
#00c0 .Audio2/duration DEO2
( | setup sine )
;sine .Audio3/addr DEO2
;sine/end ;sine SUB2
.Audio3/length DEO2
#ff .Audio3/volume DEO
#38ff .Audio3/adsr DEO2
#00e8 .Audio3/duration DEO2
#0fff .Audio3/adsr DEO2
#00c0 .Audio3/duration DEO2
( | start )
#00 .Audio0/pitch DEO
BRK
@on-button ( -> )
.Controller/button DEI
DUP #02 AND ?play-kick
POP
.Controller/button DEI #02 AND ?play-kick
BRK
@play-kick ( -> )
#3c #80 ORA .Audio0/pitch DEO
BRK
@get-note ( offset* -- )
;melody ADD2 LDA
JMP2r
@on-audio1 ( -> )
( load next note )
.progress1 LDZ
( increment note counter )
DUP INC #1f AND .progress1 STZ
( play note )
GET-NOTE
.Audio1/pitch DEO
[ LIT2 00 &f $1 ] INCk ,&f STR
get-note .Audio1/pitch DEO
BRK
@on-audio2 ( -> )
( load next note )
.progress2 LDZ
( increment note counter )
DUP INC #1f AND .progress2 STZ
( play note )
GET-NOTE
.Audio2/pitch DEO
[ LIT2 00 &f $1 ] INCk ,&f STR
get-note #0c SUB .Audio2/pitch DEO
BRK
@on-audio3 ( -> )
( load next note )
.progress3 LDZ
( increment note counter )
DUP INC #1f AND .progress3 STZ
( play note )
GET-NOTE
.Audio3/pitch DEO
[ LIT2 00 &f $1 ] INCk ,&f STR
get-note #18 SUB .Audio3/pitch DEO
BRK
@on-frame ( -> )
@ -111,8 +84,7 @@ BRK
54 52 54 4f 4b 4f 48 00
54 52 54 4f 4b 4f 48 00
54 56 57 56 57 54 56 54
56 52 54 52 54 50 54 00
]
56 52 54 52 54 50 54 00 ]
@sine [
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
@ -130,9 +102,7 @@ BRK
0102 0202 0202 0303 0405 0506 0708 090a
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
5053 5659 5c5f 6265 686b 6e71 7477 7a7d
]
@sine/end
5053 5659 5c5f 6265 686b 6e71 7477 7a7d ] &end
@kick [
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7e7f 7e7e
@ -456,5 +426,5 @@ BRK
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
7f7f 7f7f 7f7f 7f7f
]
@kick/end
] &end