mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 16:23:02 +00:00
Moved from Uint16 to Sint8 audio sample data type
This commit is contained in:
parent
d892f29ea1
commit
8c958d94a7
3 changed files with 53 additions and 88 deletions
|
@ -121,8 +121,9 @@ BRK
|
||||||
|
|
||||||
@play ( pitch -- )
|
@play ( pitch -- )
|
||||||
|
|
||||||
|
.adsr/ch3 PEK2 .Audio/adsr DEO2
|
||||||
;triangle-wave .Audio/addr DEO2
|
;triangle-wave .Audio/addr DEO2
|
||||||
;triangle-wave/end ;triangle-wave SUB2 #0001 SFT2 .Audio/len DEO2
|
;triangle-wave/end ;triangle-wave SUB2 .Audio/len DEO2
|
||||||
.Audio/pitch DEO
|
.Audio/pitch DEO
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
@ -194,7 +195,7 @@ BRK
|
||||||
.adsr/ch1 PEK2 .Audio/adsr DEO2
|
.adsr/ch1 PEK2 .Audio/adsr DEO2
|
||||||
.volume/ch1 PEK .Audio/volume DEO
|
.volume/ch1 PEK .Audio/volume DEO
|
||||||
;square-wave .Audio/addr DEO2
|
;square-wave .Audio/addr DEO2
|
||||||
;square-wave/end ;square-wave SUB2 #0001 SFT2 .Audio/len DEO2
|
;square-wave/end ;square-wave SUB2 .Audio/len DEO2
|
||||||
#00 SWP ;notes ADD2 GET .Audio/pitch DEO
|
#00 SWP ;notes ADD2 GET .Audio/pitch DEO
|
||||||
&listen2
|
&listen2
|
||||||
;track/ch2 #00 .head/pos PEK #08 DIV ADD2 GET
|
;track/ch2 #00 .head/pos PEK #08 DIV ADD2 GET
|
||||||
|
@ -205,7 +206,7 @@ BRK
|
||||||
.adsr/ch2 PEK2 .Audio/adsr DEO2
|
.adsr/ch2 PEK2 .Audio/adsr DEO2
|
||||||
.volume/ch2 PEK .Audio/volume DEO
|
.volume/ch2 PEK .Audio/volume DEO
|
||||||
;triangle-wave .Audio/addr DEO2
|
;triangle-wave .Audio/addr DEO2
|
||||||
;triangle-wave/end ;triangle-wave SUB2 #0001 SFT2 .Audio/len DEO2
|
;triangle-wave/end ;triangle-wave SUB2 .Audio/len DEO2
|
||||||
#00 SWP ;notes ADD2 GET .Audio/pitch DEO
|
#00 SWP ;notes ADD2 GET .Audio/pitch DEO
|
||||||
&listen3
|
&listen3
|
||||||
;track/ch3 #00 .head/pos PEK #08 DIV ADD2 GET
|
;track/ch3 #00 .head/pos PEK #08 DIV ADD2 GET
|
||||||
|
@ -216,7 +217,7 @@ BRK
|
||||||
.adsr/ch3 PEK2 .Audio/adsr DEO2
|
.adsr/ch3 PEK2 .Audio/adsr DEO2
|
||||||
.volume/ch3 PEK .Audio/volume DEO
|
.volume/ch3 PEK .Audio/volume DEO
|
||||||
;sine-wave .Audio/addr DEO2
|
;sine-wave .Audio/addr DEO2
|
||||||
;sine-wave/end ;sine-wave SUB2 #0001 SFT2 .Audio/len DEO2
|
;sine-wave/end ;sine-wave SUB2 .Audio/len DEO2
|
||||||
#00 SWP ;notes ADD2 GET .Audio/pitch DEO
|
#00 SWP ;notes ADD2 GET .Audio/pitch DEO
|
||||||
&listen4
|
&listen4
|
||||||
;track/ch4 #00 .head/pos PEK #08 DIV ADD2 GET
|
;track/ch4 #00 .head/pos PEK #08 DIV ADD2 GET
|
||||||
|
@ -227,7 +228,7 @@ BRK
|
||||||
#0000 .Audio/adsr DEO2
|
#0000 .Audio/adsr DEO2
|
||||||
.volume/ch4 PEK .Audio/volume DEO
|
.volume/ch4 PEK .Audio/volume DEO
|
||||||
;noise-wave .Audio/addr DEO2
|
;noise-wave .Audio/addr DEO2
|
||||||
;noise-wave-end ;noise-wave SUB2 #0001 SFT2 .Audio/len DEO2
|
;noise-wave-end ;noise-wave SUB2 .Audio/len DEO2
|
||||||
#00 SWP ;notes ADD2 GET #80 ORA .Audio/pitch DEO
|
#00 SWP ;notes ADD2 GET #80 ORA .Audio/pitch DEO
|
||||||
&end
|
&end
|
||||||
|
|
||||||
|
@ -602,59 +603,39 @@ RTN
|
||||||
]
|
]
|
||||||
|
|
||||||
@square-wave
|
@square-wave
|
||||||
a800 5800
|
a8 58
|
||||||
&end
|
&end
|
||||||
|
|
||||||
@triangle-wave
|
@triangle-wave
|
||||||
8000 81ff 83ff 85ff 87ff 89ff 8bff 8dff 8fff 91ff 93ff 95ff 97ff
|
0002 0406 080a 0c0e 1012 1416 181a 1c1e 2022 2426 282a 2c2e
|
||||||
99ff 9bff 9dff 9fff a1ff a3ff a5ff a7ff a9ff abff adff afff b1ff
|
3032 3436 383a 3c3e 4041 4345 4749 4b4d 4f51 5355 5759 5b5d
|
||||||
b3ff b5ff b7ff b9ff bbff bdff bfff c1ff c3ff c5ff c7ff c9ff cbff
|
5f61 6365 6769 6b6d 6f71 7375 7779 7b7d 7f7d 7b79 7775 7371
|
||||||
cdff cfff d1ff d3ff d5ff d7ff d9ff dbff ddff dfff e1ff e3ff e5ff
|
6f6d 6b69 6765 6361 5f5d 5b59 5755 5351 4f4d 4b49 4745 4341
|
||||||
e7ff e9ff ebff edff efff f1ff f3ff f5ff f7ff f9ff fbff fdff ffff
|
403e 3c3a 3836 3432 302e 2c2a 2826 2422 201e 1c1a 1816 1412
|
||||||
fdff fbff f9ff f7ff f5ff f3ff f1ff efff edff ebff e9ff e7ff e5ff
|
100e 0c0a 0806 0402 00fe fcfa f8f6 f4f2 f0ee ecea e8e6 e4e2
|
||||||
e3ff e1ff dfff ddff dbff d9ff d7ff d5ff d3ff d1ff cfff cdff cbff
|
e0de dcda d8d6 d4d2 d0ce ccca c8c6 c4c2 c1bf bdbb b9b7 b5b3
|
||||||
c9ff c7ff c5ff c3ff c1ff bfff bdff bbff b9ff b7ff b5ff b3ff b1ff
|
b1af adab a9a7 a5a3 a19f 9d9b 9997 9593 918f 8d8b 8987 8583
|
||||||
afff adff abff a9ff a7ff a5ff a3ff a1ff 9fff 9dff 9bff 99ff 97ff
|
8183 8587 898b 8d8f 9193 9597 999b 9d9f a1a3 a5a7 a9ab adaf
|
||||||
95ff 93ff 91ff 8fff 8dff 8bff 89ff 87ff 85ff 83ff 81ff 8000 7e00
|
b1b3 b5b7 b9bb bdbf c1c2 c4c6 c8ca ccce d0d2 d4d6 d8da dcde
|
||||||
7c00 7a00 7800 7600 7400 7200 7000 6e00 6c00 6a00 6800 6600 6400
|
e0e2 e4e6 e8ea ecee f0f2 f4f6 f8fa fcfe
|
||||||
6200 6000 5e00 5c00 5a00 5800 5600 5400 5200 5000 4e00 4c00 4a00
|
|
||||||
4800 4600 4400 4200 4000 3e00 3c00 3a00 3800 3600 3400 3200 3000
|
|
||||||
2e00 2c00 2a00 2800 2600 2400 2200 2000 1e00 1c00 1a00 1800 1600
|
|
||||||
1400 1200 1000 0e00 0c00 0a00 0800 0600 0400 0200 0001 0200 0400
|
|
||||||
0600 0800 0a00 0c00 0e00 1000 1200 1400 1600 1800 1a00 1c00 1e00
|
|
||||||
2000 2200 2400 2600 2800 2a00 2c00 2e00 3000 3200 3400 3600 3800
|
|
||||||
3a00 3c00 3e00 4000 4200 4400 4600 4800 4a00 4c00 4e00 5000 5200
|
|
||||||
5400 5600 5800 5a00 5c00 5e00 6000 6200 6400 6600 6800 6a00 6c00
|
|
||||||
6e00 7000 7200 7400 7600 7800 7a00 7c00 7e00
|
|
||||||
&end
|
&end
|
||||||
|
|
||||||
@sine-wave
|
@sine-wave
|
||||||
8000 84c5 8989 8e49 9305 97b9 9c66 a108 a59e aa27 aea1 b30a b761
|
0004 090e 1217 1c20 2529 2e32 363b 3f43 474b 4e52 5659 5c60
|
||||||
bba5 bfd3 c3ea c7ea cbcf cf9a d349 d6d9 da4b dd9d e0cd e3db e6c6
|
6365 686b 6d70 7274 7677 797a 7b7c 7d7e 7e7e 7e7e 7e7e 7d7c
|
||||||
e98b ec2c eea6 f0f8 f322 f523 f6fb f8a8 fa2a fb81 fcac fdaa fe7c
|
7b7a 7978 7674 7270 6e6b 6966 6360 5d5a 5753 4f4c 4844 403c
|
||||||
ff20 ff98 ffe2 fffe ffed ffae ff42 fea9 fde3 fcef fbd0 fa84 f90c
|
3833 2f2a 2621 1d18 140f 0a05 01fc f7f2 eee9 e4e0 dbd7 d2ce
|
||||||
f76a f59d f3a6 f186 ef3e ecce ea37 e77b e499 e194 de6c db23 d7b9
|
cac5 c1bd b9b5 b1ae aaa7 a3a0 9d9a 9795 9290 8e8c 8a88 8785
|
||||||
d430 d088 ccc5 c8e6 c4ed c0db bcb2 b874 b422 afbd ab47 a6c1 a22e
|
8483 8282 8181 8181 8181 8282 8384 8687 898a 8c8e 9193 9598
|
||||||
9d8f 98e5 9433 8f79 8ab9 85f6 8131 7c6b 77a7 72e5 6e28 6972 64c4
|
9b9e a1a4 a8ab afb2 b6ba bec2 c6cb cfd3 d8dc e1e6 eaef f4f8
|
||||||
601f 5b85 56f9 527b 4e0e 49b2 4569 4136 3d18 3913 3527 3155 2d9f
|
fd02 070b 1015 191e 2327 2c30 3439 3d41 4549 4d50 5457 5b5e
|
||||||
2a07 268d 2333 1ffb 1ce4 19f1 1721 1478 11f4 0f98 0d64 0b58 0976
|
6164 676a 6c6e 7173 7576 7879 7b7c 7d7d 7e7e 7e7e 7e7e 7d7d
|
||||||
07be 0631 04d0 039a 0290 01b4 0104 0081 002c 0004 0009 003d 009d
|
7c7b 7a78 7775 7371 6f6d 6a68 6562 5f5c 5855 514e 4a46 423e
|
||||||
012b 01e7 02cf 03e3 0524 0691 0828 09eb 0bd7 0ded 102b 1292 151f
|
3a35 312d 2824 1f1b 1611 0d08 03fe faf5 f0eb e7e2 ded9 d5d0
|
||||||
17d2 1aaa 1da6 20c6 2407 2769 2aea 2e8a 3247 361f 3a12 3e1d 4240
|
ccc7 c3bf bbb7 b3b0 aca8 a5a2 9f9c 9996 9491 8f8d 8b89 8786
|
||||||
4679 4ac7 4f27 5399 581b 5cab 6147 65ee 6a9f 6f57 7415 78d8 7d9d
|
8584 8382 8181 8181 8181 8182 8384 8586 8889 8b8d 8f92 9497
|
||||||
8262 8727 8bea 90a8 9560 9a11 9eb8 a354 a7e4 ac66 b0d8 b538 b986
|
9a9c 9fa3 a6a9 adb1 b4b8 bcc0 c4c9 cdd1 d6da dfe3 e8ed f1f6
|
||||||
bdbf c1e2 c5ed c9e0 cdb8 d175 d515 d896 dbf8 df39 e259 e555 e82d
|
fb
|
||||||
eae0 ed6d efd4 f212 f428 f614 f7d7 f96e fadb fc1c fd30 fe18 fed4
|
|
||||||
ff62 ffc2 fff6 fffb ffd3 ff7e fefb fe4b fd6f fc65 fb2f f9ce f841
|
|
||||||
f689 f4a7 f29b f067 ee0b eb87 e8de e60e e31b e004 dccc d972 d5f8
|
|
||||||
d260 ceaa cad8 c6ec c2e7 bec9 ba96 b64d b1f1 ad84 a906 a47a 9fe0
|
|
||||||
9b3b 968d 91d7 8d1a 8858 8394 7ece 7a09 7546 7086 6bcc 671a 6270
|
|
||||||
5dd1 593e 54b8 5042 4bdd 478b 434d 3f24 3b12 3719 333a 2f77 2bcf
|
|
||||||
2846 24dc 2193 1e6b 1b66 1884 15c8 1331 10c1 0e79 0c59 0a62 0895
|
|
||||||
06f3 057b 042f 0310 021c 0156 00bd 0051 0012 0001 001d 0067 00df
|
|
||||||
0183 0255 0353 047e 05d5 0757 0904 0adc 0cdd 0f07 1159 13d3 1674
|
|
||||||
1939 1c24 1f32 2262 25b4 2926 2cb6 3065 3430 3815 3c15 402c 445a
|
|
||||||
489e 4cf5 515e 55d8 5a61 5ef7 6399 6846 6cfa 71b6 7676 7b3a
|
|
||||||
&end
|
&end
|
||||||
|
|
||||||
@noise-wave-end
|
@noise-wave-end
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
;on-frame .Screen/vector DEO2 ( run on-frame every 1/60th of a second )
|
;on-frame .Screen/vector DEO2 ( run on-frame every 1/60th of a second )
|
||||||
#ff .Audio/volume DEO ( set volume to max )
|
#ff .Audio/volume DEO ( set volume to max )
|
||||||
;saw .Audio/addr DEO2 ( set waveform to saw for audio engine )
|
;saw .Audio/addr DEO2 ( set waveform to saw for audio engine )
|
||||||
;saw/end ;saw SUB2 #0002 SFT2 .Audio/len DEO2
|
;saw/end ;saw SUB2 .Audio/len DEO2
|
||||||
#1202 .Audio/adsr DEO2 ( set envelope for audio engine )
|
#1202 .Audio/adsr DEO2 ( set envelope for audio engine )
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
@ -59,38 +59,22 @@ BRK
|
||||||
( defines a sawtooth wave. )
|
( defines a sawtooth wave. )
|
||||||
|
|
||||||
@saw ( -> )
|
@saw ( -> )
|
||||||
dfa0 df40 dee0 de80 de20 ddc0 dd60 dd00
|
5f5f 5e5e 5e5d 5d5d 5c5c 5b5b 5b5a 5a5a
|
||||||
dca0 dc40 dbe0 db80 db20 dac0 da60 da00
|
5959 5858 5857 5757 5656 5555 5554 5454
|
||||||
d9a0 d940 d8e0 d880 d820 d7c0 d760 d700
|
5353 5252 5251 5151 5050 4f4f 4f4e 4e4e
|
||||||
d6a0 d640 d5e0 d580 d520 d4c0 d460 d400
|
4d4d 4c4c 4c4b 4b4b 4a4a 4949 4948 4848
|
||||||
d3a0 d340 d2e0 d280 d220 d1c0 d160 d100
|
4747 4646 4645 4545 4444 4343 4342 4242
|
||||||
d0a0 d040 cfe0 cf80 cf20 cec0 ce60 ce00
|
4141 4040 403f 3f3f 3e3e 3d3d 3d3c 3c3c
|
||||||
cda0 cd40 cce0 cc80 cc20 cbc0 cb60 cb00
|
3b3b 3a3a 3a39 3939 3838 3737 3736 3636
|
||||||
caa0 ca40 c9e0 c980 c920 c8c0 c860 c800
|
3535 3434 3433 3333 3232 3131 3130 3030
|
||||||
c7a0 c740 c6e0 c680 c620 c5c0 c560 c500
|
2f2f 2e2e 2e2d 2d2d 2c2c 2b2b 2b2a 2a2a
|
||||||
c4a0 c440 c3e0 c380 c320 c2c0 c260 c200
|
2929 2828 2827 2727 2626 2525 2524 2424
|
||||||
c1a0 c140 c0e0 c080 c020 bfc0 bf60 bf00
|
2323 2222 2221 2121 2020 1f1f 1f1e 1e1e
|
||||||
bea0 be40 bde0 bd80 bd20 bcc0 bc60 bc00
|
1d1d 1c1c 1c1b 1b1b 1a1a 1919 1918 1818
|
||||||
bba0 bb40 bae0 ba80 ba20 b9c0 b960 b900
|
1717 1616 1615 1515 1414 1313 1312 1212
|
||||||
b8a0 b840 b7e0 b780 b720 b6c0 b660 b600
|
1111 1010 100f 0f0f 0e0e 0d0d 0d0c 0c0c
|
||||||
b5a0 b540 b4e0 b480 b420 b3c0 b360 b300
|
0b0b 0a0a 0a09 0909 0808 0707 0706 0606
|
||||||
b2a0 b240 b1e0 b180 b120 b0c0 b060 b000
|
0505 0404 0403 0303 0202 0101 0100 0000
|
||||||
afa0 af40 aee0 ae80 ae20 adc0 ad60 ad00
|
|
||||||
aca0 ac40 abe0 ab80 ab20 aac0 aa60 aa00
|
|
||||||
a9a0 a940 a8e0 a880 a820 a7c0 a760 a700
|
|
||||||
a6a0 a640 a5e0 a580 a520 a4c0 a460 a400
|
|
||||||
a3a0 a340 a2e0 a280 a220 a1c0 a160 a100
|
|
||||||
a0a0 a040 9fe0 9f80 9f20 9ec0 9e60 9e00
|
|
||||||
9da0 9d40 9ce0 9c80 9c20 9bc0 9b60 9b00
|
|
||||||
9aa0 9a40 99e0 9980 9920 98c0 9860 9800
|
|
||||||
97a0 9740 96e0 9680 9620 95c0 9560 9500
|
|
||||||
94a0 9440 93e0 9380 9320 92c0 9260 9200
|
|
||||||
91a0 9140 90e0 9080 9020 8fc0 8f60 8f00
|
|
||||||
8ea0 8e40 8de0 8d80 8d20 8cc0 8c60 8c00
|
|
||||||
8ba0 8b40 8ae0 8a80 8a20 89c0 8960 8900
|
|
||||||
88a0 8840 87e0 8780 8720 86c0 8660 8600
|
|
||||||
85a0 8540 84e0 8480 8420 83c0 8360 8300
|
|
||||||
82a0 8240 81e0 8180 8120 80c0 8060 8000
|
|
||||||
&end
|
&end
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
|
@ -53,9 +53,9 @@ apu_render(Apu *c, Sint16 *sample, Sint16 *end)
|
||||||
}
|
}
|
||||||
c->i %= c->len;
|
c->i %= c->len;
|
||||||
}
|
}
|
||||||
s = (Sint16)(mempeek16(c->addr, c->i * 2) + 0x8000) * envelope(c, c->age++);
|
s = (Sint8)(c->addr[c->i]) * envelope(c, c->age++);
|
||||||
*sample++ += s * c->volume_l / 0x8000;
|
*sample++ += s * c->volume_l / 0x80;
|
||||||
*sample++ += s * c->volume_r / 0x8000;
|
*sample++ += s * c->volume_r / 0x80;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue