mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-05 05:45:05 +00:00
Add initial WIP sample player for new audio device
This commit is contained in:
parent
632816a58e
commit
49eda85851
5 changed files with 3316 additions and 219 deletions
6
build.sh
6
build.sh
|
@ -52,7 +52,7 @@ fi
|
|||
|
||||
mkdir -p bin
|
||||
CC="${CC:-cc}"
|
||||
CFLAGS="${CFLAGS:--std=c89 -Wall -Wno-unknown-pragmas}"
|
||||
CFLAGS="${CFLAGS:--std=c99 -Wall -Wno-unknown-pragmas}"
|
||||
case "$(uname -s 2>/dev/null)" in
|
||||
MSYS_NT*|MINGW*) # MSYS2 on Windows
|
||||
FILE_LDFLAGS="-liberty"
|
||||
|
@ -106,7 +106,7 @@ if [ $norun = 1 ]; then exit; fi
|
|||
./bin/uxncli -v
|
||||
./bin/uxnemu -v
|
||||
|
||||
./bin/uxnasm projects/software/piano.tal bin/piano.rom
|
||||
./bin/uxnasm projects/examples/devices/audio-tests.tal bin/audio-tests.rom
|
||||
|
||||
./bin/uxnemu -2x bin/piano.rom
|
||||
./bin/uxnemu -2x bin/audio-tests.rom
|
||||
|
||||
|
|
474
projects/examples/devices/audio-tests.tal
Normal file
474
projects/examples/devices/audio-tests.tal
Normal file
|
@ -0,0 +1,474 @@
|
|||
( dev/audio-tests )
|
||||
|
||||
%GET-NOTE { #00 SWP ;melody ADD2 LDA #80 ORA }
|
||||
|
||||
( 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 &duration $2 &attack $1 &decay $1 &sustain $1 &release $1 &length $2 &addr $2 &expansion $1 &volume $1 &detune $1 &pitch $1 ]
|
||||
|40 @Audio1 [ &vector $2 &duration $2 &attack $1 &decay $1 &sustain $1 &release $1 &length $2 &addr $2 &expansion $1 &volume $1 &detune $1 &pitch $1 ]
|
||||
|50 @Audio2 [ &vector $2 &duration $2 &attack $1 &decay $1 &sustain $1 &release $1 &length $2 &addr $2 &expansion $1 &volume $1 &detune $1 &pitch $1 ]
|
||||
|60 @Audio3 [ &vector $2 &duration $2 &attack $1 &decay $1 &sustain $1 &release $1 &length $2 &addr $2 &expansion $1 &volume $1 &detune $1 &pitch $1 ]
|
||||
|80 @Controller &vector $2 &button $1 &key $1
|
||||
|
||||
( variables )
|
||||
|
||||
|0000
|
||||
|
||||
@progress0 $1
|
||||
@progress1 $1
|
||||
@progress2 $1
|
||||
@progress3 $1
|
||||
|
||||
|0100 ( -> )
|
||||
|
||||
( theme )
|
||||
#0f8f .System/r DEO2
|
||||
#0f8f .System/g DEO2
|
||||
#0f80 .System/b DEO2
|
||||
|
||||
( vectors )
|
||||
;on-frame .Screen/vector DEO2
|
||||
;on-button .Controller/vector DEO2
|
||||
;on-audio1 .Audio1/vector DEO2
|
||||
;on-audio2 .Audio2/vector DEO2
|
||||
;on-audio3 .Audio3/vector DEO2
|
||||
|
||||
( setup synth )
|
||||
;kick .Audio0/addr DEO2
|
||||
;kick/end ;kick SUB2
|
||||
.Audio0/length DEO2
|
||||
#ff .Audio0/volume DEO
|
||||
#00 .Audio0/attack DEO
|
||||
#f0 .Audio0/decay DEO
|
||||
#ff .Audio0/sustain DEO
|
||||
#1e .Audio0/release DEO
|
||||
#00e8 .Audio0/duration DEO2
|
||||
|
||||
;sine .Audio1/addr DEO2
|
||||
#0054 .Audio1/length DEO2
|
||||
#ff .Audio1/volume DEO
|
||||
#00 .Audio1/attack DEO
|
||||
#11 .Audio1/decay DEO
|
||||
#00 .Audio1/sustain DEO
|
||||
#1e .Audio1/release DEO
|
||||
#0074 .Audio1/duration DEO2
|
||||
|
||||
;sine .Audio2/addr DEO2
|
||||
#00a8 .Audio2/length DEO2
|
||||
#ff .Audio2/volume DEO
|
||||
#00 .Audio2/attack DEO
|
||||
#f0 .Audio2/decay DEO
|
||||
#00 .Audio2/sustain DEO
|
||||
#1e .Audio2/release DEO
|
||||
#01d0 .Audio2/duration DEO2
|
||||
|
||||
;sine .Audio3/addr DEO2
|
||||
#00a8 .Audio3/length DEO2
|
||||
#ff .Audio3/volume DEO
|
||||
#00 .Audio3/attack DEO
|
||||
#f0 .Audio3/decay DEO
|
||||
#00 .Audio3/sustain DEO
|
||||
#1e .Audio3/release DEO
|
||||
#03e0 .Audio3/duration DEO2
|
||||
BRK
|
||||
|
||||
@on-button ( -> )
|
||||
.Controller/button DEI
|
||||
DUP #02 AND ?play-kick
|
||||
POP
|
||||
BRK
|
||||
|
||||
@play-kick ( -> )
|
||||
#3c .Audio0/pitch DEO
|
||||
BRK
|
||||
|
||||
@on-audio0 ( -> )
|
||||
( load next note )
|
||||
.progress0 LDZ
|
||||
( increment note counter )
|
||||
DUP INC #1f AND .progress0 STZ
|
||||
( play note )
|
||||
GET-NOTE
|
||||
.Audio0/pitch DEO
|
||||
BRK
|
||||
|
||||
@on-audio1 ( -> )
|
||||
( load next note )
|
||||
.progress1 LDZ
|
||||
( increment note counter )
|
||||
DUP INC #1f AND .progress1 STZ
|
||||
( play note )
|
||||
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
|
||||
BRK
|
||||
|
||||
@on-audio3 ( -> )
|
||||
( load next note )
|
||||
.progress3 LDZ
|
||||
( increment note counter )
|
||||
DUP INC #1f AND .progress3 STZ
|
||||
( play note )
|
||||
GET-NOTE
|
||||
.Audio3/pitch DEO
|
||||
BRK
|
||||
|
||||
@on-frame ( -> )
|
||||
BRK
|
||||
|
||||
@melody [
|
||||
54 52 54 4f 4b 4f 48 ff
|
||||
54 52 54 4f 4b 4f 48 ff
|
||||
54 56 57 56 57 54 56 54
|
||||
56 52 54 52 54 50 54 ff
|
||||
]
|
||||
|
||||
@sine [
|
||||
8084 888c 9195 999d a1a5 a9ad b1b5 b9bd
|
||||
c0c4 c7ca ced1 d4d7 d9dc dee1 e3e5 e7e9
|
||||
ebec edef f0f1 f1f2 f2f3 f3f3 f2f2 f2f1
|
||||
f0ef eeec ebe9 e8e6 e4e2 dfdd dad7 d5d2
|
||||
cfcb c8c5 c1be bab6 b2af aba7 a39e 9a96
|
||||
928e 8985 817c 7874 706b 6763 5f5b 5753
|
||||
4f4b 4743 403c 3935 322f 2c29 2624 211f
|
||||
1d1a 1817 1513 1211 100f 0e0d 0d0c 0c0c
|
||||
0c0d 0d0e 0f10 1112 1415 1719 1b1d 1f22
|
||||
2427 2a2d 3033 3639 3d40 4448 4c4f 5357
|
||||
5b5f 6468 6c70 7579
|
||||
]
|
||||
|
||||
@kick [
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7e7f 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7d7d 7d7d 7c7c 7c7c
|
||||
7c7c 7c7c 7b7b 787a 7576 7775 7a78 7a7a
|
||||
7b7a 7c7b 7a7c 7879 7a78 7d7b 7f7e 7b7d
|
||||
6e75 6c6d 8779 a799 949e 5a72 5451 8975
|
||||
9b9e 657e 3f4a 403f 4e42 725f 9386 a09c
|
||||
999f 8290 6675 585b 6157 7168 7475 6d73
|
||||
6f6d 7c74 807e 727a 626a 5e60 6863 7a72
|
||||
8682 8486 737b 6569 6864 7b74 8786 8186
|
||||
7579 7372 7875 7b7b 7d7b 837e 8a86 888c
|
||||
7c85 7077 706f 8076 968a a29c 9ba0 8b94
|
||||
7d84 7f7d 8984 9790 a19c a4a3 9ea1 9a9c
|
||||
999a 9999 9a99 9b99 a49f aeaa b2b4 a8ae
|
||||
9ea1 9f9c a9a3 b3af b7b6 b6b8 b2b4 b1b1
|
||||
b1b0 b4b2 b4b4 b3b4 b5b4 bab7 bdbb bdbd
|
||||
bebe bebe babc b9b9 bdbb c0bf c3c2 c2c3
|
||||
bebf bdbd c0bf c0c2 bbbc bdb9 c5c2 c7c8
|
||||
c3c6 bec0 bbbb bdbb bfbd c0c0 bcbf b9bb
|
||||
b9b9 bdba bebe b8bc b1b5 b1b1 b3b2 b2b2
|
||||
abae a9aa acab b2af b4b3 b2b3 acb0 a4a8
|
||||
9ca0 9499 8a8f 8184 837f 9288 a09b a1a4
|
||||
969d 8c90 8989 8a88 8789 8084 777c 6c72
|
||||
6468 6563 6665 6a68 6d6c 6d6e 696b 6266
|
||||
5d5f 5b5c 5b5b 5a5b 5658 5354 5152 4e4f
|
||||
4b4c 494a 4647 4445 4142 3f40 3c3d 3b3c
|
||||
383a 3637 3535 3234 3031 2f2f 2d2e 2c2c
|
||||
292a 2728 2626 2425 2324 2222 2121 1f20
|
||||
1e1f 1d1e 1c1c 1f1e 1e1e 1f1f 1f1f 1c1d
|
||||
1b1c 1b1b 1a1a 1a1a 1c1b 1b1c 1b1a 1b1b
|
||||
1b1b 1a1b 1b1b 1c1c 1d1c 1d1d 201e 2121
|
||||
2021 2020 2020 2221 2222 2423 2524 2827
|
||||
2929 2929 2a29 2b2a 2d2d 2e2e 2f2e 3231
|
||||
3434 3334 3533 3836 3c3a 3d3d 3e3d 3f3e
|
||||
4241 4543 4645 4646 4746 4a48 4f4c 5351
|
||||
5554 5555 5656 5957 5b5a 5d5c 605e 6462
|
||||
6766 6968 6a69 6e6c 7371 7676 7476 7171
|
||||
7572 7e78 8682 8889 8588 8283 8483 8a86
|
||||
8f8d 9191 9593 9896 9b99 9e9d a09f a1a1
|
||||
a1a1 a4a3 a8a6 acaa afad b2b1 b4b3 b7b5
|
||||
bbba bcbb bdbc bebe bfbf c0bf c4c2 c7c6
|
||||
c8c7 c9c9 cbca cdcc cfcf d1d0 d3d2 d5d4
|
||||
d6d6 d7d7 dad8 dcdb dddc dedd dfde e0df
|
||||
e1e1 e2e2 e5e4 e6e5 e7e6 e8e7 e8e8 e9e9
|
||||
eaea ebeb eceb edec eded eeee efee f0ef
|
||||
eff0 efef f0ef f0f0 f1f1 f1f1 f2f2 f1f2
|
||||
eff0 eeef eced edec eded eded eeee eeee
|
||||
edee ecec ebeb ebeb eaea e9ea e9e9 e7e8
|
||||
e6e7 e3e4 e3e3 e3e3 e2e3 e1e2 e0e0 dee0
|
||||
dddd dbdc dadb d9da d7d8 d6d6 d4d5 d2d3
|
||||
d1d1 ced0 cccd cbcc c9ca c7c8 c5c6 c4c5
|
||||
c2c3 c0c1 bfc0 bcbd babb b8b9 b7b7 b5b6
|
||||
b2b3 b0b1 adae abac a9aa a7a8 a6a7 a3a5
|
||||
a1a2 9fa0 9d9e 9a9b 9899 9596 9293 9091
|
||||
8e8f 8d8d 8b8c 888a 8486 8082 7d7f 7b7c
|
||||
7a7b 7a7a 797a 7678 7274 6e70 6a6d 6568
|
||||
6263 6261 6362 6464 6264 5c60 5659 5254
|
||||
4e50 4a4c 4b4a 4e4c 4d4e 4c4d 4a4b 4347
|
||||
3c3f 3638 3535 3635 3938 3939 3637 3335
|
||||
2e30 292b 2627 2625 2727 2627 2525 2324
|
||||
2021 1f1f 1d1e 1a1b 191a 1819 1718 1516
|
||||
1314 1213 1112 1011 0f10 0e0f 0c0d 0a0b
|
||||
0a0a 0909 0809 0708 0707 0606 0505 0405
|
||||
0404 0303 0203 0202 0101 0101 0202 0202
|
||||
0101 0101 0000 0000 0000 0000 0201 0403
|
||||
0404 0404 0303 0203 0302 0504 0405 0505
|
||||
0606 0707 0808 0808 0a09 0c0b 0c0c 0c0c
|
||||
0c0d 0c0c 0e0d 1110 1312 1515 1515 1615
|
||||
1616 1817 1919 1b1a 1d1c 1f1d 2120 2322
|
||||
2424 2625 2727 2827 2a29 2c2a 2e2d 302f
|
||||
3231 3433 3635 3837 3a39 3a3a 3c3b 3f3e
|
||||
4241 4443 4645 4847 4a49 4b4a 4d4c 4f4e
|
||||
5150 5453 5655 5958 5b5a 5c5c 5e5d 6160
|
||||
6362 6564 6766 6968 6b6a 6d6c 6f6e 7271
|
||||
7574 7777 7878 7979 7b7a 7d7c 7f7e 8281
|
||||
8584 8786 8988 8b8a 8c8c 8e8d 8f8e 9291
|
||||
9694 9897 9a99 9a9a 9b9a 9d9c 9f9e a1a0
|
||||
a3a2 a6a4 a8a7 abaa aead aeae adad aeae
|
||||
b0af b3b1 b6b4 b8b6 bcba bebd bdbd bcbc
|
||||
bcbb bebc c0bf c2c1 c5c4 c8c6 cbc9 cbcb
|
||||
cbcb cccb cdcc cecd cfce d0cf d1d0 d5d3
|
||||
d6d6 d5d6 d6d5 d6d6 d7d7 d8d8 d9d8 dad9
|
||||
dada dbdb dedd dfdf dedf dddd dfdd e0e0
|
||||
e3e1 e4e4 e4e4 e3e3 e0e2 e0e0 e4e2 e6e5
|
||||
e6e6 e5e6 e2e4 e2e2 e4e2 e6e5 e7e6 e7e7
|
||||
e7e7 e7e7 e7e7 e8e8 e7e8 e4e5 e4e4 e6e5
|
||||
e6e6 e6e6 e6e6 e6e6 e6e6 e5e6 e3e5 e2e3
|
||||
e3e2 e4e4 e4e4 e4e4 e4e4 e4e4 e3e3 e2e3
|
||||
e1e1 e0e0 dfdf dfdf dfdf dbdd dbdb dcdb
|
||||
dadb dada dbda dadb d8d9 d6d7 d6d5 d7d7
|
||||
d6d7 d4d5 d1d2 d1d1 d1d1 d0d1 cecf cdcd
|
||||
cdcd cbcc cacb c9ca c7c8 c6c6 c5c6 c5c5
|
||||
c5c5 c4c4 c1c3 bfc0 bfbf bfbf bebf babc
|
||||
b8b9 b7b7 b7b7 b6b6 b5b5 b3b4 b3b3 b1b2
|
||||
afb0 aeae adad acad aaab a9a9 a9a9 a8a9
|
||||
a5a7 a2a3 a1a1 a1a1 a2a1 a1a1 9ea0 9b9c
|
||||
9899 9797 9797 9897 9999 9999 9798 9495
|
||||
9192 8e8f 8b8c 8a8a 8a8a 8a8a 8a8a 898a
|
||||
8889 8586 8183 7f80 7e7e 7f7e 7f7f 7f7f
|
||||
7d7e 7b7c 797a 7778 7677 7676 7676 7676
|
||||
7475 7273 7071 6f6f 6e6e 6c6d 6b6c 696a
|
||||
6969 6969 6969 6969 6768 6667 6465 6364
|
||||
6263 6061 5f60 5f5f 5f5f 5f5f 5e5f 5d5d
|
||||
5b5c 595a 5859 5757 5757 5858 5858 5757
|
||||
5757 5657 5455 5454 5354 5353 5253 5152
|
||||
5050 4f50 4f4f 5050 4f4f 4e4f 4e4e 4d4d
|
||||
4e4e 4e4e 4e4e 4d4e 4c4c 4a4b 494a 4949
|
||||
4949 4949 4949 4949 4949 4848 4747 4847
|
||||
4848 4748 4747 4647 4646 4646 4546 4445
|
||||
4444 4444 4444 4444 4343 4343 4343 4343
|
||||
4343 4343 4242 4141 4040 3f3f 3f3f 4040
|
||||
4141 4041 3e3f 3d3d 3d3d 3d3d 3d3d 3e3e
|
||||
3d3d 3d3d 3c3d 3b3c 3a3b 393a 3939 3a39
|
||||
3b3a 3b3b 3a3b 3839 3838 3738 3637 3636
|
||||
3736 3838 3838 3738 3637 3435 3333 3534
|
||||
3435 3233 3332 3333 3534 3334 3233 3132
|
||||
3131 3232 3232 3232 3232 3232 3132 2e2f
|
||||
2e2e 2f2e 3030 3030 3030 3030 3030 3030
|
||||
3030 3030 3030 3030 3030 3030 3030 3030
|
||||
3030 3030 3030 3030 3030 3030 3030 3030
|
||||
3030 3030 3131 3332 3434 3435 3333 3333
|
||||
3333 3433 3635 3737 3636 3636 3636 3837
|
||||
3a39 3a3a 3939 3a3a 3c3b 3c3c 3b3b 3c3b
|
||||
3e3d 403f 4040 4040 4140 4242 4343 4443
|
||||
4544 4746 4847 4848 4948 4a4a 4b4a 4c4c
|
||||
4d4c 4f4e 504f 5151 5151 5251 5453 5554
|
||||
5656 5857 5a59 5b5b 5c5c 5d5d 5f5e 605f
|
||||
6160 6261 6463 6564 6666 6867 6968 6a69
|
||||
6c6b 6e6d 6f6f 7070 7171 7372 7574 7676
|
||||
7877 7978 7a7a 7c7b 7e7d 7f7f 8180 8281
|
||||
8483 8584 8686 8887 8a89 8b8a 8c8c 8e8d
|
||||
908f 9190 9392 9493 9695 9897 9998 9a9a
|
||||
9b9a 9d9c 9f9e a1a0 a2a2 a4a3 a5a5 a6a6
|
||||
a7a7 a9a8 aaa9 acab aead b0af b1b0 b2b1
|
||||
b4b3 b5b4 b6b5 b8b7 bab9 bcbb bdbc bebd
|
||||
bfbe c1c0 c3c3 c3c3 c4c3 c5c4 c7c6 c9c8
|
||||
cbca cccb cccc cecd cfcf cfcf d1cf d4d3
|
||||
d5d4 d5d5 d6d6 d8d7 dad9 dcdb dcdc dddd
|
||||
dedd dddd dddd dfde e2e1 e3e2 e3e3 e3e3
|
||||
e3e3 e4e3 e4e4 e7e5 e9e8 e9e9 eaea eaea
|
||||
ebea ebeb ebeb ecec edec eeee efef eeef
|
||||
eeee eeee efef efef efef f0f0 f0f0 f0f0
|
||||
f1f0 f1f1 f1f1 f1f1 f1f1 f1f1 f1f1 f2f1
|
||||
f2f2 f2f2 f2f2 f2f2 f2f2 f1f2 f0f0 efef
|
||||
f0ef f0f0 eff0 eeef eeee efee efef efef
|
||||
eeef eced ebeb ebeb ebeb e9ea e9e9 e8e8
|
||||
e7e7 e6e6 e5e6 e5e5 e4e5 e3e4 e2e2 e1e2
|
||||
e0e0 dfdf dede ddde dcdc dbdb dadb d8d9
|
||||
d7d7 d6d7 d4d5 d3d4 d1d2 d0d0 cecf cccd
|
||||
cbcc cacb caca c8c9 c6c7 c4c5 c2c3 c0c1
|
||||
bfc0 bebf bdbd bbbc b9ba b8b9 b6b7 b4b5
|
||||
b2b3 b0b1 afaf adae acac aaab a8a9 a5a7
|
||||
a3a4 a2a3 a0a1 9fa0 9d9e 9b9c 999a 9899
|
||||
9697 9495 9293 9091 8f8f 8d8e 8b8c 898a
|
||||
8788 8586 8484 8283 8081 7e7f 7d7e 7b7c
|
||||
797a 7878 7677 7475 7273 7172 6f70 6e6f
|
||||
6c6d 6a6b 6869 6767 6566 6465 6262 6061
|
||||
5f60 5d5e 5c5d 5a5b 595a 5859 5758 5556
|
||||
5455 5354 5252 5051 4f50 4d4e 4c4d 4b4c
|
||||
4a4a 4849 4748 4647 4646 4545 4344 4242
|
||||
4142 4041 3f40 3f3f 3e3e 3d3e 3b3c 3a3b
|
||||
3a3a 3a3a 3a3a 393a 3939 3738 3636 3536
|
||||
3334 3333 3433 3434 3334 3333 3233 3232
|
||||
3132 3131 3131 3132 2f31 2e2e 2d2e 2e2e
|
||||
2f2f 302f 3030 3030 2f30 2e2e 2e2e 2e2e
|
||||
2e2e 2e2d 2f2e 2f2f 2f2f 2f2f 2f2f 2f2f
|
||||
2f2f 2f2f 3030 3131 3131 3131 3131 3131
|
||||
3131 3232 3332 3433 3434 3535 3434 3434
|
||||
3535 3635 3736 3737 3838 3838 3838 3939
|
||||
3a3a 3b3b 3c3c 3d3c 3d3d 3e3d 3e3e 3f3f
|
||||
403f 4140 4241 4342 4444 4544 4545 4645
|
||||
4746 4747 4848 4949 4a4a 4b4b 4c4c 4d4c
|
||||
4e4e 4f4f 5050 5150 5251 5353 5454 5554
|
||||
5655 5756 5857 5959 5a59 5b5a 5c5b 5d5c
|
||||
5e5e 5f5e 6060 6161 6262 6362 6463 6565
|
||||
6666 6767 6868 6969 6a6a 6b6b 6d6c 6e6d
|
||||
6f6e 706f 7170 7171 7272 7373 7574 7675
|
||||
7676 7777 7978 7a79 7b7a 7b7b 7c7c 7d7d
|
||||
7e7e 7f7f 8080 8181 8281 8382 8483 8484
|
||||
8585 8686 8787 8888 8989 8a8a 8b8a 8b8b
|
||||
8c8b 8d8c 8e8d 8f8e 8f8f 9090 9090 9191
|
||||
9191 9292 9393 9494 9594 9595 9695 9696
|
||||
9796 9797 9898 9998 9999 9a99 9a9a 9a9a
|
||||
9a9a 9b9b 9c9b 9c9c 9c9c 9d9d 9e9d 9e9e
|
||||
9f9e 9f9f 9f9f 9f9f 9f9f 9f9f 9f9f a0a0
|
||||
a0a0 a1a1 a1a1 a1a1 a1a1 a1a1 a2a2 a2a2
|
||||
a2a2 a2a2 a2a2 a2a2 a3a2 a3a3 a2a2 a2a2
|
||||
a2a2 a2a2 a2a2 a2a2 a3a3 a3a3 a3a3 a3a3
|
||||
a3a3 a2a3 a2a2 a2a2 a2a2 a2a2 a2a2 a2a2
|
||||
a2a2 a1a1 a1a1 a1a1 a1a1 a1a1 a1a1 a1a1
|
||||
a1a1 a0a1 a0a0 a0a0 a0a0 9f9f 9f9f 9f9f
|
||||
9e9f 9e9e 9e9e 9e9e 9e9e 9d9d 9d9d 9d9d
|
||||
9c9d 9c9c 9c9c 9b9b 9b9b 9b9b 9a9b 9a9a
|
||||
9a9a 9a9a 9999 9999 9899 9898 9898 9898
|
||||
9798 9797 9697 9696 9596 9595 9595 9595
|
||||
9495 9494 9394 9393 9393 9393 9292 9292
|
||||
9191 9191 9191 9091 9090 9090 8f8f 8e8f
|
||||
8e8e 8e8e 8d8e 8d8d 8d8d 8d8d 8c8d 8c8c
|
||||
8b8c 8b8b 8b8b 8a8a 8a8a 8a8a 8989 8989
|
||||
8989 8888 8888 8788 8787 8787 8787 8687
|
||||
8686 8686 8585 8585 8585 8485 8484 8484
|
||||
8484 8383 8383 8383 8283 8282 8282 8282
|
||||
8282 8282 8181 8181 8181 8080 8080 8080
|
||||
8080 8080 8080 8080 7f7f 7f7f 7f7f 7f7f
|
||||
7e7f 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7d7e 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7e7d 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 8080 8080 8080 8080
|
||||
8080 8080 8080 8080 8080 8181 8181 8181
|
||||
8181 8181 8181 8181 8181 8181 8181 8181
|
||||
8282 8282 8282 8282 8282 8282 8282 8282
|
||||
8282 8282 8282 8282 8282 8282 8382 8383
|
||||
8383 8383 8383 8383 8383 8383 8383 8383
|
||||
8383 8383 8383 8383 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8384 8383 8383 8383 8383 8383
|
||||
8383 8383 8383 8383 8383 8383 8383 8282
|
||||
8282 8282 8282 8282 8282 8282 8282 8282
|
||||
8181 8181 8181 8181 8181 8181 8181 8181
|
||||
8181 8080 8080 8080 8080 8080 8080 8080
|
||||
7f80 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7e7f 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7d7e
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7c7d
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7b7c
|
||||
7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b
|
||||
7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a
|
||||
7a7a 7a7a 7a7a 7979 7979 7979 7979 7979
|
||||
7979 7979 7979 7979 7979 7979 7979 7979
|
||||
7979 7979 7979 7979 7979 7979 7878 7878
|
||||
7878 7878 7878 7878 7878 7878 7878 7878
|
||||
7878 7878 7878 7878 7878 7978 7879 7979
|
||||
7878 7878 7878 7878 7979 7979 7979 7979
|
||||
7979 7979 7979 7979 7979 7979 7979 7979
|
||||
7979 7979 7979 7979 7979 7979 7979 7979
|
||||
7979 7979 7979 7a79 7a7a 7a7a 7a7a 7a7a
|
||||
7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a
|
||||
7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a 7a7a
|
||||
7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b
|
||||
7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b 7b7b
|
||||
7b7b 7b7b 7b7b 7b7b 7c7b 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7d7c 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 8080
|
||||
8080 8080 8080 8080 8080 8080 8080 8080
|
||||
8080 8080 8080 8080 8080 8080 8080 8080
|
||||
8181 8181 8181 8181 8181 8181 8181 8181
|
||||
8181 8181 8181 8181 8181 8181 8181 8282
|
||||
8282 8282 8282 8282 8282 8282 8282 8282
|
||||
8282 8282 8282 8282 8282 8282 8282 8282
|
||||
8383 8383 8383 8383 8383 8383 8383 8383
|
||||
8383 8383 8383 8383 8383 8383 8383 8383
|
||||
8383 8383 8383 8383 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8584 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8585 8585
|
||||
8585 8585 8585 8585 8585 8585 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8484 8484 8484 8484 8484 8484 8484 8484
|
||||
8383 8383 8383 8383 8383 8383 8383 8383
|
||||
8383 8383 8383 8383 8383 8383 8383 8383
|
||||
8283 8282 8282 8282 8282 8282 8282 8282
|
||||
8282 8282 8282 8282 8282 8282 8182 8181
|
||||
8181 8181 8181 8181 8181 8181 8181 8181
|
||||
8181 8181 8181 8181 8181 8080 8080 8080
|
||||
8080 8080 8080 8080 8080 8080 8080 8080
|
||||
8080 8080 8080 8080 8080 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7d7e
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
|
||||
7c7c 7c7c 7c7c 7c7c 7c7c 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d 7d7d
|
||||
7d7d 7d7d 7e7d 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7e7e
|
||||
7e7e 7e7e 7e7e 7e7e 7e7e 7e7e 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f 7f7f
|
||||
7f7f 7f7f 7f7f 7f7f
|
||||
]
|
||||
@kick/end
|
2998
src/devices/audio.c
2998
src/devices/audio.c
File diff suppressed because it is too large
Load diff
|
@ -15,6 +15,7 @@ typedef signed int Sint32;
|
|||
#define AUDIO_DEIMASK 0x0014
|
||||
#define AUDIO_DEOMASK 0x8000
|
||||
|
||||
#define AUDIO_BUFSIZE 256
|
||||
#define SAMPLE_FREQUENCY 44100
|
||||
#define POLYPHONY 4
|
||||
|
||||
|
@ -23,3 +24,4 @@ Uint16 audio_get_position(int instance);
|
|||
int audio_render(int instance, Sint16 *sample, Sint16 *end);
|
||||
void audio_start(int instance, Uint8 *d, Uxn *u);
|
||||
void audio_finished_handler(int instance);
|
||||
int audio_handler(void *ctx, Uint8 *out_stream, int len);
|
||||
|
|
55
src/uxnemu.c
55
src/uxnemu.c
|
@ -70,17 +70,29 @@ clamp(int v, int min, int max)
|
|||
static Uint8
|
||||
audio_dei(int instance, Uint8 *d, Uint8 port)
|
||||
{
|
||||
Uint8 *addr;
|
||||
Uint16 vu;
|
||||
if(!audio_id) return d[port];
|
||||
switch(port) {
|
||||
case 0x4: return audio_get_vu(instance);
|
||||
case 0x2:
|
||||
addr = d + 2;
|
||||
vu = audio_get_position(instance);
|
||||
POKE2(addr, vu); /* fall through */
|
||||
default: return d[port];
|
||||
}
|
||||
/*
|
||||
// Uint8 *addr;
|
||||
// Uint16 vu;
|
||||
// if(!audio_id) return d[port];
|
||||
// switch(port) {
|
||||
// case 0x4: return audio_get_vu(instance);
|
||||
// case 0x2:
|
||||
// addr = d + 2;
|
||||
// vu = audio_get_position(instance);
|
||||
// POKE2(addr, vu);
|
||||
// default: return d[port];
|
||||
// }
|
||||
*/
|
||||
// TODO: get envelope
|
||||
switch(port) {
|
||||
case 0x0:
|
||||
case 0x2:
|
||||
case 0x8:
|
||||
case 0xa:
|
||||
case 0xc: return PEEK2(d + port);
|
||||
default: return d[port];
|
||||
}
|
||||
return d[port];
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -135,19 +147,6 @@ emu_deo(Uxn *u, Uint8 addr, Uint8 value)
|
|||
|
||||
/* Handlers */
|
||||
|
||||
static void
|
||||
audio_callback(void *u, Uint8 *stream, int len)
|
||||
{
|
||||
int instance, running = 0;
|
||||
Sint16 *samples = (Sint16 *)stream;
|
||||
USED(u);
|
||||
SDL_memset(stream, 0, len);
|
||||
for(instance = 0; instance < POLYPHONY; instance++)
|
||||
running += audio_render(instance, samples, samples + len / 2);
|
||||
if(!running)
|
||||
SDL_PauseAudioDevice(audio_id, 1);
|
||||
}
|
||||
|
||||
void
|
||||
audio_finished_handler(int instance)
|
||||
{
|
||||
|
@ -259,8 +258,8 @@ emu_init(void)
|
|||
as.freq = SAMPLE_FREQUENCY;
|
||||
as.format = AUDIO_S16SYS;
|
||||
as.channels = 2;
|
||||
as.callback = audio_callback;
|
||||
as.samples = 512;
|
||||
as.callback = audio_handler;
|
||||
as.samples = AUDIO_BUFSIZE;
|
||||
as.userdata = NULL;
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
|
||||
return system_error("sdl", SDL_GetError());
|
||||
|
@ -389,8 +388,8 @@ handle_events(Uxn *u)
|
|||
}
|
||||
/* Audio */
|
||||
else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) {
|
||||
Uint8 *addr = &u->dev[0x30 + 0x10 * (event.type - audio0_event)];
|
||||
uxn_eval(u, PEEK2(addr));
|
||||
// Uint8 *addr = &u->dev[0x30 + 0x10 * (event.type - audio0_event)];
|
||||
// uxn_eval(u, PEEK2(addr));
|
||||
}
|
||||
/* Mouse */
|
||||
else if(event.type == SDL_MOUSEMOTION)
|
||||
|
|
Loading…
Reference in a new issue