Compare commits
835 Commits
mainline-0
...
mainline-0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb06235b14 | ||
|
|
60121d8f28 | ||
|
|
fb41c82aaa | ||
|
|
25d607f5f6 | ||
|
|
aa4c7687ee | ||
|
|
fa5a1a4bfd | ||
|
|
53e49e5360 | ||
|
|
bcafef4b94 | ||
|
|
dab7711524 | ||
|
|
f0d9ab0717 | ||
|
|
da07977db0 | ||
|
|
d5fe722a30 | ||
|
|
9764c13d6d | ||
|
|
ac2e2ebe97 | ||
|
|
157fc2d785 | ||
|
|
9106ac1e6b | ||
|
|
21b18057f7 | ||
|
|
87ff58b1d7 | ||
|
|
ae5725b709 | ||
|
|
64fbf319f1 | ||
|
|
82b7daed9c | ||
|
|
dc81a90640 | ||
|
|
5169ce9fcd | ||
|
|
59c46f9de9 | ||
|
|
12d16248dd | ||
|
|
f20e18f60d | ||
|
|
95d156a150 | ||
|
|
85cfd96f62 | ||
|
|
82e0eeed21 | ||
|
|
a2a0f5318d | ||
|
|
69e82d01d5 | ||
|
|
b02464f685 | ||
|
|
c192da3f82 | ||
|
|
8d55c8c855 | ||
|
|
3f048c8646 | ||
|
|
388cf58b31 | ||
|
|
b36896b90e | ||
|
|
aa87278bf0 | ||
|
|
0383363a8f | ||
|
|
22ba437aa4 | ||
|
|
dfdac7d38a | ||
|
|
f57be2e626 | ||
|
|
7d77a3f88f | ||
|
|
c7a06908ae | ||
|
|
06f8c3dc01 | ||
|
|
d0649d0971 | ||
|
|
954341763a | ||
|
|
994a9fec4e | ||
|
|
6433b1dfd6 | ||
|
|
bea51d948d | ||
|
|
6d2f9428c5 | ||
|
|
4991620f89 | ||
|
|
916438a9de | ||
|
|
40571c073f | ||
|
|
14c825bd1c | ||
|
|
5d4715cc6a | ||
|
|
87d6588cb5 | ||
|
|
0c81b83ca9 | ||
|
|
8bc3d66354 | ||
|
|
19a8f03ad5 | ||
|
|
b377da042b | ||
|
|
28281ae250 | ||
|
|
7dbdda908c | ||
|
|
1defd0847a | ||
|
|
80fece4e08 | ||
|
|
0dc4ab42cc | ||
|
|
453560fb3a | ||
|
|
c8a4967c9d | ||
|
|
1b9e08ab78 | ||
|
|
1e191cc837 | ||
|
|
5dbda22659 | ||
|
|
5836530a87 | ||
|
|
868c397cb6 | ||
|
|
17badbc442 | ||
|
|
d7f5e55f8e | ||
|
|
64fad8cfe9 | ||
|
|
29ccc7673f | ||
|
|
c243932b41 | ||
|
|
1279c7ce7a | ||
|
|
c3e201a829 | ||
|
|
d5984284ed | ||
|
|
10b0ab7926 | ||
|
|
82fa9f8d56 | ||
|
|
51cddcb8b8 | ||
|
|
2ddd83cdfe | ||
|
|
8b95bf041d | ||
|
|
93cb783853 | ||
|
|
d5e0923e3d | ||
|
|
d46ca5a015 | ||
|
|
46183294b2 | ||
|
|
f9653a4417 | ||
|
|
54ea3c47c8 | ||
|
|
5836786246 | ||
|
|
51a7681957 | ||
|
|
d6d1a8e02c | ||
|
|
89df483567 | ||
|
|
a5750f437d | ||
|
|
ccb439efb0 | ||
|
|
0b47f7a46b | ||
|
|
79316be18c | ||
|
|
ec100ca4db | ||
|
|
873ad1272e | ||
|
|
8cb683f3b9 | ||
|
|
5d29d2111c | ||
|
|
ac3b4f918f | ||
|
|
9b023a56a3 | ||
|
|
f3db273753 | ||
|
|
2e1b998d5e | ||
|
|
37bec068c2 | ||
|
|
df6427d30b | ||
|
|
c96930fd9d | ||
|
|
292dd642ce | ||
|
|
761206cf81 | ||
|
|
1c773c0869 | ||
|
|
69b46dd607 | ||
|
|
c918c6480f | ||
|
|
37194dd4e9 | ||
|
|
4de079b256 | ||
|
|
8941cdb7d2 | ||
|
|
dfee6321cd | ||
|
|
0195038c07 | ||
|
|
ac3ec5ed13 | ||
|
|
cdb36aef9e | ||
|
|
5e9b77129f | ||
|
|
2d47a5fd41 | ||
|
|
3802474483 | ||
|
|
d1a2b3fb18 | ||
|
|
b1657b8c6b | ||
|
|
ec8548b414 | ||
|
|
4e94d0d53a | ||
|
|
bab9cae71f | ||
|
|
6d6115475b | ||
|
|
b06d6e3646 | ||
|
|
5fe55b16a1 | ||
|
|
5329834376 | ||
|
|
52f13f2339 | ||
|
|
e94dd7e2c4 | ||
|
|
ce5fcb6bb2 | ||
|
|
20aad9e01a | ||
|
|
6f41763061 | ||
|
|
05a703e15d | ||
|
|
0e54aa17e6 | ||
|
|
2de124e223 | ||
|
|
aeb100cffe | ||
|
|
f1d633cca7 | ||
|
|
6057dc46e5 | ||
|
|
deff708cbe | ||
|
|
a9cfe06aaf | ||
|
|
009bdb3558 | ||
|
|
a44ff5ed31 | ||
|
|
00c6254129 | ||
|
|
e15039372e | ||
|
|
0eb6c6cd83 | ||
|
|
51e6f8271a | ||
|
|
6b7320add4 | ||
|
|
215cfbb757 | ||
|
|
97dd67ad1c | ||
|
|
607bb8d14b | ||
|
|
b57ba7bfb6 | ||
|
|
3415890dd5 | ||
|
|
4bd74ed4c7 | ||
|
|
f782aecf4d | ||
|
|
09fa1d6a73 | ||
|
|
45c5b084fd | ||
|
|
edcbd47800 | ||
|
|
5cd051eced | ||
|
|
12f3b13995 | ||
|
|
3ef35207c1 | ||
|
|
5d2f18fbcd | ||
|
|
3954f14c6d | ||
|
|
9ae6224f12 | ||
|
|
a58d57a60d | ||
|
|
24cabf5e2f | ||
|
|
7234f436aa | ||
|
|
4c5f5c9bf3 | ||
|
|
8a00a0ade6 | ||
|
|
43f0b42088 | ||
|
|
23aabe85e6 | ||
|
|
69af6ada2f | ||
|
|
9e7a1f1351 | ||
|
|
ce0712bf95 | ||
|
|
bcc5c4403a | ||
|
|
2dce2be138 | ||
|
|
0791082b43 | ||
|
|
5933667cb8 | ||
|
|
e31cb50405 | ||
|
|
3373149fdc | ||
|
|
0e122c13ad | ||
|
|
eea5122d1b | ||
|
|
b8fbf6969c | ||
|
|
feac654ba0 | ||
|
|
5cb1a343d1 | ||
|
|
0dc234c5ea | ||
|
|
716ae72aac | ||
|
|
d637114c17 | ||
|
|
7e5f595b31 | ||
|
|
88959b0047 | ||
|
|
dd05c7ec79 | ||
|
|
53a04d6b5d | ||
|
|
c67c25db05 | ||
|
|
1bdb756d28 | ||
|
|
d4ae0ae0e9 | ||
|
|
9b492430bb | ||
|
|
ed4d1e2ade | ||
|
|
b1b4f2337e | ||
|
|
165d8485f0 | ||
|
|
960500cfd2 | ||
|
|
8fd921557f | ||
|
|
4d3be1816c | ||
|
|
357d79fb6e | ||
|
|
d2c0c94f0b | ||
|
|
b1326d9230 | ||
|
|
bc59ca92b6 | ||
|
|
b9b7e4f915 | ||
|
|
ccce6cb3be | ||
|
|
4756cb203e | ||
|
|
8d3e06349e | ||
|
|
9e29e36a78 | ||
|
|
c10a37e5b6 | ||
|
|
7e5d0f1fe3 | ||
|
|
39d356782e | ||
|
|
d58a609ae4 | ||
|
|
493263f415 | ||
|
|
a3ccac3eb7 | ||
|
|
8dbfa4e1a4 | ||
|
|
e18ee8d681 | ||
|
|
a6e6cd5788 | ||
|
|
9dc69fa07c | ||
|
|
a1e7360273 | ||
|
|
f95602f152 | ||
|
|
c277d7d171 | ||
|
|
f6d4a289d5 | ||
|
|
f2f346e110 | ||
|
|
414a87a4f4 | ||
|
|
e6a896c4bd | ||
|
|
63419e144f | ||
|
|
2c375013dd | ||
|
|
b126267442 | ||
|
|
2a928d7492 | ||
|
|
7fbeb489d3 | ||
|
|
37d672bf08 | ||
|
|
1c8de85045 | ||
|
|
94af77aa7c | ||
|
|
677a8b208d | ||
|
|
c2f83c04cb | ||
|
|
fad38ec6e8 | ||
|
|
defa826c53 | ||
|
|
69aaad9b96 | ||
|
|
edd8208779 | ||
|
|
7cf34c3637 | ||
|
|
843ef8f2ec | ||
|
|
cf9767c608 | ||
|
|
424bffcd3f | ||
|
|
16aadcc354 | ||
|
|
395997178b | ||
|
|
5842a767a9 | ||
|
|
774d7eab64 | ||
|
|
88089c8754 | ||
|
|
1ea6bdef05 | ||
|
|
9abb23cd27 | ||
|
|
25f650e075 | ||
|
|
d39dfdf45c | ||
|
|
ece0ae2bfb | ||
|
|
7b4a213603 | ||
|
|
44f7067cab | ||
|
|
756225c8ff | ||
|
|
7bc3e80399 | ||
|
|
63b3b25715 | ||
|
|
4b9e1b6586 | ||
|
|
b7ef581c6e | ||
|
|
24cae76d16 | ||
|
|
c2ad1243ba | ||
|
|
63fd1bb503 | ||
|
|
c0870315fd | ||
|
|
9705f651b2 | ||
|
|
9423347c1b | ||
|
|
c042a89113 | ||
|
|
7b642c7781 | ||
|
|
6750b4d3af | ||
|
|
6314ed5de0 | ||
|
|
4eb7327559 | ||
|
|
312a8bd4b4 | ||
|
|
e0d30fc920 | ||
|
|
d7019d8307 | ||
|
|
d9b729bbfd | ||
|
|
1fde40b2c7 | ||
|
|
fca87cfa3e | ||
|
|
32f3b6b865 | ||
|
|
3dc310bd52 | ||
|
|
1dbe39f7a2 | ||
|
|
5bc4eabe36 | ||
|
|
f397edff0e | ||
|
|
073e07ae2d | ||
|
|
ee5e77fbf9 | ||
|
|
3898d8f0d7 | ||
|
|
1a954b2a59 | ||
|
|
ab315011fb | ||
|
|
4681e1ea9e | ||
|
|
2ccf85a910 | ||
|
|
9d3d0ae999 | ||
|
|
979b602738 | ||
|
|
322349e8cc | ||
|
|
e46f0e084c | ||
|
|
ebcee03b0c | ||
|
|
2c2b586d86 | ||
|
|
c9e3abe206 | ||
|
|
630823e363 | ||
|
|
b70751ccb9 | ||
|
|
e48e9a406c | ||
|
|
0e15c68f54 | ||
|
|
eab041866b | ||
|
|
b834c21894 | ||
|
|
d52ee6d0a7 | ||
|
|
dcfa1992ea | ||
|
|
b7f1095980 | ||
|
|
6f70e1b1ff | ||
|
|
9aeada734d | ||
|
|
e87670ee48 | ||
|
|
1dbf71ceb3 | ||
|
|
9014861858 | ||
|
|
d1da7eb119 | ||
|
|
0832da3e40 | ||
|
|
3359e5ab70 | ||
|
|
4fbe4da911 | ||
|
|
4fb5ca80c0 | ||
|
|
5f75d97125 | ||
|
|
7791cc8c2e | ||
|
|
e8b2fd21d8 | ||
|
|
fbda5e9ec9 | ||
|
|
410ed82922 | ||
|
|
7afb7a9494 | ||
|
|
6694e11303 | ||
|
|
ab25d1fe9a | ||
|
|
5ec6a265bf | ||
|
|
7fb7540d69 | ||
|
|
d04abd39eb | ||
|
|
e371d12af6 | ||
|
|
994f497781 | ||
|
|
5d1447897a | ||
|
|
874be0e3e1 | ||
|
|
2b05c32343 | ||
|
|
b546640c41 | ||
|
|
5c4774e8ce | ||
|
|
3a85bc1e77 | ||
|
|
e13a91fa9b | ||
|
|
5502f39125 | ||
|
|
ba3dd7b78f | ||
|
|
afd0e2ee87 | ||
|
|
185bf3fd28 | ||
|
|
8758378dc4 | ||
|
|
102630f2b2 | ||
|
|
d88baa746b | ||
|
|
acc14d233f | ||
|
|
b00f4abe36 | ||
|
|
c47c3d723f | ||
|
|
3794c91145 | ||
|
|
01db5cf203 | ||
|
|
ba3916fc67 | ||
|
|
3fcc98e11a | ||
|
|
5b441fa25d | ||
|
|
8469b76630 | ||
|
|
b7cd5d742e | ||
|
|
56ecafc204 | ||
|
|
715f0c3b0c | ||
|
|
bba7e8ea4b | ||
|
|
e883101999 | ||
|
|
1889b641d9 | ||
|
|
3f2e605dd1 | ||
|
|
6971d08893 | ||
|
|
6e37676482 | ||
|
|
5b6545b141 | ||
|
|
412044960a | ||
|
|
92344da20c | ||
|
|
6f8a06bac5 | ||
|
|
aaf262bfed | ||
|
|
bcaadac22c | ||
|
|
be4fc777c0 | ||
|
|
abda366362 | ||
|
|
0ca91ced2d | ||
|
|
b3c8997829 | ||
|
|
3cfd962ef4 | ||
|
|
0890451c55 | ||
|
|
2dc9dbb809 | ||
|
|
70812ec57b | ||
|
|
a78021580d | ||
|
|
b928fca114 | ||
|
|
8ace3959a5 | ||
|
|
908d3c5679 | ||
|
|
9a4beac95a | ||
|
|
e7e8a87927 | ||
|
|
b254d528bc | ||
|
|
ad50209383 | ||
|
|
d8ad2f3484 | ||
|
|
6f5b942897 | ||
|
|
97b2220a82 | ||
|
|
117bdc71e0 | ||
|
|
760a9e8693 | ||
|
|
30e0d1c973 | ||
|
|
91c06dae1a | ||
|
|
978ca65f59 | ||
|
|
e9e1876e82 | ||
|
|
38110dd485 | ||
|
|
d6a41cfc21 | ||
|
|
92fa5257c7 | ||
|
|
373408ae8c | ||
|
|
70f16f1722 | ||
|
|
9b501af8e3 | ||
|
|
652d6766d5 | ||
|
|
e02ef3c3be | ||
|
|
07b81f57ba | ||
|
|
31de52513e | ||
|
|
e3c2749986 | ||
|
|
b92bf51ae1 | ||
|
|
16e2e1c45f | ||
|
|
428ce8ec29 | ||
|
|
0a966e2cac | ||
|
|
ceb7b11f16 | ||
|
|
8f2959f680 | ||
|
|
8ead176639 | ||
|
|
64e174237e | ||
|
|
c0c4ed0d3b | ||
|
|
5cafa70d3b | ||
|
|
484623cd61 | ||
|
|
57d89e291d | ||
|
|
75eaab2e0f | ||
|
|
9d4edd4e88 | ||
|
|
0a50ba3bd1 | ||
|
|
cb826bcee7 | ||
|
|
ce718522bc | ||
|
|
87f220efff | ||
|
|
622830f4e1 | ||
|
|
9ea8cffe35 | ||
|
|
f5110340e6 | ||
|
|
c22d0d9945 | ||
|
|
fc4d692c50 | ||
|
|
31c12de0fe | ||
|
|
c433c0a746 | ||
|
|
945cfe234b | ||
|
|
9b24197ca0 | ||
|
|
8008b5ddc9 | ||
|
|
da7be67daf | ||
|
|
0aad914527 | ||
|
|
70df449d0a | ||
|
|
a6ecdf42bc | ||
|
|
9efbf5309f | ||
|
|
af1183a993 | ||
|
|
88192af8ac | ||
|
|
7bf9f9ae49 | ||
|
|
9f5facc3aa | ||
|
|
0785796372 | ||
|
|
e829973742 | ||
|
|
1e149dc18b | ||
|
|
dc5396a466 | ||
|
|
af477fb8c5 | ||
|
|
a0d7a2732d | ||
|
|
f6a89edb67 | ||
|
|
00fb79b2f3 | ||
|
|
91a45834fd | ||
|
|
0b75ec5316 | ||
|
|
c0ab5b79dc | ||
|
|
a111a9ae2c | ||
|
|
6f006d051e | ||
|
|
d62d28522b | ||
|
|
087f52e872 | ||
|
|
7aae6d6d2b | ||
|
|
6bbbbe8f85 | ||
|
|
fc6db97a09 | ||
|
|
4bfa411ddc | ||
|
|
46fdc94586 | ||
|
|
ee21b5378b | ||
|
|
222fe75401 | ||
|
|
448e4d5c2a | ||
|
|
4a4b685a04 | ||
|
|
4f0f481f63 | ||
|
|
1089d76736 | ||
|
|
848bdf8a40 | ||
|
|
7d2839d7a3 | ||
|
|
e67b8678f8 | ||
|
|
c6e1c46ac7 | ||
|
|
c64545d07a | ||
|
|
1d4cbb92f2 | ||
|
|
6053b95552 | ||
|
|
66edfd61c6 | ||
|
|
4a3fd97e48 | ||
|
|
d567b7e841 | ||
|
|
bca9591660 | ||
|
|
98f68d06f1 | ||
|
|
a0e5cccb92 | ||
|
|
6db0c0d8d9 | ||
|
|
14a97d082e | ||
|
|
50e52ade85 | ||
|
|
8aa9ae5ba5 | ||
|
|
131a75b65d | ||
|
|
11d0a6e7b8 | ||
|
|
26547d3e3b | ||
|
|
8049b8beb6 | ||
|
|
12eeffcb7c | ||
|
|
0d713cf8eb | ||
|
|
badea3b301 | ||
|
|
f8543249f0 | ||
|
|
5553bd3ba2 | ||
|
|
7dcf4c0018 | ||
|
|
ef29bf4515 | ||
|
|
3620206136 | ||
|
|
2dbb144fc6 | ||
|
|
89199ca215 | ||
|
|
9cfc5fee2f | ||
|
|
1a6b1bf1d7 | ||
|
|
c5134cbf3a | ||
|
|
c6d001c94f | ||
|
|
cf63eacc1a | ||
|
|
5333db91c1 | ||
|
|
c20569ebdf | ||
|
|
156556ddd2 | ||
|
|
475d46bb64 | ||
|
|
94eca09cf6 | ||
|
|
7af2cb4318 | ||
|
|
657771bdcb | ||
|
|
44b552be71 | ||
|
|
663e221f99 | ||
|
|
725fcbb368 | ||
|
|
a1f176ce52 | ||
|
|
1fd22823bc | ||
|
|
978e7897a3 | ||
|
|
55ac6f7a2b | ||
|
|
79da90cea8 | ||
|
|
4a451e5849 | ||
|
|
cdb2480d39 | ||
|
|
3fdb42e0b4 | ||
|
|
020519def8 | ||
|
|
9a44c1ea27 | ||
|
|
65e697de59 | ||
|
|
7d27a7a511 | ||
|
|
eb84e0f63a | ||
|
|
8e673cbb08 | ||
|
|
047e77e2f0 | ||
|
|
cce14b4cd7 | ||
|
|
6291975731 | ||
|
|
00decfbb07 | ||
|
|
111802bbbb | ||
|
|
3b5d5fa86f | ||
|
|
dcc26c54a5 | ||
|
|
c04203b786 | ||
|
|
cd92a94965 | ||
|
|
941563f981 | ||
|
|
d33399e1f4 | ||
|
|
ce69ff2890 | ||
|
|
c7f32931ee | ||
|
|
1828f82000 | ||
|
|
eb67a45ca8 | ||
|
|
9f08cea2c4 | ||
|
|
8bd246032a | ||
|
|
6b5f565324 | ||
|
|
3984bb6def | ||
|
|
54aabb00b0 | ||
|
|
1dd4132eb1 | ||
|
|
2f6ba54483 | ||
|
|
ae3a755d13 | ||
|
|
98f4c5e7b8 | ||
|
|
061a63547f | ||
|
|
fe53ee26ce | ||
|
|
9afbcd9e8a | ||
|
|
ab052cf684 | ||
|
|
6f6d83befa | ||
|
|
3e46934442 | ||
|
|
e7042163c8 | ||
|
|
85b5b816cf | ||
|
|
ea20b5c970 | ||
|
|
2f852f182a | ||
|
|
1fc61d09d3 | ||
|
|
e408bd3b7c | ||
|
|
2e74b79e89 | ||
|
|
3d592972dc | ||
|
|
678d012c2c | ||
|
|
fdd9154069 | ||
|
|
536c51912d | ||
|
|
88d5140cf2 | ||
|
|
940c3bf68d | ||
|
|
ea8345cdcd | ||
|
|
e03dc4d569 | ||
|
|
ff82f3894a | ||
|
|
f21a189148 | ||
|
|
298b50e220 | ||
|
|
acd35e1b60 | ||
|
|
60bd54776a | ||
|
|
e7a26ecec5 | ||
|
|
f1ead11df7 | ||
|
|
598ef6b0b3 | ||
|
|
54b977acaa | ||
|
|
0ab7bfdfce | ||
|
|
2190f1a2b7 | ||
|
|
743fe1aea3 | ||
|
|
be1954e04c | ||
|
|
c1577f3448 | ||
|
|
1eb908bc88 | ||
|
|
cb708631b6 | ||
|
|
363c644730 | ||
|
|
30b1e71066 | ||
|
|
36cfb234d5 | ||
|
|
7b3f5845d2 | ||
|
|
64f967fd49 | ||
|
|
dbd1662ae2 | ||
|
|
046c0c91a3 | ||
|
|
046cc81938 | ||
|
|
1d714c8c7f | ||
|
|
d47ac3ce09 | ||
|
|
1f186f34a2 | ||
|
|
ca416a0fb8 | ||
|
|
b9a9b83bee | ||
|
|
9f9b64d280 | ||
|
|
c5b3c8d06b | ||
|
|
39c8d18feb | ||
|
|
e4e0abc418 | ||
|
|
8db3feae19 | ||
|
|
62c6c9f6a6 | ||
|
|
d291fc1a51 | ||
|
|
b260847218 | ||
|
|
4c348f4069 | ||
|
|
419a59a7b1 | ||
|
|
f250011ba0 | ||
|
|
e1600b0962 | ||
|
|
61b246a3a9 | ||
|
|
0120e5b1d9 | ||
|
|
06e65de93c | ||
|
|
7a99226785 | ||
|
|
dffaffaac1 | ||
|
|
3446eb79b5 | ||
|
|
92adb69fa7 | ||
|
|
cd3e959f23 | ||
|
|
cc0dc3280d | ||
|
|
32b4627a9c | ||
|
|
e9b81e9f01 | ||
|
|
614bd0ee8c | ||
|
|
a54aee290f | ||
|
|
de4cadca1f | ||
|
|
a220d8799e | ||
|
|
2a24b1c973 | ||
|
|
182cf7d631 | ||
|
|
2f47b27654 | ||
|
|
283616dbd8 | ||
|
|
4d0ae1a17a | ||
|
|
f7808f5658 | ||
|
|
91bd2281bf | ||
|
|
7d287a6fb0 | ||
|
|
9a251339dc | ||
|
|
6380731486 | ||
|
|
1ba0b077fc | ||
|
|
cb56eaee41 | ||
|
|
3665a05488 | ||
|
|
392c1b96bc | ||
|
|
6ee1a784b8 | ||
|
|
d7843b8ef2 | ||
|
|
771a9c21cc | ||
|
|
385b5602e4 | ||
|
|
a1e3f6e27b | ||
|
|
09609dd50e | ||
|
|
2a82f1b08b | ||
|
|
02ea62568f | ||
|
|
ae6df703f5 | ||
|
|
ab88c2f611 | ||
|
|
2cbce77b92 | ||
|
|
9d665cb8db | ||
|
|
a8be822e8e | ||
|
|
e5a1e0a76d | ||
|
|
442096298e | ||
|
|
86e4aa81e9 | ||
|
|
fbb5ca2633 | ||
|
|
891090799c | ||
|
|
ad76b00f1e | ||
|
|
5c4e237902 | ||
|
|
3e4a0a13cb | ||
|
|
2978232390 | ||
|
|
03b574ae22 | ||
|
|
90c6141164 | ||
|
|
ca26fd0f42 | ||
|
|
dc83ca8914 | ||
|
|
4073931305 | ||
|
|
7c0908f301 | ||
|
|
966966dc02 | ||
|
|
8b4ecf22d4 | ||
|
|
111852a983 | ||
|
|
940d85241b | ||
|
|
4ed4bba305 | ||
|
|
e0f2db4376 | ||
|
|
4d4afc1502 | ||
|
|
f3a1bf53f9 | ||
|
|
2634e3c6eb | ||
|
|
3602df7f1f | ||
|
|
fa4294cc6f | ||
|
|
e3a615a616 | ||
|
|
67af0323f0 | ||
|
|
d66b897a6d | ||
|
|
ddff03cff5 | ||
|
|
10e8acc451 | ||
|
|
77532ebde3 | ||
|
|
cd6f4f7eed | ||
|
|
8b0f334e0c | ||
|
|
c307ae2402 | ||
|
|
6d9661939f | ||
|
|
ffeb4ef83e | ||
|
|
b14d344dfc | ||
|
|
aa35e51fcd | ||
|
|
e107870bc8 | ||
|
|
f43a1da808 | ||
|
|
d264b7375c | ||
|
|
b8219ec838 | ||
|
|
0dc6967ff1 | ||
|
|
fcd0145eb5 | ||
|
|
2b863c9aa3 | ||
|
|
ff45c39578 | ||
|
|
c07fd2898b | ||
|
|
a881efbf26 | ||
|
|
53829d4cbd | ||
|
|
7a504a9365 | ||
|
|
a2eb44db82 | ||
|
|
754109fd54 | ||
|
|
7003090187 | ||
|
|
8a85a562ed | ||
|
|
4f5bbe56ba | ||
|
|
58b0ae84b5 | ||
|
|
c5e257017f | ||
|
|
059dd724d6 | ||
|
|
91bca9eb0b | ||
|
|
ab961e0701 | ||
|
|
050a4a401b | ||
|
|
70499b8cbd | ||
|
|
8568f44ffa | ||
|
|
669005b75e | ||
|
|
40a72e9cd5 | ||
|
|
65d9def873 | ||
|
|
41c2f5200c | ||
|
|
53fc5d0190 | ||
|
|
9bdca01c27 | ||
|
|
8100275309 | ||
|
|
131532b570 | ||
|
|
31461589c5 | ||
|
|
9f51242524 | ||
|
|
3f6d83b27c | ||
|
|
4944d48ee8 | ||
|
|
ffc66f089d | ||
|
|
362e2940be | ||
|
|
9539e4d8fd | ||
|
|
aca3621146 | ||
|
|
1ee9ceb5af | ||
|
|
382bf1faf4 | ||
|
|
02b8b6677a | ||
|
|
8bbd82863d | ||
|
|
057aa6275d | ||
|
|
78b1bc3b61 | ||
|
|
fcd0925ecf | ||
|
|
1eae35621e | ||
|
|
62de0220fe | ||
|
|
a62c1999c5 | ||
|
|
0e80567bef | ||
|
|
aa8d6fc041 | ||
|
|
b0ae8265ea | ||
|
|
eb914b6c50 | ||
|
|
113a3972a6 | ||
|
|
004bfefeb5 | ||
|
|
9cd1ea338b | ||
|
|
66fc037ef2 | ||
|
|
99b372a6c5 | ||
|
|
3a8464cde2 | ||
|
|
ba7eb5abf4 | ||
|
|
b5f4221c3d | ||
|
|
33e4a0b6c1 | ||
|
|
a4392c24cf | ||
|
|
637ab14ae6 | ||
|
|
bc8ace9917 | ||
|
|
0bac7b6a95 | ||
|
|
e0dd440b1f | ||
|
|
1a9774f824 | ||
|
|
ec2a6e5ba8 | ||
|
|
042567e4b2 | ||
|
|
5fc6bf96d8 | ||
|
|
508f2072a9 | ||
|
|
f4400f3ba2 | ||
|
|
ec634b6a88 | ||
|
|
b5784e9af2 | ||
|
|
324029d4f9 | ||
|
|
9f6892271f | ||
|
|
03179ecafe | ||
|
|
41b8ecdeb6 | ||
|
|
57162e1df3 | ||
|
|
663ea382da | ||
|
|
d90961122c | ||
|
|
09126f3a4a | ||
|
|
ffdf8c0cb3 | ||
|
|
c715fc4c5e | ||
|
|
40968e3993 | ||
|
|
cd643ab5c9 | ||
|
|
180fa6859f | ||
|
|
188a3cf74c | ||
|
|
9652973db2 | ||
|
|
9e87193725 | ||
|
|
5b6268d26a | ||
|
|
797564599f | ||
|
|
6ee8eab670 | ||
|
|
0774b17846 | ||
|
|
8e18b61972 | ||
|
|
df3cbd4758 | ||
|
|
ff679f3d17 | ||
|
|
5043036688 | ||
|
|
b65456b958 | ||
|
|
076e4d44c3 | ||
|
|
1ec71b6ea0 | ||
|
|
f95ea04995 | ||
|
|
371226448a | ||
|
|
6597b3817c | ||
|
|
7299356f37 | ||
|
|
72b2f5d34f | ||
|
|
aeec0f8a38 | ||
|
|
5ce3015945 | ||
|
|
5219615418 | ||
|
|
92c162126b | ||
|
|
43ce33b6cc | ||
|
|
c5a78f4480 | ||
|
|
29a0ca2391 | ||
|
|
80ac1331b5 | ||
|
|
1f1c3bddc0 | ||
|
|
1b3d86c02f | ||
|
|
0947f613b1 | ||
|
|
1b8fe7073b | ||
|
|
3dcbba38bf | ||
|
|
f4eb7dceaf | ||
|
|
b924c71822 | ||
|
|
8a497adf85 | ||
|
|
d68856ab12 | ||
|
|
380658c21d | ||
|
|
4d4bbe756f | ||
|
|
9b38f4fc55 | ||
|
|
1adf640d37 | ||
|
|
34635a42c0 | ||
|
|
24620bc4ea | ||
|
|
b178c9a349 |
@@ -5,7 +5,7 @@ cd /yuzu
|
||||
ccache -s
|
||||
|
||||
mkdir build || true && cd build
|
||||
cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DYUZU_USE_BUNDLED_UNICORN=ON -DYUZU_USE_QT_WEB_ENGINE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON
|
||||
cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON
|
||||
|
||||
ninja
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ cd /yuzu
|
||||
ccache -s
|
||||
|
||||
mkdir build || true && cd build
|
||||
cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_UNICORN=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON
|
||||
cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON
|
||||
ninja
|
||||
|
||||
ccache -s
|
||||
|
||||
@@ -4,9 +4,11 @@ parameters:
|
||||
version: ''
|
||||
|
||||
steps:
|
||||
- script: choco install vulkan-sdk
|
||||
displayName: 'Install vulkan-sdk'
|
||||
- script: python -m pip install --upgrade pip conan
|
||||
displayName: 'Install conan'
|
||||
- script: mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 --config Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_UNICORN=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cd ..
|
||||
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 --config Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cd ..
|
||||
displayName: 'Configure CMake'
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build'
|
||||
|
||||
@@ -9,6 +9,7 @@ stages:
|
||||
displayName: 'build'
|
||||
jobs:
|
||||
- job: build
|
||||
timeoutInMinutes: 120
|
||||
displayName: 'windows-msvc'
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
|
||||
5
.gitmodules
vendored
@@ -1,15 +1,12 @@
|
||||
[submodule "inih"]
|
||||
path = externals/inih/inih
|
||||
url = https://github.com/svn2github/inih
|
||||
url = https://github.com/benhoyt/inih.git
|
||||
[submodule "cubeb"]
|
||||
path = externals/cubeb
|
||||
url = https://github.com/kinetiknz/cubeb.git
|
||||
[submodule "dynarmic"]
|
||||
path = externals/dynarmic
|
||||
url = https://github.com/MerryMage/dynarmic.git
|
||||
[submodule "unicorn"]
|
||||
path = externals/unicorn
|
||||
url = https://github.com/yuzu-emu/unicorn
|
||||
[submodule "soundtouch"]
|
||||
path = externals/soundtouch
|
||||
url = https://github.com/citra-emu/ext-soundtouch.git
|
||||
|
||||
@@ -6,8 +6,5 @@ extraction:
|
||||
packages:
|
||||
- "libsdl2-dev"
|
||||
- "qtmultimedia5-dev"
|
||||
- "clang-format-10"
|
||||
- "libtbb-dev"
|
||||
- "libjack-jackd2-dev"
|
||||
- "doxygen"
|
||||
- "graphviz"
|
||||
|
||||
@@ -4,16 +4,8 @@ cd /yuzu
|
||||
# override Travis CI unreasonable ccache size
|
||||
echo 'max_size = 3.0G' > "$HOME/.ccache/ccache.conf"
|
||||
|
||||
# Dirty hack to trick unicorn makefile into believing we are in a MINGW system
|
||||
mv /bin/uname /bin/uname1 && echo -e '#!/bin/sh\necho MINGW64' >> /bin/uname
|
||||
chmod +x /bin/uname
|
||||
|
||||
# Dirty hack to trick unicorn makefile into believing we have cmd
|
||||
echo '' >> /bin/cmd
|
||||
chmod +x /bin/cmd
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_UNICORN=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release
|
||||
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release
|
||||
ninja
|
||||
|
||||
# Clean up the dirty hacks
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
mkdir -p "$HOME/.ccache"
|
||||
docker run -e ENABLE_COMPATIBILITY_REPORTING --env-file .travis/common/travis-ci.env -v $(pwd):/yuzu -v "$HOME/.ccache":/root/.ccache yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.travis/linux/docker.sh
|
||||
docker run -e ENABLE_COMPATIBILITY_REPORTING --env-file .travis/common/travis-ci.env -v $(pwd):/yuzu -v "$HOME/.ccache":/home/yuzu/.ccache yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.travis/linux/docker.sh
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
cd /yuzu
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja -DYUZU_USE_BUNDLED_UNICORN=ON -DYUZU_USE_QT_WEB_ENGINE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON
|
||||
cmake .. -G Ninja -DYUZU_USE_QT_WEB_ENGINE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON
|
||||
ninja
|
||||
|
||||
ccache -s
|
||||
|
||||
@@ -4,13 +4,12 @@ set -o pipefail
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.14
|
||||
export Qt5_DIR=$(brew --prefix)/opt/qt5
|
||||
export UNICORNDIR=$(pwd)/externals/unicorn
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
|
||||
# TODO: Build using ninja instead of make
|
||||
mkdir build && cd build
|
||||
cmake --version
|
||||
cmake .. -DYUZU_USE_BUNDLED_UNICORN=ON -DYUZU_USE_QT_WEB_ENGINE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DUSE_DISCORD_PRESENCE=ON
|
||||
cmake .. -DYUZU_USE_QT_WEB_ENGINE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DUSE_DISCORD_PRESENCE=ON
|
||||
make -j4
|
||||
|
||||
ccache -s
|
||||
|
||||
128
CMakeLists.txt
@@ -18,16 +18,12 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "EN
|
||||
|
||||
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
||||
|
||||
option(YUZU_USE_BUNDLED_UNICORN "Build/Download bundled Unicorn" ON)
|
||||
|
||||
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
|
||||
|
||||
option(YUZU_ENABLE_BOXCAT "Enable the Boxcat service, a yuzu high-level implementation of BCAT" ON)
|
||||
|
||||
option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
|
||||
|
||||
option(ENABLE_VULKAN "Enables Vulkan backend" ON)
|
||||
|
||||
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
||||
|
||||
# Default to a Release build
|
||||
@@ -115,6 +111,9 @@ if (NOT DEFINED ARCHITECTURE)
|
||||
endif()
|
||||
message(STATUS "Target architecture: ${ARCHITECTURE}")
|
||||
|
||||
if (UNIX)
|
||||
add_definitions(-DYUZU_UNIX=1)
|
||||
endif()
|
||||
|
||||
# Configure C++ standard
|
||||
# ===========================
|
||||
@@ -159,9 +158,8 @@ macro(yuzu_find_packages)
|
||||
# Capitalization matters here. We need the naming to match the generated paths from Conan
|
||||
set(REQUIRED_LIBS
|
||||
# Cmake Pkg Prefix Version Conan Pkg
|
||||
"Boost 1.73 boost/1.73.0"
|
||||
"Catch2 2.13 catch2/2.13.0"
|
||||
"fmt 7.0 fmt/7.0.3"
|
||||
"fmt 7.1 fmt/7.1.2"
|
||||
# can't use until https://github.com/bincrafters/community/issues/1173
|
||||
#"libzip 1.5 libzip/1.5.2@bincrafters/stable"
|
||||
"lz4 1.8 lz4/1.9.2"
|
||||
@@ -194,6 +192,22 @@ macro(yuzu_find_packages)
|
||||
unset(FN_FORCE_REQUIRED)
|
||||
endmacro()
|
||||
|
||||
find_package(Boost 1.73.0 COMPONENTS context headers QUIET)
|
||||
if (Boost_FOUND)
|
||||
set(Boost_LIBRARIES Boost::boost)
|
||||
# Conditionally add Boost::context only if the active version of the Conan or system Boost package provides it
|
||||
# The old version is missing Boost::context, so we want to avoid adding in that case
|
||||
# The new version requires adding Boost::context to prevent linking issues
|
||||
#
|
||||
# This one is used by Conan on subsequent CMake configures, not the first configure.
|
||||
if (TARGET Boost::context)
|
||||
list(APPEND Boost_LIBRARIES Boost::context)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Boost 1.73.0 or newer not found, falling back to Conan")
|
||||
list(APPEND CONAN_REQUIRED_LIBS "boost/1.73.0")
|
||||
endif()
|
||||
|
||||
# Attempt to locate any packages that are required and report the missing ones in CONAN_REQUIRED_LIBS
|
||||
yuzu_find_packages()
|
||||
|
||||
@@ -210,7 +224,7 @@ if(ENABLE_QT)
|
||||
set(QT_PREFIX_HINT)
|
||||
if(YUZU_USE_BUNDLED_QT)
|
||||
if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64)
|
||||
set(QT_VER qt-5.12.0-msvc2017_64)
|
||||
set(QT_VER qt-5.12.8-msvc2017_64)
|
||||
else()
|
||||
message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
|
||||
endif()
|
||||
@@ -263,6 +277,7 @@ if (CONAN_REQUIRED_LIBS)
|
||||
libzip:with_openssl=False
|
||||
libzip:enable_windows_crypto=False
|
||||
)
|
||||
|
||||
conan_check(VERSION 1.24.0 REQUIRED)
|
||||
# Add the bincrafters remote
|
||||
conan_add_remote(NAME bincrafters
|
||||
@@ -297,6 +312,17 @@ if (CONAN_REQUIRED_LIBS)
|
||||
# this time with required, so we bail if its not found.
|
||||
yuzu_find_packages(FORCE_REQUIRED)
|
||||
|
||||
if (NOT Boost_FOUND)
|
||||
find_package(Boost 1.73.0 REQUIRED COMPONENTS context headers)
|
||||
set(Boost_LIBRARIES Boost::boost)
|
||||
# Conditionally add Boost::context only if the active version of the Conan Boost package provides it
|
||||
# The old version is missing Boost::context, so we want to avoid adding in that case
|
||||
# The new version requires adding Boost::context to prevent linking issues
|
||||
if (TARGET Boost::context)
|
||||
list(APPEND Boost_LIBRARIES Boost::context)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Due to issues with variable scopes in functions, we need to also find_package(qt5) outside of the function
|
||||
if(ENABLE_QT)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}")
|
||||
@@ -354,85 +380,23 @@ if (NOT LIBUSB_FOUND)
|
||||
set(LIBUSB_LIBRARIES usb)
|
||||
endif()
|
||||
|
||||
# Use system installed ffmpeg.
|
||||
if (NOT MSVC)
|
||||
find_package(FFmpeg REQUIRED)
|
||||
else()
|
||||
set(FFMPEG_EXT_NAME "ffmpeg-4.2.1")
|
||||
set(FFMPEG_PATH "${CMAKE_BINARY_DIR}/externals/${FFMPEG_EXT_NAME}")
|
||||
download_bundled_external("ffmpeg/" ${FFMPEG_EXT_NAME} "")
|
||||
set(FFMPEG_FOUND YES)
|
||||
set(FFMPEG_INCLUDE_DIR "${FFMPEG_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE)
|
||||
set(FFMPEG_LIBRARY_DIR "${FFMPEG_PATH}/bin" CACHE PATH "Path to FFmpeg library" FORCE)
|
||||
set(FFMPEG_DLL_DIR "${FFMPEG_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE)
|
||||
endif()
|
||||
|
||||
# Prefer the -pthread flag on Linux.
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# If unicorn isn't found, msvc -> download bundled unicorn; everyone else -> build external
|
||||
if (YUZU_USE_BUNDLED_UNICORN)
|
||||
if (MSVC)
|
||||
message(STATUS "unicorn not found, falling back to bundled")
|
||||
# Detect toolchain and platform
|
||||
if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64)
|
||||
set(UNICORN_VER "unicorn-yuzu")
|
||||
else()
|
||||
message(FATAL_ERROR "No bundled Unicorn binaries for your toolchain. Disable YUZU_USE_BUNDLED_UNICORN and provide your own.")
|
||||
endif()
|
||||
|
||||
if (DEFINED UNICORN_VER)
|
||||
download_bundled_external("unicorn/" ${UNICORN_VER} UNICORN_PREFIX)
|
||||
endif()
|
||||
|
||||
if (DEFINED UNICORN_VER)
|
||||
download_bundled_external("unicorn/" ${UNICORN_VER} UNICORN_PREFIX)
|
||||
endif()
|
||||
|
||||
set(UNICORN_FOUND YES)
|
||||
set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE)
|
||||
set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/lib/x64/unicorn_dynload.lib" CACHE PATH "Path to Unicorn library" FORCE)
|
||||
set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/lib/x64/" CACHE PATH "Path to unicorn.dll" FORCE)
|
||||
else()
|
||||
message(STATUS "unicorn not found, falling back to externals")
|
||||
if (MINGW)
|
||||
set(UNICORN_LIB_NAME "unicorn.a")
|
||||
else()
|
||||
set(UNICORN_LIB_NAME "libunicorn.a")
|
||||
endif()
|
||||
|
||||
set(UNICORN_FOUND YES)
|
||||
set(UNICORN_PREFIX ${PROJECT_SOURCE_DIR}/externals/unicorn)
|
||||
set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/${UNICORN_LIB_NAME}" CACHE PATH "Path to Unicorn library" FORCE)
|
||||
set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE)
|
||||
set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/" CACHE PATH "Path to unicorn dynamic library" FORCE)
|
||||
|
||||
find_package(PythonInterp 2.7 REQUIRED)
|
||||
|
||||
if (MINGW)
|
||||
# Intentionally call the unicorn makefile directly instead of using make.sh so that we can override the
|
||||
# UNAME_S makefile variable to MINGW. This way we don't have to hack at the uname binary to build
|
||||
# Additionally, overriding DO_WINDOWS_EXPORT prevents unicorn from patching the static unicorn.a by using msvc and cmd,
|
||||
# which are both things we don't have in a mingw cross compiling environment.
|
||||
add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
|
||||
COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar RANLIB=x86_64-w64-mingw32-gcc-ranlib make UNAME_S=MINGW DO_WINDOWS_EXPORT=0
|
||||
WORKING_DIRECTORY ${UNICORN_PREFIX}
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
|
||||
COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh macos-universal-no
|
||||
WORKING_DIRECTORY ${UNICORN_PREFIX}
|
||||
)
|
||||
endif()
|
||||
|
||||
# ALL makes this custom target build every time
|
||||
# but it won't actually build if LIBUNICORN_LIBRARY is up to date
|
||||
add_custom_target(unicorn-build ALL
|
||||
DEPENDS ${LIBUNICORN_LIBRARY}
|
||||
)
|
||||
unset(UNICORN_LIB_NAME)
|
||||
endif()
|
||||
else()
|
||||
find_package(Unicorn REQUIRED)
|
||||
endif()
|
||||
|
||||
if (UNICORN_FOUND)
|
||||
add_library(unicorn INTERFACE)
|
||||
add_dependencies(unicorn unicorn-build)
|
||||
target_link_libraries(unicorn INTERFACE "${LIBUNICORN_LIBRARY}")
|
||||
target_include_directories(unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}")
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find or build unicorn which is required.")
|
||||
endif()
|
||||
|
||||
# Platform-specific library requirements
|
||||
# ======================================
|
||||
|
||||
|
||||
10
CMakeModules/CopyYuzuFFmpegDeps.cmake
Normal file
@@ -0,0 +1,10 @@
|
||||
function(copy_yuzu_FFmpeg_deps target_dir)
|
||||
include(WindowsCopyFiles)
|
||||
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
|
||||
windows_copy_files(${target_dir} ${FFMPEG_DLL_DIR} ${DLL_DEST}
|
||||
avcodec-58.dll
|
||||
avutil-56.dll
|
||||
swresample-3.dll
|
||||
swscale-5.dll
|
||||
)
|
||||
endfunction(copy_yuzu_FFmpeg_deps)
|
||||
@@ -1,9 +0,0 @@
|
||||
function(copy_yuzu_unicorn_deps target_dir)
|
||||
include(WindowsCopyFiles)
|
||||
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
|
||||
windows_copy_files(${target_dir} ${UNICORN_DLL_DIR} ${DLL_DEST}
|
||||
libgcc_s_seh-1.dll
|
||||
libwinpthread-1.dll
|
||||
unicorn.dll
|
||||
)
|
||||
endfunction(copy_yuzu_unicorn_deps)
|
||||
BIN
dist/icons/controller/applet_dual_joycon.png
vendored
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
dist/icons/controller/applet_dual_joycon_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
dist/icons/controller/applet_dual_joycon_dark_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
dist/icons/controller/applet_dual_joycon_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
dist/icons/controller/applet_dual_joycon_midnight.png
vendored
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
dist/icons/controller/applet_dual_joycon_midnight_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
dist/icons/controller/applet_handheld.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
dist/icons/controller/applet_handheld_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
dist/icons/controller/applet_handheld_dark_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
dist/icons/controller/applet_handheld_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
dist/icons/controller/applet_handheld_midnight.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
dist/icons/controller/applet_handheld_midnight_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
dist/icons/controller/applet_pro_controller.png
vendored
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
dist/icons/controller/applet_pro_controller_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
dist/icons/controller/applet_pro_controller_dark_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
dist/icons/controller/applet_pro_controller_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
dist/icons/controller/applet_pro_controller_midnight.png
vendored
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
dist/icons/controller/applet_pro_controller_midnight_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
dist/icons/controller/applet_single_joycon_left.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
dist/icons/controller/applet_single_joycon_left_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
dist/icons/controller/applet_single_joycon_left_dark_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
dist/icons/controller/applet_single_joycon_left_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
dist/icons/controller/applet_single_joycon_left_midnight.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
dist/icons/controller/applet_single_joycon_left_midnight_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
dist/icons/controller/applet_single_joycon_right.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
dist/icons/controller/applet_single_joycon_right_dark.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
dist/icons/controller/applet_single_joycon_right_dark_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
dist/icons/controller/applet_single_joycon_right_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
dist/icons/controller/applet_single_joycon_right_midnight.png
vendored
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
dist/icons/controller/applet_single_joycon_right_midnight_disabled.png
vendored
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
30
dist/icons/controller/controller.qrc
vendored
@@ -21,5 +21,35 @@
|
||||
<file alias="single_joycon_right_vertical">single_joycon_right_vertical.png</file>
|
||||
<file alias="single_joycon_right_vertical_dark">single_joycon_right_vertical_dark.png</file>
|
||||
<file alias="single_joycon_right_vertical_midnight">single_joycon_right_vertical_midnight.png</file>
|
||||
<file alias="applet_dual_joycon">applet_dual_joycon.png</file>
|
||||
<file alias="applet_dual_joycon_dark">applet_dual_joycon_dark.png</file>
|
||||
<file alias="applet_dual_joycon_midnight">applet_dual_joycon_midnight.png</file>
|
||||
<file alias="applet_handheld">applet_handheld.png</file>
|
||||
<file alias="applet_handheld_dark">applet_handheld_dark.png</file>
|
||||
<file alias="applet_handheld_midnight">applet_handheld_midnight.png</file>
|
||||
<file alias="applet_pro_controller">applet_pro_controller.png</file>
|
||||
<file alias="applet_pro_controller_dark">applet_pro_controller_dark.png</file>
|
||||
<file alias="applet_pro_controller_midnight">applet_pro_controller_midnight.png</file>
|
||||
<file alias="applet_joycon_left">applet_single_joycon_left.png</file>
|
||||
<file alias="applet_joycon_left_dark">applet_single_joycon_left_dark.png</file>
|
||||
<file alias="applet_joycon_left_midnight">applet_single_joycon_left_midnight.png</file>
|
||||
<file alias="applet_joycon_right">applet_single_joycon_right.png</file>
|
||||
<file alias="applet_joycon_right_dark">applet_single_joycon_right_dark.png</file>
|
||||
<file alias="applet_joycon_right_midnight">applet_single_joycon_right_midnight.png</file>
|
||||
<file alias="applet_dual_joycon_disabled">applet_dual_joycon_disabled.png</file>
|
||||
<file alias="applet_dual_joycon_dark_disabled">applet_dual_joycon_dark_disabled.png</file>
|
||||
<file alias="applet_dual_joycon_midnight_disabled">applet_dual_joycon_midnight_disabled.png</file>
|
||||
<file alias="applet_handheld_disabled">applet_handheld_disabled.png</file>
|
||||
<file alias="applet_handheld_dark_disabled">applet_handheld_dark_disabled.png</file>
|
||||
<file alias="applet_handheld_midnight_disabled">applet_handheld_midnight_disabled.png</file>
|
||||
<file alias="applet_pro_controller_disabled">applet_pro_controller_disabled.png</file>
|
||||
<file alias="applet_pro_controller_dark_disabled">applet_pro_controller_dark_disabled.png</file>
|
||||
<file alias="applet_pro_controller_midnight_disabled">applet_pro_controller_midnight_disabled.png</file>
|
||||
<file alias="applet_joycon_left_disabled">applet_single_joycon_left_disabled.png</file>
|
||||
<file alias="applet_joycon_left_dark_disabled">applet_single_joycon_left_dark_disabled.png</file>
|
||||
<file alias="applet_joycon_left_midnight_disabled">applet_single_joycon_left_midnight_disabled.png</file>
|
||||
<file alias="applet_joycon_right_disabled">applet_single_joycon_right_disabled.png</file>
|
||||
<file alias="applet_joycon_right_dark_disabled">applet_single_joycon_right_dark_disabled.png</file>
|
||||
<file alias="applet_joycon_right_midnight_disabled">applet_single_joycon_right_midnight_disabled.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
4749
dist/languages/de.ts
vendored
Normal file
4757
dist/languages/es.ts
vendored
Normal file
4732
dist/languages/fr.ts
vendored
Normal file
4724
dist/languages/it.ts
vendored
Normal file
4752
dist/languages/ja_JP.ts
vendored
Normal file
4719
dist/languages/nl.ts
vendored
Normal file
4713
dist/languages/pl.ts
vendored
Normal file
4757
dist/languages/pt_BR.ts
vendored
Normal file
4725
dist/languages/pt_PT.ts
vendored
Normal file
4720
dist/languages/ru_RU.ts
vendored
Normal file
4747
dist/languages/zh_CN.ts
vendored
Normal file
200
dist/qt_themes/default/style.qss
vendored
@@ -1,3 +1,7 @@
|
||||
QAbstractSpinBox {
|
||||
min-height: 19px;
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton {
|
||||
color: #959595;
|
||||
border: 1px solid transparent;
|
||||
@@ -35,10 +39,103 @@ QPushButton#RendererStatusBarButton:!checked {
|
||||
}
|
||||
|
||||
QPushButton#buttonRefreshDevices {
|
||||
min-width: 20px;
|
||||
min-height: 20px;
|
||||
max-width: 20px;
|
||||
max-height: 20px;
|
||||
min-width: 21px;
|
||||
min-height: 21px;
|
||||
max-width: 21px;
|
||||
max-height: 21px;
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput,
|
||||
QWidget#topControllerApplet,
|
||||
QWidget#bottomControllerApplet,
|
||||
QGroupBox#groupPlayer1Connected:checked,
|
||||
QGroupBox#groupPlayer2Connected:checked,
|
||||
QGroupBox#groupPlayer3Connected:checked,
|
||||
QGroupBox#groupPlayer4Connected:checked,
|
||||
QGroupBox#groupPlayer5Connected:checked,
|
||||
QGroupBox#groupPlayer6Connected:checked,
|
||||
QGroupBox#groupPlayer7Connected:checked,
|
||||
QGroupBox#groupPlayer8Connected:checked {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
QWidget#topControllerApplet {
|
||||
border-bottom: 1px solid #828790
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput,
|
||||
QWidget#bottomControllerApplet {
|
||||
border-top: 1px solid #828790
|
||||
}
|
||||
|
||||
QWidget#topPerGameInput,
|
||||
QWidget#middleControllerApplet {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
QWidget#topPerGameInput QComboBox,
|
||||
QWidget#middleControllerApplet QComboBox {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
QWidget#connectedControllers {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QWidget#playersSupported,
|
||||
QWidget#controllersSupported,
|
||||
QWidget#controllerSupported1,
|
||||
QWidget#controllerSupported2,
|
||||
QWidget#controllerSupported3,
|
||||
QWidget#controllerSupported4,
|
||||
QWidget#controllerSupported5,
|
||||
QWidget#controllerSupported6 {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected,
|
||||
QGroupBox#groupPlayer2Connected,
|
||||
QGroupBox#groupPlayer3Connected,
|
||||
QGroupBox#groupPlayer4Connected,
|
||||
QGroupBox#groupPlayer5Connected,
|
||||
QGroupBox#groupPlayer6Connected,
|
||||
QGroupBox#groupPlayer7Connected,
|
||||
QGroupBox#groupPlayer8Connected {
|
||||
border: 1px solid #828790;
|
||||
border-radius: 3px;
|
||||
padding: 0px;
|
||||
min-height: 98px;
|
||||
max-height: 98px;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected:unchecked,
|
||||
QGroupBox#groupPlayer2Connected:unchecked,
|
||||
QGroupBox#groupPlayer3Connected:unchecked,
|
||||
QGroupBox#groupPlayer4Connected:unchecked,
|
||||
QGroupBox#groupPlayer5Connected:unchecked,
|
||||
QGroupBox#groupPlayer6Connected:unchecked,
|
||||
QGroupBox#groupPlayer7Connected:unchecked,
|
||||
QGroupBox#groupPlayer8Connected:unchecked {
|
||||
border: 1px solid #d9d9d9;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected::title,
|
||||
QGroupBox#groupPlayer2Connected::title,
|
||||
QGroupBox#groupPlayer3Connected::title,
|
||||
QGroupBox#groupPlayer4Connected::title,
|
||||
QGroupBox#groupPlayer5Connected::title,
|
||||
QGroupBox#groupPlayer6Connected::title,
|
||||
QGroupBox#groupPlayer7Connected::title,
|
||||
QGroupBox#groupPlayer8Connected::title {
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top left;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding-top: 1px;
|
||||
margin-left: 0px;
|
||||
margin-right: -4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
QCheckBox#checkboxPlayer1Connected,
|
||||
@@ -52,6 +149,42 @@ QCheckBox#checkboxPlayer8Connected {
|
||||
spacing: 0px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox,
|
||||
QWidget#Player2LEDs QCheckBox,
|
||||
QWidget#Player3LEDs QCheckBox,
|
||||
QWidget#Player4LEDs QCheckBox,
|
||||
QWidget#Player5LEDs QCheckBox,
|
||||
QWidget#Player6LEDs QCheckBox,
|
||||
QWidget#Player7LEDs QCheckBox,
|
||||
QWidget#Player8LEDs QCheckBox {
|
||||
spacing: 0px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator,
|
||||
QWidget#Player2LEDs QCheckBox::indicator,
|
||||
QWidget#Player3LEDs QCheckBox::indicator,
|
||||
QWidget#Player4LEDs QCheckBox::indicator,
|
||||
QWidget#Player5LEDs QCheckBox::indicator,
|
||||
QWidget#Player6LEDs QCheckBox::indicator,
|
||||
QWidget#Player7LEDs QCheckBox::indicator,
|
||||
QWidget#Player8LEDs QCheckBox::indicator {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer1Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer2Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer3Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer4Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer5Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer6Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer7Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer8Connected::indicator {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
QCheckBox#checkboxPlayer1Connected::indicator,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator,
|
||||
@@ -64,6 +197,34 @@ QCheckBox#checkboxPlayer8Connected::indicator {
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected::indicator,
|
||||
QGroupBox#groupPlayer2Connected::indicator,
|
||||
QGroupBox#groupPlayer3Connected::indicator,
|
||||
QGroupBox#groupPlayer4Connected::indicator,
|
||||
QGroupBox#groupPlayer5Connected::indicator,
|
||||
QGroupBox#groupPlayer6Connected::indicator,
|
||||
QGroupBox#groupPlayer7Connected::indicator,
|
||||
QGroupBox#groupPlayer8Connected::indicator {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player2LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player3LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player4LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player5LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player6LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player7LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player8LEDs QCheckBox::indicator:checked,
|
||||
QGroupBox#groupPlayer1Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer2Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer3Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer4Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer5Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer6Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer7Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer8Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer1Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator:checked,
|
||||
@@ -74,11 +235,27 @@ QCheckBox#checkboxPlayer7Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer8Connected::indicator:checked,
|
||||
QGroupBox#groupConnectedController::indicator:checked {
|
||||
border-radius: 2px;
|
||||
border: 1px solid black;
|
||||
border: 1px solid #929192;
|
||||
background: #39ff14;
|
||||
image: none;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player2LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player3LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player4LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player5LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player6LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player7LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player8LEDs QCheckBox::indicator:unchecked,
|
||||
QGroupBox#groupPlayer1Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer2Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer3Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer4Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer5Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer6Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer7Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer8Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer1Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator:unchecked,
|
||||
@@ -89,7 +266,18 @@ QCheckBox#checkboxPlayer7Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer8Connected::indicator:unchecked,
|
||||
QGroupBox#groupConnectedController::indicator:unchecked {
|
||||
border-radius: 2px;
|
||||
border: 1px solid black;
|
||||
border: 1px solid #929192;
|
||||
background: transparent;
|
||||
image: none;
|
||||
}
|
||||
|
||||
QWidget#controllerPlayer1,
|
||||
QWidget#controllerPlayer2,
|
||||
QWidget#controllerPlayer3,
|
||||
QWidget#controllerPlayer4,
|
||||
QWidget#controllerPlayer5,
|
||||
QWidget#controllerPlayer6,
|
||||
QWidget#controllerPlayer7,
|
||||
QWidget#controllerPlayer8 {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
2
dist/qt_themes/qdarkstyle/style.qrc
vendored
@@ -52,6 +52,6 @@
|
||||
<file>rc/radio_unchecked.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="qdarkstyle">
|
||||
<file>style.qss</file>
|
||||
<file>style.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
286
dist/qt_themes/qdarkstyle/style.qss
vendored
@@ -99,12 +99,19 @@ QGroupBox::indicator:unchecked:disabled {
|
||||
}
|
||||
|
||||
QRadioButton {
|
||||
spacing: 5px;
|
||||
outline: none;
|
||||
color: #eff0f1;
|
||||
spacing: 3px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
outline: none;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
QGroupBox QRadioButton {
|
||||
padding-left: 0px;
|
||||
padding-right: 7px;
|
||||
}
|
||||
|
||||
QRadioButton:disabled {
|
||||
color: #76797C;
|
||||
}
|
||||
@@ -522,13 +529,12 @@ QToolButton#qt_toolbar_ext_button {
|
||||
|
||||
QPushButton {
|
||||
color: #eff0f1;
|
||||
border-width: 1px;
|
||||
border-color: #54575B;
|
||||
border-style: solid;
|
||||
padding: 6px 4px;
|
||||
border: 1px solid #54575B;
|
||||
border-radius: 2px;
|
||||
padding: 5px 0px 5px 0px;
|
||||
outline: none;
|
||||
min-width: 100px;
|
||||
min-height: 13px;
|
||||
background-color: #232629;
|
||||
}
|
||||
|
||||
@@ -553,8 +559,9 @@ QComboBox {
|
||||
selection-background-color: #3daee9;
|
||||
border: 1px solid #54575B;
|
||||
border-radius: 2px;
|
||||
padding: 4px 6px;
|
||||
min-width: 75px;
|
||||
padding: 0px 4px 0px 4px;
|
||||
min-width: 60px;
|
||||
min-height: 23px;
|
||||
background-color: #232629;
|
||||
}
|
||||
|
||||
@@ -608,26 +615,26 @@ QComboBox::down-arrow:focus {
|
||||
}
|
||||
|
||||
QAbstractSpinBox {
|
||||
padding: 4px 6px;
|
||||
border: 1px solid #54575B;
|
||||
background-color: #232629;
|
||||
color: #eff0f1;
|
||||
border-radius: 2px;
|
||||
min-width: 75px;
|
||||
min-width: 52px;
|
||||
min-height: 23px;
|
||||
}
|
||||
|
||||
QAbstractSpinBox:up-button {
|
||||
background-color: transparent;
|
||||
subcontrol-origin: border;
|
||||
subcontrol-position: center right;
|
||||
left: -6px;
|
||||
left: -2px;
|
||||
}
|
||||
|
||||
QAbstractSpinBox:down-button {
|
||||
background-color: transparent;
|
||||
subcontrol-origin: border;
|
||||
subcontrol-position: center left;
|
||||
right: -6px;
|
||||
right: -2px;
|
||||
}
|
||||
|
||||
QAbstractSpinBox::up-arrow,
|
||||
@@ -1277,13 +1284,125 @@ QPushButton#RendererStatusBarButton:!checked {
|
||||
}
|
||||
|
||||
QPushButton#buttonRefreshDevices {
|
||||
min-width: 24px;
|
||||
min-height: 24px;
|
||||
max-width: 24px;
|
||||
max-height: 24px;
|
||||
min-width: 23px;
|
||||
min-height: 23px;
|
||||
max-width: 23px;
|
||||
max-height: 23px;
|
||||
padding: 0px 0px;
|
||||
}
|
||||
|
||||
QSpinBox#spinboxLStickRange,
|
||||
QSpinBox#spinboxRStickRange,
|
||||
QSpinBox#vibrationSpinPlayer1,
|
||||
QSpinBox#vibrationSpinPlayer2,
|
||||
QSpinBox#vibrationSpinPlayer3,
|
||||
QSpinBox#vibrationSpinPlayer4,
|
||||
QSpinBox#vibrationSpinPlayer5,
|
||||
QSpinBox#vibrationSpinPlayer6,
|
||||
QSpinBox#vibrationSpinPlayer7,
|
||||
QSpinBox#vibrationSpinPlayer8 {
|
||||
min-width: 68px;
|
||||
}
|
||||
|
||||
QDialog#ConfigureVibration QGroupBox::indicator,
|
||||
QGroupBox#motionGroup::indicator,
|
||||
QGroupBox#vibrationGroup::indicator {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QDialog#ConfigureVibration QGroupBox::title,
|
||||
QGroupBox#motionGroup::title,
|
||||
QGroupBox#vibrationGroup::title {
|
||||
spacing: 2px;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput,
|
||||
QWidget#topControllerApplet,
|
||||
QWidget#bottomControllerApplet,
|
||||
QGroupBox#groupPlayer1Connected:checked,
|
||||
QGroupBox#groupPlayer2Connected:checked,
|
||||
QGroupBox#groupPlayer3Connected:checked,
|
||||
QGroupBox#groupPlayer4Connected:checked,
|
||||
QGroupBox#groupPlayer5Connected:checked,
|
||||
QGroupBox#groupPlayer6Connected:checked,
|
||||
QGroupBox#groupPlayer7Connected:checked,
|
||||
QGroupBox#groupPlayer8Connected:checked {
|
||||
background-color: #232629;
|
||||
}
|
||||
|
||||
QWidget#topPerGameInput,
|
||||
QWidget#middleControllerApplet {
|
||||
background-color: #31363b;
|
||||
}
|
||||
|
||||
QWidget#topPerGameInput QComboBox,
|
||||
QWidget#middleControllerApplet QComboBox {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
QWidget#connectedControllers {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QWidget#playersSupported,
|
||||
QWidget#controllersSupported,
|
||||
QWidget#controllerSupported1,
|
||||
QWidget#controllerSupported2,
|
||||
QWidget#controllerSupported3,
|
||||
QWidget#controllerSupported4,
|
||||
QWidget#controllerSupported5,
|
||||
QWidget#controllerSupported6 {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected,
|
||||
QGroupBox#groupPlayer2Connected,
|
||||
QGroupBox#groupPlayer3Connected,
|
||||
QGroupBox#groupPlayer4Connected,
|
||||
QGroupBox#groupPlayer5Connected,
|
||||
QGroupBox#groupPlayer6Connected,
|
||||
QGroupBox#groupPlayer7Connected,
|
||||
QGroupBox#groupPlayer8Connected {
|
||||
border: 1px solid #76797c;
|
||||
border-radius: 3px;
|
||||
padding: 0px;
|
||||
min-height: 98px;
|
||||
max-height: 98px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected:unchecked,
|
||||
QGroupBox#groupPlayer2Connected:unchecked,
|
||||
QGroupBox#groupPlayer3Connected:unchecked,
|
||||
QGroupBox#groupPlayer4Connected:unchecked,
|
||||
QGroupBox#groupPlayer5Connected:unchecked,
|
||||
QGroupBox#groupPlayer6Connected:unchecked,
|
||||
QGroupBox#groupPlayer7Connected:unchecked,
|
||||
QGroupBox#groupPlayer8Connected:unchecked {
|
||||
border: 1px solid #54575b;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected::title,
|
||||
QGroupBox#groupPlayer2Connected::title,
|
||||
QGroupBox#groupPlayer3Connected::title,
|
||||
QGroupBox#groupPlayer4Connected::title,
|
||||
QGroupBox#groupPlayer5Connected::title,
|
||||
QGroupBox#groupPlayer6Connected::title,
|
||||
QGroupBox#groupPlayer7Connected::title,
|
||||
QGroupBox#groupPlayer8Connected::title {
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top left;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding-top: 1px;
|
||||
margin-left: -2px;
|
||||
margin-right: -4px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
QCheckBox#checkboxPlayer1Connected,
|
||||
QCheckBox#checkboxPlayer2Connected,
|
||||
QCheckBox#checkboxPlayer3Connected,
|
||||
@@ -1295,6 +1414,55 @@ QCheckBox#checkboxPlayer8Connected {
|
||||
spacing: 0px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs,
|
||||
QWidget#Player2LEDs,
|
||||
QWidget#Player3LEDs,
|
||||
QWidget#Player4LEDs,
|
||||
QWidget#Player5LEDs,
|
||||
QWidget#Player6LEDs,
|
||||
QWidget#Player7LEDs,
|
||||
QWidget#Player8LEDs {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox,
|
||||
QWidget#Player2LEDs QCheckBox,
|
||||
QWidget#Player3LEDs QCheckBox,
|
||||
QWidget#Player4LEDs QCheckBox,
|
||||
QWidget#Player5LEDs QCheckBox,
|
||||
QWidget#Player6LEDs QCheckBox,
|
||||
QWidget#Player7LEDs QCheckBox,
|
||||
QWidget#Player8LEDs QCheckBox {
|
||||
spacing: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator,
|
||||
QWidget#Player2LEDs QCheckBox::indicator,
|
||||
QWidget#Player3LEDs QCheckBox::indicator,
|
||||
QWidget#Player4LEDs QCheckBox::indicator,
|
||||
QWidget#Player5LEDs QCheckBox::indicator,
|
||||
QWidget#Player6LEDs QCheckBox::indicator,
|
||||
QWidget#Player7LEDs QCheckBox::indicator,
|
||||
QWidget#Player8LEDs QCheckBox::indicator {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer1Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer2Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer3Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer4Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer5Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer6Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer7Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer8Connected::indicator {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
QCheckBox#checkboxPlayer1Connected::indicator,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator,
|
||||
@@ -1307,6 +1475,34 @@ QCheckBox#checkboxPlayer8Connected::indicator {
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected::indicator,
|
||||
QGroupBox#groupPlayer2Connected::indicator,
|
||||
QGroupBox#groupPlayer3Connected::indicator,
|
||||
QGroupBox#groupPlayer4Connected::indicator,
|
||||
QGroupBox#groupPlayer5Connected::indicator,
|
||||
QGroupBox#groupPlayer6Connected::indicator,
|
||||
QGroupBox#groupPlayer7Connected::indicator,
|
||||
QGroupBox#groupPlayer8Connected::indicator {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player2LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player3LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player4LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player5LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player6LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player7LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player8LEDs QCheckBox::indicator:checked,
|
||||
QGroupBox#groupPlayer1Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer2Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer3Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer4Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer5Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer6Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer7Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer8Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer1Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator:checked,
|
||||
@@ -1322,6 +1518,22 @@ QGroupBox#groupConnectedController::indicator:checked {
|
||||
image: none;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player2LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player3LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player4LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player5LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player6LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player7LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player8LEDs QCheckBox::indicator:unchecked,
|
||||
QGroupBox#groupPlayer1Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer2Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer3Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer4Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer5Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer6Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer7Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer8Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer1Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator:unchecked,
|
||||
@@ -1337,39 +1549,15 @@ QGroupBox#groupConnectedController::indicator:unchecked {
|
||||
image: none;
|
||||
}
|
||||
|
||||
QSpinBox#spinboxLStickRange,
|
||||
QSpinBox#spinboxRStickRange {
|
||||
padding: 4px 0px 5px 0px;
|
||||
min-width: 63px;
|
||||
}
|
||||
|
||||
QSpinBox#vibrationSpin {
|
||||
padding: 4px 0px 5px 0px;
|
||||
min-width: 63px;
|
||||
}
|
||||
|
||||
QSpinBox#spinboxLStickRange:up-button,
|
||||
QSpinBox#spinboxRStickRange:up-button,
|
||||
QSpinBox#vibrationSpin:up-button {
|
||||
left: -2px;
|
||||
}
|
||||
|
||||
QSpinBox#spinboxLStickRange:down-button,
|
||||
QSpinBox#spinboxRStickRange:down-button,
|
||||
QSpinBox#vibrationSpin:down-button {
|
||||
right: -1px;
|
||||
}
|
||||
|
||||
QGroupBox#motionGroup::indicator,
|
||||
QGroupBox#vibrationGroup::indicator {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QGroupBox#motionGroup::title,
|
||||
QGroupBox#vibrationGroup::title {
|
||||
spacing: 2px;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
QWidget#controllerPlayer1,
|
||||
QWidget#controllerPlayer2,
|
||||
QWidget#controllerPlayer3,
|
||||
QWidget#controllerPlayer4,
|
||||
QWidget#controllerPlayer5,
|
||||
QWidget#controllerPlayer6,
|
||||
QWidget#controllerPlayer7,
|
||||
QWidget#controllerPlayer8 {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* touchscreen mapping widget */
|
||||
|
||||
@@ -221,6 +221,6 @@
|
||||
<file>rc/window_undock_pressed@2x.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="qdarkstyle_midnight_blue">
|
||||
<file>style.qss</file>
|
||||
<file>style.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
329
dist/qt_themes/qdarkstyle_midnight_blue/style.qss
vendored
@@ -172,8 +172,8 @@ QCheckBox {
|
||||
color: #F0F0F0;
|
||||
spacing: 4px;
|
||||
outline: none;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
QCheckBox:focus {
|
||||
@@ -235,19 +235,19 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qgroupbox
|
||||
|
||||
--------------------------------------------------------------------------- */
|
||||
QGroupBox {
|
||||
font-weight: bold;
|
||||
border: 1px solid #32414B;
|
||||
border-radius: 4px;
|
||||
margin-top: 12px;
|
||||
padding: 4px;
|
||||
font-weight: bold;
|
||||
border: 1px solid #32414B;
|
||||
border-radius: 4px;
|
||||
margin-top: 12px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
QGroupBox::title {
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top left;
|
||||
padding-left: 3px;
|
||||
padding-right: 5px;
|
||||
padding-top: 4px;
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top left;
|
||||
padding-left: 3px;
|
||||
padding-right: 5px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
QGroupBox::indicator {
|
||||
@@ -298,6 +298,11 @@ QRadioButton {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
QGroupBox QRadioButton {
|
||||
padding-left: 0px;
|
||||
padding-right: 7px;
|
||||
}
|
||||
|
||||
QRadioButton:focus {
|
||||
border: none;
|
||||
}
|
||||
@@ -321,7 +326,6 @@ QRadioButton QWidget {
|
||||
QRadioButton::indicator {
|
||||
border: none;
|
||||
outline: none;
|
||||
margin-left: 4px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
@@ -785,14 +789,8 @@ QAbstractSpinBox {
|
||||
background-color: #19232D;
|
||||
border: 1px solid #32414B;
|
||||
color: #F0F0F0;
|
||||
/* This fixes 103, 111 */
|
||||
padding-top: 2px;
|
||||
/* This fixes 103, 111 */
|
||||
padding-bottom: 2px;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
border-radius: 4px;
|
||||
/* min-width: 5px; removed to fix 109 */
|
||||
min-height: 19px;
|
||||
}
|
||||
|
||||
QAbstractSpinBox:up-button {
|
||||
@@ -997,10 +995,11 @@ QPushButton {
|
||||
border: 1px solid #32414B;
|
||||
color: #F0F0F0;
|
||||
border-radius: 4px;
|
||||
padding: 3px;
|
||||
padding: 3px 0px 3px 0px;
|
||||
outline: none;
|
||||
/* Issue #194 - Special case of QPushButton inside dialogs, for better UI */
|
||||
min-width: 80px;
|
||||
min-height: 13px;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
@@ -1008,14 +1007,14 @@ QPushButton:disabled {
|
||||
border: 1px solid #32414B;
|
||||
color: #787878;
|
||||
border-radius: 4px;
|
||||
padding: 3px;
|
||||
padding: 3px 0px 3px 0px;
|
||||
}
|
||||
|
||||
QPushButton:checked {
|
||||
background-color: #32414B;
|
||||
border: 1px solid #32414B;
|
||||
border-radius: 4px;
|
||||
padding: 3px;
|
||||
padding: 3px 0px 3px 0px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@@ -1024,7 +1023,7 @@ QPushButton:checked:disabled {
|
||||
border: 1px solid #32414B;
|
||||
color: #787878;
|
||||
border-radius: 4px;
|
||||
padding: 3px;
|
||||
padding: 3px 0px 3px 0px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@@ -1197,15 +1196,9 @@ QComboBox {
|
||||
border: 1px solid #32414B;
|
||||
border-radius: 4px;
|
||||
selection-background-color: #1464A0;
|
||||
padding-left: 4px;
|
||||
padding-right: 36px;
|
||||
/* 4 + 16*2 See scrollbar size */
|
||||
/* Fixes #103, #111 */
|
||||
min-height: 1.5em;
|
||||
/* padding-top: 2px; removed to fix #132 */
|
||||
/* padding-bottom: 2px; removed to fix #132 */
|
||||
/* min-width: 75px; removed to fix #109 */
|
||||
/* Needed to remove indicator - fix #132 */
|
||||
padding: 0px 4px 0px 4px;
|
||||
min-width: 60px;
|
||||
min-height: 19px;
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView {
|
||||
@@ -2198,13 +2191,143 @@ QPushButton#RendererStatusBarButton:!checked {
|
||||
}
|
||||
|
||||
QPushButton#buttonRefreshDevices {
|
||||
min-width: 20px;
|
||||
min-height: 20px;
|
||||
max-width: 20px;
|
||||
max-height: 20px;
|
||||
min-width: 19px;
|
||||
min-height: 19px;
|
||||
max-width: 19px;
|
||||
max-height: 19px;
|
||||
padding: 0px 0px;
|
||||
}
|
||||
|
||||
QSpinBox#spinboxLStickRange,
|
||||
QSpinBox#spinboxRStickRange,
|
||||
QSpinBox#vibrationSpinPlayer1,
|
||||
QSpinBox#vibrationSpinPlayer2,
|
||||
QSpinBox#vibrationSpinPlayer3,
|
||||
QSpinBox#vibrationSpinPlayer4,
|
||||
QSpinBox#vibrationSpinPlayer5,
|
||||
QSpinBox#vibrationSpinPlayer6,
|
||||
QSpinBox#vibrationSpinPlayer7,
|
||||
QSpinBox#vibrationSpinPlayer8 {
|
||||
min-width: 68px;
|
||||
}
|
||||
|
||||
QDialog#ConfigureVibration QGroupBox::indicator,
|
||||
QGroupBox#motionGroup::indicator,
|
||||
QGroupBox#vibrationGroup::indicator {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QDialog#ConfigureVibration QGroupBox,
|
||||
QWidget#bottomPerGameInput QGroupBox#motionGroup,
|
||||
QWidget#bottomPerGameInput QGroupBox#vibrationGroup,
|
||||
QWidget#bottomPerGameInput QGroupBox#inputConfigGroup {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
QDialog#ConfigureVibration QGroupBox::title,
|
||||
QGroupBox#motionGroup::title,
|
||||
QGroupBox#vibrationGroup::title {
|
||||
spacing: 2px;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
|
||||
QListWidget#selectorList {
|
||||
background-color: #0f1922;
|
||||
}
|
||||
|
||||
QSpinBox,
|
||||
QLineEdit,
|
||||
QTreeView#hotkey_list,
|
||||
QScrollArea#scrollArea QTreeView {
|
||||
background-color: #0f1922;
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput,
|
||||
QWidget#topControllerApplet,
|
||||
QWidget#bottomControllerApplet,
|
||||
QGroupBox#groupPlayer1Connected:checked,
|
||||
QGroupBox#groupPlayer2Connected:checked,
|
||||
QGroupBox#groupPlayer3Connected:checked,
|
||||
QGroupBox#groupPlayer4Connected:checked,
|
||||
QGroupBox#groupPlayer5Connected:checked,
|
||||
QGroupBox#groupPlayer6Connected:checked,
|
||||
QGroupBox#groupPlayer7Connected:checked,
|
||||
QGroupBox#groupPlayer8Connected:checked {
|
||||
background-color: #0f1922;
|
||||
}
|
||||
|
||||
QWidget#topPerGameInput,
|
||||
QWidget#middleControllerApplet {
|
||||
background-color: #19232d;
|
||||
}
|
||||
|
||||
QWidget#topPerGameInput QComboBox,
|
||||
QWidget#middleControllerApplet QComboBox {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
QWidget#connectedControllers {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QWidget#playersSupported,
|
||||
QWidget#controllersSupported,
|
||||
QWidget#controllerSupported1,
|
||||
QWidget#controllerSupported2,
|
||||
QWidget#controllerSupported3,
|
||||
QWidget#controllerSupported4,
|
||||
QWidget#controllerSupported5,
|
||||
QWidget#controllerSupported6 {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected,
|
||||
QGroupBox#groupPlayer2Connected,
|
||||
QGroupBox#groupPlayer3Connected,
|
||||
QGroupBox#groupPlayer4Connected,
|
||||
QGroupBox#groupPlayer5Connected,
|
||||
QGroupBox#groupPlayer6Connected,
|
||||
QGroupBox#groupPlayer7Connected,
|
||||
QGroupBox#groupPlayer8Connected {
|
||||
border: 1px solid #76797c;
|
||||
border-radius: 3px;
|
||||
padding: 0px;
|
||||
min-height: 98px;
|
||||
max-height: 98px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
|
||||
QGroupBox#groupPlayer1Connected:unchecked,
|
||||
QGroupBox#groupPlayer2Connected:unchecked,
|
||||
QGroupBox#groupPlayer3Connected:unchecked,
|
||||
QGroupBox#groupPlayer4Connected:unchecked,
|
||||
QGroupBox#groupPlayer5Connected:unchecked,
|
||||
QGroupBox#groupPlayer6Connected:unchecked,
|
||||
QGroupBox#groupPlayer7Connected:unchecked,
|
||||
QGroupBox#groupPlayer8Connected:unchecked {
|
||||
border: 1px solid #32414b;
|
||||
}
|
||||
|
||||
QGroupBox#groupPlayer1Connected::title,
|
||||
QGroupBox#groupPlayer2Connected::title,
|
||||
QGroupBox#groupPlayer3Connected::title,
|
||||
QGroupBox#groupPlayer4Connected::title,
|
||||
QGroupBox#groupPlayer5Connected::title,
|
||||
QGroupBox#groupPlayer6Connected::title,
|
||||
QGroupBox#groupPlayer7Connected::title,
|
||||
QGroupBox#groupPlayer8Connected::title {
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top left;
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding-top: 1px;
|
||||
margin-left: -2px;
|
||||
margin-right: -4px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
QCheckBox#checkboxPlayer1Connected,
|
||||
QCheckBox#checkboxPlayer2Connected,
|
||||
@@ -2217,6 +2340,68 @@ QCheckBox#checkboxPlayer8Connected {
|
||||
spacing: 0px;
|
||||
}
|
||||
|
||||
QWidget#connectedControllers QLabel {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs,
|
||||
QWidget#Player2LEDs,
|
||||
QWidget#Player3LEDs,
|
||||
QWidget#Player4LEDs,
|
||||
QWidget#Player5LEDs,
|
||||
QWidget#Player6LEDs,
|
||||
QWidget#Player7LEDs,
|
||||
QWidget#Player8LEDs {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox,
|
||||
QWidget#Player2LEDs QCheckBox,
|
||||
QWidget#Player3LEDs QCheckBox,
|
||||
QWidget#Player4LEDs QCheckBox,
|
||||
QWidget#Player5LEDs QCheckBox,
|
||||
QWidget#Player6LEDs QCheckBox,
|
||||
QWidget#Player7LEDs QCheckBox,
|
||||
QWidget#Player8LEDs QCheckBox,
|
||||
QCheckBox#checkboxPlayer1Connected,
|
||||
QCheckBox#checkboxPlayer2Connected,
|
||||
QCheckBox#checkboxPlayer3Connected,
|
||||
QCheckBox#checkboxPlayer4Connected,
|
||||
QCheckBox#checkboxPlayer5Connected,
|
||||
QCheckBox#checkboxPlayer6Connected,
|
||||
QCheckBox#checkboxPlayer7Connected,
|
||||
QCheckBox#checkboxPlayer8Connected {
|
||||
spacing: 0px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator,
|
||||
QWidget#Player2LEDs QCheckBox::indicator,
|
||||
QWidget#Player3LEDs QCheckBox::indicator,
|
||||
QWidget#Player4LEDs QCheckBox::indicator,
|
||||
QWidget#Player5LEDs QCheckBox::indicator,
|
||||
QWidget#Player6LEDs QCheckBox::indicator,
|
||||
QWidget#Player7LEDs QCheckBox::indicator,
|
||||
QWidget#Player8LEDs QCheckBox::indicator {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer1Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer2Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer3Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer4Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer5Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer6Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer7Connected::indicator,
|
||||
QWidget#bottomPerGameInput QCheckBox#checkboxPlayer8Connected::indicator {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
QCheckBox#checkboxPlayer1Connected::indicator,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator,
|
||||
@@ -2227,8 +2412,25 @@ QCheckBox#checkboxPlayer7Connected::indicator,
|
||||
QCheckBox#checkboxPlayer8Connected::indicator {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player2LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player3LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player4LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player5LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player6LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player7LEDs QCheckBox::indicator:checked,
|
||||
QWidget#Player8LEDs QCheckBox::indicator:checked,
|
||||
QGroupBox#groupPlayer1Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer2Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer3Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer4Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer5Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer6Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer7Connected::indicator:checked,
|
||||
QGroupBox#groupPlayer8Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer1Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator:checked,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator:checked,
|
||||
@@ -2244,6 +2446,22 @@ QGroupBox#groupConnectedController::indicator:checked {
|
||||
image: none;
|
||||
}
|
||||
|
||||
QWidget#Player1LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player2LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player3LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player4LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player5LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player6LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player7LEDs QCheckBox::indicator:unchecked,
|
||||
QWidget#Player8LEDs QCheckBox::indicator:unchecked,
|
||||
QGroupBox#groupPlayer1Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer2Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer3Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer4Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer5Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer6Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer7Connected::indicator:unchecked,
|
||||
QGroupBox#groupPlayer8Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer1Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer2Connected::indicator:unchecked,
|
||||
QCheckBox#checkboxPlayer3Connected::indicator:unchecked,
|
||||
@@ -2255,34 +2473,17 @@ QCheckBox#checkboxPlayer8Connected::indicator:unchecked,
|
||||
QGroupBox#groupConnectedController::indicator:unchecked {
|
||||
border-radius: 2px;
|
||||
border: 1px solid #929192;
|
||||
background: transparent;
|
||||
background: #19232d;
|
||||
image: none;
|
||||
}
|
||||
|
||||
QSpinBox#spinboxLStickRange,
|
||||
QSpinBox#spinboxRStickRange {
|
||||
min-width: 38px;
|
||||
QWidget#controllerPlayer1,
|
||||
QWidget#controllerPlayer2,
|
||||
QWidget#controllerPlayer3,
|
||||
QWidget#controllerPlayer4,
|
||||
QWidget#controllerPlayer5,
|
||||
QWidget#controllerPlayer6,
|
||||
QWidget#controllerPlayer7,
|
||||
QWidget#controllerPlayer8 {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QGroupBox#motionGroup::indicator,
|
||||
QGroupBox#vibrationGroup::indicator {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
QGroupBox#motionGroup::title,
|
||||
QGroupBox#vibrationGroup::title {
|
||||
spacing: 2px;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
|
||||
QListWidget#selectorList {
|
||||
background-color: #0f1922;
|
||||
}
|
||||
|
||||
QSpinBox,
|
||||
QLineEdit,
|
||||
QTreeView#hotkey_list,
|
||||
QScrollArea#scrollArea QTreeView {
|
||||
background-color: #0f1922;
|
||||
}
|
||||
32
externals/CMakeLists.txt
vendored
@@ -61,9 +61,7 @@ if (USE_DISCORD_PRESENCE)
|
||||
endif()
|
||||
|
||||
# Sirit
|
||||
if (ENABLE_VULKAN)
|
||||
add_subdirectory(sirit)
|
||||
endif()
|
||||
add_subdirectory(sirit)
|
||||
|
||||
# libzip
|
||||
find_package(Libzip 1.5)
|
||||
@@ -73,23 +71,29 @@ if (NOT LIBZIP_FOUND)
|
||||
endif()
|
||||
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
# LibreSSL
|
||||
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
|
||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||
target_include_directories(ssl INTERFACE ./libressl/include)
|
||||
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
||||
get_directory_property(OPENSSL_LIBRARIES
|
||||
DIRECTORY libressl
|
||||
DEFINITION OPENSSL_LIBS)
|
||||
|
||||
# lurlparser
|
||||
add_subdirectory(lurlparser EXCLUDE_FROM_ALL)
|
||||
find_package(OpenSSL 1.1)
|
||||
if (OPENSSL_FOUND)
|
||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
else()
|
||||
# LibreSSL
|
||||
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
|
||||
set(OPENSSLDIR "/etc/ssl/")
|
||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||
target_include_directories(ssl INTERFACE ./libressl/include)
|
||||
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
||||
get_directory_property(OPENSSL_LIBRARIES
|
||||
DIRECTORY libressl
|
||||
DEFINITION OPENSSL_LIBS)
|
||||
endif()
|
||||
|
||||
# httplib
|
||||
add_library(httplib INTERFACE)
|
||||
target_include_directories(httplib INTERFACE ./httplib)
|
||||
target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
||||
if (WIN32)
|
||||
target_link_libraries(httplib INTERFACE crypt32 cryptui ws2_32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Opus
|
||||
|
||||
2
externals/cubeb
vendored
2
externals/dynarmic
vendored
100
externals/find-modules/FindFFmpeg.cmake
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
|
||||
# Once done this will define
|
||||
#
|
||||
# FFMPEG_FOUND - system has ffmpeg or libav
|
||||
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
|
||||
# FFMPEG_LIBRARIES - Link these to use ffmpeg
|
||||
# FFMPEG_LIBAVCODEC
|
||||
# FFMPEG_LIBAVFORMAT
|
||||
# FFMPEG_LIBAVUTIL
|
||||
#
|
||||
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
|
||||
# Modified for other libraries by Lasse Kärkkäinen <tronic>
|
||||
# Modified for Hedgewars by Stepik777
|
||||
# Modified for FFmpeg-example Tuukka Pasanen 2018
|
||||
# Modified for yuzu toastUnlimted 2020
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
#
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(FFMPEG
|
||||
FOUND_VAR FFMPEG_FOUND
|
||||
REQUIRED_VARS
|
||||
FFMPEG_LIBRARY
|
||||
FFMPEG_INCLUDE_DIR
|
||||
VERSION_VAR FFMPEG_VERSION
|
||||
)
|
||||
|
||||
if(FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||
# in cache already
|
||||
set(FFMPEG_FOUND TRUE)
|
||||
else()
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
|
||||
pkg_check_modules(_FFMPEG_AVUTIL libavutil)
|
||||
pkg_check_modules(_FFMPEG_SWSCALE libswscale)
|
||||
endif()
|
||||
|
||||
find_path(FFMPEG_AVCODEC_INCLUDE_DIR
|
||||
NAMES libavcodec/avcodec.h
|
||||
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
PATH_SUFFIXES ffmpeg libav)
|
||||
|
||||
find_library(FFMPEG_LIBAVCODEC
|
||||
NAMES avcodec
|
||||
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib)
|
||||
|
||||
find_library(FFMPEG_LIBAVUTIL
|
||||
NAMES avutil
|
||||
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib)
|
||||
|
||||
find_library(FFMPEG_LIBSWSCALE
|
||||
NAMES swscale
|
||||
PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib)
|
||||
|
||||
if(FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVUTIL AND FFMPEG_LIBSWSCALE)
|
||||
set(FFMPEG_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
if(FFMPEG_FOUND)
|
||||
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
|
||||
set(FFMPEG_LIBRARIES
|
||||
${FFMPEG_LIBAVCODEC}
|
||||
${FFMPEG_LIBAVUTIL}
|
||||
${FFMPEG_LIBSWSCALE})
|
||||
endif()
|
||||
|
||||
if(FFMPEG_FOUND)
|
||||
if(NOT FFMPEG_FIND_QUIETLY)
|
||||
message(STATUS
|
||||
"Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
|
||||
endif()
|
||||
else()
|
||||
if(FFMPEG_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"Could not find libavcodec or libavutil or libswscale")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
2
externals/httplib/README.md
vendored
@@ -1,4 +1,4 @@
|
||||
From https://github.com/yhirose/cpp-httplib/tree/fce8e6fefdab4ad48bc5b25c98e5ebfda4f3cf53
|
||||
From https://github.com/yhirose/cpp-httplib/tree/ff5677ad197947177c158fe857caff4f0e242045 with https://github.com/yhirose/cpp-httplib/pull/701
|
||||
|
||||
MIT License
|
||||
|
||||
|
||||
4792
externals/httplib/httplib.h
vendored
2
externals/inih/inih
vendored
2
externals/libressl
vendored
8
externals/lurlparser/CMakeLists.txt
vendored
@@ -1,8 +0,0 @@
|
||||
add_library(lurlparser
|
||||
LUrlParser.cpp
|
||||
LUrlParser.h
|
||||
)
|
||||
|
||||
create_target_directory_groups(lurlparser)
|
||||
|
||||
target_include_directories(lurlparser INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
265
externals/lurlparser/LUrlParser.cpp
vendored
@@ -1,265 +0,0 @@
|
||||
/*
|
||||
* Lightweight URL & URI parser (RFC 1738, RFC 3986)
|
||||
* https://github.com/corporateshark/LUrlParser
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "LUrlParser.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
|
||||
// check if the scheme name is valid
|
||||
static bool IsSchemeValid( const std::string& SchemeName )
|
||||
{
|
||||
for ( auto c : SchemeName )
|
||||
{
|
||||
if ( !isalpha( c ) && c != '+' && c != '-' && c != '.' ) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LUrlParser::clParseURL::GetPort( int* OutPort ) const
|
||||
{
|
||||
if ( !IsValid() ) { return false; }
|
||||
|
||||
int Port = atoi( m_Port.c_str() );
|
||||
|
||||
if ( Port <= 0 || Port > 65535 ) { return false; }
|
||||
|
||||
if ( OutPort ) { *OutPort = Port; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// based on RFC 1738 and RFC 3986
|
||||
LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL )
|
||||
{
|
||||
LUrlParser::clParseURL Result;
|
||||
|
||||
const char* CurrentString = URL.c_str();
|
||||
|
||||
/*
|
||||
* <scheme>:<scheme-specific-part>
|
||||
* <scheme> := [a-z\+\-\.]+
|
||||
* For resiliency, programs interpreting URLs should treat upper case letters as equivalent to lower case in scheme names
|
||||
*/
|
||||
|
||||
// try to read scheme
|
||||
{
|
||||
const char* LocalString = strchr( CurrentString, ':' );
|
||||
|
||||
if ( !LocalString )
|
||||
{
|
||||
return clParseURL( LUrlParserError_NoUrlCharacter );
|
||||
}
|
||||
|
||||
// save the scheme name
|
||||
Result.m_Scheme = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
if ( !IsSchemeValid( Result.m_Scheme ) )
|
||||
{
|
||||
return clParseURL( LUrlParserError_InvalidSchemeName );
|
||||
}
|
||||
|
||||
// scheme should be lowercase
|
||||
std::transform( Result.m_Scheme.begin(), Result.m_Scheme.end(), Result.m_Scheme.begin(), ::tolower );
|
||||
|
||||
// skip ':'
|
||||
CurrentString = LocalString+1;
|
||||
}
|
||||
|
||||
/*
|
||||
* //<user>:<password>@<host>:<port>/<url-path>
|
||||
* any ":", "@" and "/" must be normalized
|
||||
*/
|
||||
|
||||
// skip "//"
|
||||
if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash );
|
||||
if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash );
|
||||
|
||||
// check if the user name and password are specified
|
||||
bool bHasUserName = false;
|
||||
|
||||
const char* LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString )
|
||||
{
|
||||
if ( *LocalString == '@' )
|
||||
{
|
||||
// user name and password are specified
|
||||
bHasUserName = true;
|
||||
break;
|
||||
}
|
||||
else if ( *LocalString == '/' )
|
||||
{
|
||||
// end of <host>:<port> specification
|
||||
bHasUserName = false;
|
||||
break;
|
||||
}
|
||||
|
||||
LocalString++;
|
||||
}
|
||||
|
||||
// user name and password
|
||||
LocalString = CurrentString;
|
||||
|
||||
if ( bHasUserName )
|
||||
{
|
||||
// read user name
|
||||
while ( *LocalString && *LocalString != ':' && *LocalString != '@' ) LocalString++;
|
||||
|
||||
Result.m_UserName = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
// proceed with the current pointer
|
||||
CurrentString = LocalString;
|
||||
|
||||
if ( *CurrentString == ':' )
|
||||
{
|
||||
// skip ':'
|
||||
CurrentString++;
|
||||
|
||||
// read password
|
||||
LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString && *LocalString != '@' ) LocalString++;
|
||||
|
||||
Result.m_Password = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
CurrentString = LocalString;
|
||||
}
|
||||
|
||||
// skip '@'
|
||||
if ( *CurrentString != '@' )
|
||||
{
|
||||
return clParseURL( LUrlParserError_NoAtSign );
|
||||
}
|
||||
|
||||
CurrentString++;
|
||||
}
|
||||
|
||||
bool bHasBracket = ( *CurrentString == '[' );
|
||||
|
||||
// go ahead, read the host name
|
||||
LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString )
|
||||
{
|
||||
if ( bHasBracket && *LocalString == ']' )
|
||||
{
|
||||
// end of IPv6 address
|
||||
LocalString++;
|
||||
break;
|
||||
}
|
||||
else if ( !bHasBracket && ( *LocalString == ':' || *LocalString == '/' ) )
|
||||
{
|
||||
// port number is specified
|
||||
break;
|
||||
}
|
||||
|
||||
LocalString++;
|
||||
}
|
||||
|
||||
Result.m_Host = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
CurrentString = LocalString;
|
||||
|
||||
// is port number specified?
|
||||
if ( *CurrentString == ':' )
|
||||
{
|
||||
CurrentString++;
|
||||
|
||||
// read port number
|
||||
LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString && *LocalString != '/' ) LocalString++;
|
||||
|
||||
Result.m_Port = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
CurrentString = LocalString;
|
||||
}
|
||||
|
||||
// end of string
|
||||
if ( !*CurrentString )
|
||||
{
|
||||
Result.m_ErrorCode = LUrlParserError_Ok;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
// skip '/'
|
||||
if ( *CurrentString != '/' )
|
||||
{
|
||||
return clParseURL( LUrlParserError_NoSlash );
|
||||
}
|
||||
|
||||
CurrentString++;
|
||||
|
||||
// parse the path
|
||||
LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString && *LocalString != '#' && *LocalString != '?' ) LocalString++;
|
||||
|
||||
Result.m_Path = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
CurrentString = LocalString;
|
||||
|
||||
// check for query
|
||||
if ( *CurrentString == '?' )
|
||||
{
|
||||
// skip '?'
|
||||
CurrentString++;
|
||||
|
||||
// read query
|
||||
LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString && *LocalString != '#' ) LocalString++;
|
||||
|
||||
Result.m_Query = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
CurrentString = LocalString;
|
||||
}
|
||||
|
||||
// check for fragment
|
||||
if ( *CurrentString == '#' )
|
||||
{
|
||||
// skip '#'
|
||||
CurrentString++;
|
||||
|
||||
// read fragment
|
||||
LocalString = CurrentString;
|
||||
|
||||
while ( *LocalString ) LocalString++;
|
||||
|
||||
Result.m_Fragment = std::string( CurrentString, LocalString - CurrentString );
|
||||
|
||||
CurrentString = LocalString;
|
||||
}
|
||||
|
||||
Result.m_ErrorCode = LUrlParserError_Ok;
|
||||
|
||||
return Result;
|
||||
}
|
||||
78
externals/lurlparser/LUrlParser.h
vendored
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Lightweight URL & URI parser (RFC 1738, RFC 3986)
|
||||
* https://github.com/corporateshark/LUrlParser
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace LUrlParser
|
||||
{
|
||||
enum LUrlParserError
|
||||
{
|
||||
LUrlParserError_Ok = 0,
|
||||
LUrlParserError_Uninitialized = 1,
|
||||
LUrlParserError_NoUrlCharacter = 2,
|
||||
LUrlParserError_InvalidSchemeName = 3,
|
||||
LUrlParserError_NoDoubleSlash = 4,
|
||||
LUrlParserError_NoAtSign = 5,
|
||||
LUrlParserError_UnexpectedEndOfLine = 6,
|
||||
LUrlParserError_NoSlash = 7,
|
||||
};
|
||||
|
||||
class clParseURL
|
||||
{
|
||||
public:
|
||||
LUrlParserError m_ErrorCode;
|
||||
std::string m_Scheme;
|
||||
std::string m_Host;
|
||||
std::string m_Port;
|
||||
std::string m_Path;
|
||||
std::string m_Query;
|
||||
std::string m_Fragment;
|
||||
std::string m_UserName;
|
||||
std::string m_Password;
|
||||
|
||||
clParseURL()
|
||||
: m_ErrorCode( LUrlParserError_Uninitialized )
|
||||
{}
|
||||
|
||||
/// return 'true' if the parsing was successful
|
||||
bool IsValid() const { return m_ErrorCode == LUrlParserError_Ok; }
|
||||
|
||||
/// helper to convert the port number to int, return 'true' if the port is valid (within the 0..65535 range)
|
||||
bool GetPort( int* OutPort ) const;
|
||||
|
||||
/// parse the URL
|
||||
static clParseURL ParseURL( const std::string& URL );
|
||||
|
||||
private:
|
||||
explicit clParseURL( LUrlParserError ErrorCode )
|
||||
: m_ErrorCode( ErrorCode )
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace LUrlParser
|
||||
19
externals/lurlparser/README.md
vendored
@@ -1,19 +0,0 @@
|
||||
From https://github.com/corporateshark/LUrlParser/commit/455d5e2d27e3946f11ad0328fee9ee2628e6a8e2
|
||||
|
||||
MIT License
|
||||
|
||||
===
|
||||
|
||||
Lightweight URL & URI parser (RFC 1738, RFC 3986)
|
||||
|
||||
(C) Sergey Kosarevsky, 2015
|
||||
|
||||
@corporateshark sk@linderdaum.com
|
||||
|
||||
http://www.linderdaum.com
|
||||
|
||||
http://blog.linderdaum.com
|
||||
|
||||
=============================
|
||||
|
||||
A tiny and lightweight URL & URI parser (RFC 1738, RFC 3986) written in C++.
|
||||
18
externals/microprofile/microprofile.h
vendored
@@ -902,8 +902,10 @@ inline uint16_t MicroProfileGetGroupIndex(MicroProfileToken t)
|
||||
#include <windows.h>
|
||||
#define snprintf _snprintf
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4244)
|
||||
#endif
|
||||
int64_t MicroProfileTicksPerSecondCpu()
|
||||
{
|
||||
static int64_t nTicksPerSecond = 0;
|
||||
@@ -946,7 +948,11 @@ typedef HANDLE MicroProfileThread;
|
||||
DWORD _stdcall ThreadTrampoline(void* pFunc)
|
||||
{
|
||||
MicroProfileThreadFunc F = (MicroProfileThreadFunc)pFunc;
|
||||
return (uint32_t)F(0);
|
||||
|
||||
// The return value of F will always return a void*, however, this is for
|
||||
// compatibility with pthreads. The underlying "address" of the pointer
|
||||
// is always a 32-bit value, so this cast is safe to perform.
|
||||
return static_cast<DWORD>(reinterpret_cast<uint64_t>(F(0)));
|
||||
}
|
||||
|
||||
inline void MicroProfileThreadStart(MicroProfileThread* pThread, MicroProfileThreadFunc Func)
|
||||
@@ -1742,10 +1748,10 @@ void MicroProfileFlip()
|
||||
}
|
||||
}
|
||||
}
|
||||
for(uint32_t i = 0; i < MICROPROFILE_MAX_GROUPS; ++i)
|
||||
for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j)
|
||||
{
|
||||
pLog->nGroupTicks[i] += nGroupTicks[i];
|
||||
pFrameGroup[i] += nGroupTicks[i];
|
||||
pLog->nGroupTicks[j] += nGroupTicks[j];
|
||||
pFrameGroup[j] += nGroupTicks[j];
|
||||
}
|
||||
pLog->nStackPos = nStackPos;
|
||||
}
|
||||
@@ -3328,7 +3334,7 @@ bool MicroProfileIsLocalThread(uint32_t nThreadId)
|
||||
#endif
|
||||
#else
|
||||
|
||||
bool MicroProfileIsLocalThread(uint32_t nThreadId){return false;}
|
||||
bool MicroProfileIsLocalThread([[maybe_unused]] uint32_t nThreadId) { return false; }
|
||||
void MicroProfileStopContextSwitchTrace(){}
|
||||
void MicroProfileStartContextSwitchTrace(){}
|
||||
|
||||
@@ -3576,7 +3582,7 @@ int MicroProfileGetGpuTickReference(int64_t* pOutCpu, int64_t* pOutGpu)
|
||||
|
||||
#undef S
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
1
externals/unicorn
vendored
@@ -32,7 +32,6 @@ if (MSVC)
|
||||
# /Zc:inline - Let codegen omit inline functions in object files
|
||||
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
|
||||
add_compile_options(
|
||||
/W3
|
||||
/MP
|
||||
/Zi
|
||||
/Zo
|
||||
@@ -43,6 +42,13 @@ if (MSVC)
|
||||
/Zc:externConstexpr
|
||||
/Zc:inline
|
||||
/Zc:throwingNew
|
||||
|
||||
# Warnings
|
||||
/W3
|
||||
/we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect
|
||||
/we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
|
||||
/we4555 # Expression has no effect; expected expression with side-effect
|
||||
/we4834 # Discarding return value of function with 'nodiscard' attribute
|
||||
)
|
||||
|
||||
# /GS- - No stack buffer overflow checks
|
||||
@@ -56,9 +62,12 @@ else()
|
||||
-Werror=implicit-fallthrough
|
||||
-Werror=missing-declarations
|
||||
-Werror=reorder
|
||||
-Werror=uninitialized
|
||||
-Werror=unused-result
|
||||
-Wextra
|
||||
-Wmissing-declarations
|
||||
-Wno-attributes
|
||||
-Wno-invalid-offsetof
|
||||
-Wno-unused-parameter
|
||||
)
|
||||
|
||||
|
||||
@@ -12,22 +12,56 @@ add_library(audio_core STATIC
|
||||
buffer.h
|
||||
codec.cpp
|
||||
codec.h
|
||||
command_generator.cpp
|
||||
command_generator.h
|
||||
common.h
|
||||
effect_context.cpp
|
||||
effect_context.h
|
||||
info_updater.cpp
|
||||
info_updater.h
|
||||
memory_pool.cpp
|
||||
memory_pool.h
|
||||
mix_context.cpp
|
||||
mix_context.h
|
||||
null_sink.h
|
||||
sink.h
|
||||
sink_context.cpp
|
||||
sink_context.h
|
||||
sink_details.cpp
|
||||
sink_details.h
|
||||
sink_stream.h
|
||||
splitter_context.cpp
|
||||
splitter_context.h
|
||||
stream.cpp
|
||||
stream.h
|
||||
time_stretch.cpp
|
||||
time_stretch.h
|
||||
voice_context.cpp
|
||||
voice_context.h
|
||||
|
||||
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_sink.h>
|
||||
)
|
||||
|
||||
create_target_directory_groups(audio_core)
|
||||
|
||||
if (NOT MSVC)
|
||||
target_compile_options(audio_core PRIVATE
|
||||
-Werror=conversion
|
||||
-Werror=ignored-qualifiers
|
||||
-Werror=implicit-fallthrough
|
||||
-Werror=reorder
|
||||
-Werror=sign-compare
|
||||
-Werror=shadow
|
||||
-Werror=unused-parameter
|
||||
-Werror=unused-variable
|
||||
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable>
|
||||
|
||||
-Wno-sign-conversion
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(audio_core PUBLIC common core)
|
||||
target_link_libraries(audio_core PRIVATE SoundTouch)
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ Filter Filter::LowPass(double cutoff, double Q) {
|
||||
|
||||
Filter::Filter() : Filter(1.0, 0.0, 0.0, 1.0, 0.0, 0.0) {}
|
||||
|
||||
Filter::Filter(double a0, double a1, double a2, double b0, double b1, double b2)
|
||||
: a1(a1 / a0), a2(a2 / a0), b0(b0 / a0), b1(b1 / a0), b2(b2 / a0) {}
|
||||
Filter::Filter(double a0_, double a1_, double a2_, double b0_, double b1_, double b2_)
|
||||
: a1(a1_ / a0_), a2(a2_ / a0_), b0(b0_ / a0_), b1(b1_ / a0_), b2(b2_ / a0_) {}
|
||||
|
||||
void Filter::Process(std::vector<s16>& signal) {
|
||||
const std::size_t num_frames = signal.size() / 2;
|
||||
@@ -55,7 +55,8 @@ void Filter::Process(std::vector<s16>& signal) {
|
||||
/// @param total_count The total number of biquads to be cascaded.
|
||||
/// @param index 0-index of the biquad to calculate the Q value for.
|
||||
static double CascadingBiquadQ(std::size_t total_count, std::size_t index) {
|
||||
const double pole = M_PI * (2 * index + 1) / (4.0 * total_count);
|
||||
const auto pole =
|
||||
M_PI * static_cast<double>(2 * index + 1) / (4.0 * static_cast<double>(total_count));
|
||||
return 1.0 / (2.0 * std::cos(pole));
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ CascadingFilter CascadingFilter::LowPass(double cutoff, std::size_t cascade_size
|
||||
}
|
||||
|
||||
CascadingFilter::CascadingFilter() = default;
|
||||
CascadingFilter::CascadingFilter(std::vector<Filter> filters) : filters(std::move(filters)) {}
|
||||
CascadingFilter::CascadingFilter(std::vector<Filter> filters_) : filters(std::move(filters_)) {}
|
||||
|
||||
void CascadingFilter::Process(std::vector<s16>& signal) {
|
||||
for (auto& filter : filters) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
/// Passthrough filter.
|
||||
Filter();
|
||||
|
||||
Filter(double a0, double a1, double a2, double b0, double b1, double b2);
|
||||
Filter(double a0_, double a1_, double a2_, double b0_, double b1_, double b2_);
|
||||
|
||||
void Process(std::vector<s16>& signal);
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
/// Passthrough.
|
||||
CascadingFilter();
|
||||
|
||||
explicit CascadingFilter(std::vector<Filter> filters);
|
||||
explicit CascadingFilter(std::vector<Filter> filters_);
|
||||
|
||||
void Process(std::vector<s16>& signal);
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
|
||||
return {};
|
||||
|
||||
if (ratio <= 0) {
|
||||
LOG_CRITICAL(Audio, "Nonsensical interpolation ratio {}", ratio);
|
||||
LOG_ERROR(Audio, "Nonsensical interpolation ratio {}", ratio);
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,8 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
|
||||
const std::size_t num_frames{input.size() / 2};
|
||||
|
||||
std::vector<s16> output;
|
||||
output.reserve(static_cast<std::size_t>(input.size() / ratio + InterpolationState::taps));
|
||||
output.reserve(static_cast<std::size_t>(static_cast<double>(input.size()) / ratio +
|
||||
InterpolationState::taps));
|
||||
|
||||
for (std::size_t frame{}; frame < num_frames; ++frame) {
|
||||
const std::size_t lut_index{(state.fraction >> 8) * InterpolationState::taps};
|
||||
@@ -197,4 +198,36 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
|
||||
return output;
|
||||
}
|
||||
|
||||
void Resample(s32* output, const s32* input, s32 pitch, s32& fraction, std::size_t sample_count) {
|
||||
const std::array<s16, 512>& lut = [pitch] {
|
||||
if (pitch > 0xaaaa) {
|
||||
return curve_lut0;
|
||||
}
|
||||
if (pitch <= 0x8000) {
|
||||
return curve_lut1;
|
||||
}
|
||||
return curve_lut2;
|
||||
}();
|
||||
|
||||
std::size_t index{};
|
||||
|
||||
for (std::size_t i = 0; i < sample_count; i++) {
|
||||
const std::size_t lut_index{(static_cast<std::size_t>(fraction) >> 8) * 4};
|
||||
const auto l0 = lut[lut_index + 0];
|
||||
const auto l1 = lut[lut_index + 1];
|
||||
const auto l2 = lut[lut_index + 2];
|
||||
const auto l3 = lut[lut_index + 3];
|
||||
|
||||
const auto s0 = static_cast<s32>(input[index + 0]);
|
||||
const auto s1 = static_cast<s32>(input[index + 1]);
|
||||
const auto s2 = static_cast<s32>(input[index + 2]);
|
||||
const auto s3 = static_cast<s32>(input[index + 3]);
|
||||
|
||||
output[i] = (l0 * s0 + l1 * s1 + l2 * s2 + l3 * s3) >> 15;
|
||||
fraction += pitch;
|
||||
index += (fraction >> 15);
|
||||
fraction &= 0x7fff;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
|
||||
@@ -38,4 +38,7 @@ inline std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16>
|
||||
return Interpolate(state, std::move(input), ratio);
|
||||
}
|
||||
|
||||
/// Nintendo Switchs DSP resampling algorithm. Based on a single channel
|
||||
void Resample(s32* output, const s32* input, s32 pitch, s32& fraction, std::size_t sample_count);
|
||||
|
||||
} // namespace AudioCore
|
||||
|
||||
@@ -43,6 +43,10 @@ std::vector<Buffer::Tag> AudioOut::GetTagsAndReleaseBuffers(StreamPtr stream,
|
||||
return stream->GetTagsAndReleaseBuffers(max_count);
|
||||
}
|
||||
|
||||
std::vector<Buffer::Tag> AudioOut::GetTagsAndReleaseBuffers(StreamPtr stream) {
|
||||
return stream->GetTagsAndReleaseBuffers();
|
||||
}
|
||||
|
||||
void AudioOut::StartStream(StreamPtr stream) {
|
||||
stream->Play();
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ public:
|
||||
/// Returns a vector of recently released buffers specified by tag for the specified stream
|
||||
std::vector<Buffer::Tag> GetTagsAndReleaseBuffers(StreamPtr stream, std::size_t max_count);
|
||||
|
||||
/// Returns a vector of all recently released buffers specified by tag for the specified stream
|
||||
std::vector<Buffer::Tag> GetTagsAndReleaseBuffers(StreamPtr stream);
|
||||
|
||||
/// Starts an audio stream for playback
|
||||
void StartStream(StreamPtr stream);
|
||||
|
||||
|
||||
@@ -2,95 +2,96 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "audio_core/algorithm/interpolate.h"
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_core/audio_out.h"
|
||||
#include "audio_core/audio_renderer.h"
|
||||
#include "audio_core/codec.h"
|
||||
#include "audio_core/common.h"
|
||||
#include "common/assert.h"
|
||||
#include "audio_core/info_updater.h"
|
||||
#include "audio_core/voice_context.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/writable_event.h"
|
||||
#include "core/memory.h"
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
[[nodiscard]] static constexpr s16 ClampToS16(s32 value) {
|
||||
return static_cast<s16>(std::clamp(value, s32{std::numeric_limits<s16>::min()},
|
||||
s32{std::numeric_limits<s16>::max()}));
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr s16 Mix2To1(s16 l_channel, s16 r_channel) {
|
||||
// Mix 50% from left and 50% from right channel
|
||||
constexpr float l_mix_amount = 50.0f / 100.0f;
|
||||
constexpr float r_mix_amount = 50.0f / 100.0f;
|
||||
return ClampToS16(static_cast<s32>((static_cast<float>(l_channel) * l_mix_amount) +
|
||||
(static_cast<float>(r_channel) * r_mix_amount)));
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr std::tuple<s16, s16> Mix6To2(s16 fl_channel, s16 fr_channel,
|
||||
s16 fc_channel,
|
||||
[[maybe_unused]] s16 lf_channel,
|
||||
s16 bl_channel, s16 br_channel) {
|
||||
// Front channels are mixed 36.94%, Center channels are mixed to be 26.12% & the back channels
|
||||
// are mixed to be 36.94%
|
||||
|
||||
constexpr float front_mix_amount = 36.94f / 100.0f;
|
||||
constexpr float center_mix_amount = 26.12f / 100.0f;
|
||||
constexpr float back_mix_amount = 36.94f / 100.0f;
|
||||
|
||||
// Mix 50% from left and 50% from right channel
|
||||
const auto left = front_mix_amount * static_cast<float>(fl_channel) +
|
||||
center_mix_amount * static_cast<float>(fc_channel) +
|
||||
back_mix_amount * static_cast<float>(bl_channel);
|
||||
|
||||
const auto right = front_mix_amount * static_cast<float>(fr_channel) +
|
||||
center_mix_amount * static_cast<float>(fc_channel) +
|
||||
back_mix_amount * static_cast<float>(br_channel);
|
||||
|
||||
return {ClampToS16(static_cast<s32>(left)), ClampToS16(static_cast<s32>(right))};
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr std::tuple<s16, s16> Mix6To2WithCoefficients(
|
||||
s16 fl_channel, s16 fr_channel, s16 fc_channel, s16 lf_channel, s16 bl_channel, s16 br_channel,
|
||||
const std::array<float_le, 4>& coeff) {
|
||||
const auto left =
|
||||
static_cast<float>(fl_channel) * coeff[0] + static_cast<float>(fc_channel) * coeff[1] +
|
||||
static_cast<float>(lf_channel) * coeff[2] + static_cast<float>(bl_channel) * coeff[0];
|
||||
|
||||
const auto right =
|
||||
static_cast<float>(fr_channel) * coeff[0] + static_cast<float>(fc_channel) * coeff[1] +
|
||||
static_cast<float>(lf_channel) * coeff[2] + static_cast<float>(br_channel) * coeff[0];
|
||||
|
||||
return {ClampToS16(static_cast<s32>(left)), ClampToS16(static_cast<s32>(right))};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
constexpr u32 STREAM_SAMPLE_RATE{48000};
|
||||
constexpr u32 STREAM_NUM_CHANNELS{2};
|
||||
using VoiceChannelHolder = std::array<VoiceResourceInformation*, 6>;
|
||||
class AudioRenderer::VoiceState {
|
||||
public:
|
||||
bool IsPlaying() const {
|
||||
return is_in_use && info.play_state == PlayState::Started;
|
||||
}
|
||||
|
||||
const VoiceOutStatus& GetOutStatus() const {
|
||||
return out_status;
|
||||
}
|
||||
|
||||
const VoiceInfo& GetInfo() const {
|
||||
return info;
|
||||
}
|
||||
|
||||
VoiceInfo& GetInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
void SetWaveIndex(std::size_t index);
|
||||
std::vector<s16> DequeueSamples(std::size_t sample_count, Core::Memory::Memory& memory,
|
||||
const VoiceChannelHolder& voice_resources);
|
||||
void UpdateState();
|
||||
void RefreshBuffer(Core::Memory::Memory& memory, const VoiceChannelHolder& voice_resources);
|
||||
|
||||
private:
|
||||
bool is_in_use{};
|
||||
bool is_refresh_pending{};
|
||||
std::size_t wave_index{};
|
||||
std::size_t offset{};
|
||||
Codec::ADPCMState adpcm_state{};
|
||||
InterpolationState interp_state{};
|
||||
std::vector<s16> samples;
|
||||
VoiceOutStatus out_status{};
|
||||
VoiceInfo info{};
|
||||
};
|
||||
|
||||
class AudioRenderer::EffectState {
|
||||
public:
|
||||
const EffectOutStatus& GetOutStatus() const {
|
||||
return out_status;
|
||||
}
|
||||
|
||||
const EffectInStatus& GetInfo() const {
|
||||
return info;
|
||||
}
|
||||
|
||||
EffectInStatus& GetInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
void UpdateState(Core::Memory::Memory& memory);
|
||||
|
||||
private:
|
||||
EffectOutStatus out_status{};
|
||||
EffectInStatus info{};
|
||||
};
|
||||
|
||||
AudioRenderer::AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_,
|
||||
AudioRendererParameter params,
|
||||
std::shared_ptr<Kernel::WritableEvent> buffer_event,
|
||||
AudioCommon::AudioRendererParameter params,
|
||||
Stream::ReleaseCallback&& release_callback,
|
||||
std::size_t instance_number)
|
||||
: worker_params{params}, buffer_event{buffer_event}, voices(params.voice_count),
|
||||
voice_resources(params.voice_count), effects(params.effect_count), memory{memory_} {
|
||||
: worker_params{params}, memory_pool_info(params.effect_count + params.voice_count * 4),
|
||||
voice_context(params.voice_count), effect_context(params.effect_count), mix_context(),
|
||||
sink_context(params.sink_count), splitter_context(),
|
||||
voices(params.voice_count), memory{memory_},
|
||||
command_generator(worker_params, voice_context, mix_context, splitter_context, effect_context,
|
||||
memory) {
|
||||
behavior_info.SetUserRevision(params.revision);
|
||||
splitter_context.Initialize(behavior_info, params.splitter_count,
|
||||
params.num_splitter_send_channels);
|
||||
mix_context.Initialize(behavior_info, params.submix_count + 1, params.effect_count);
|
||||
audio_out = std::make_unique<AudioCore::AudioOut>();
|
||||
stream = audio_out->OpenStream(core_timing, STREAM_SAMPLE_RATE, STREAM_NUM_CHANNELS,
|
||||
fmt::format("AudioRenderer-Instance{}", instance_number),
|
||||
[=]() { buffer_event->Signal(); });
|
||||
stream = audio_out->OpenStream(
|
||||
core_timing, params.sample_rate, AudioCommon::STREAM_NUM_CHANNELS,
|
||||
fmt::format("AudioRenderer-Instance{}", instance_number), std::move(release_callback));
|
||||
audio_out->StartStream(stream);
|
||||
|
||||
QueueMixedBuffer(0);
|
||||
QueueMixedBuffer(1);
|
||||
QueueMixedBuffer(2);
|
||||
QueueMixedBuffer(3);
|
||||
}
|
||||
|
||||
AudioRenderer::~AudioRenderer() = default;
|
||||
@@ -111,359 +112,210 @@ Stream::State AudioRenderer::GetStreamState() const {
|
||||
return stream->GetState();
|
||||
}
|
||||
|
||||
ResultVal<std::vector<u8>> AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_params) {
|
||||
// Copy UpdateDataHeader struct
|
||||
UpdateDataHeader config{};
|
||||
std::memcpy(&config, input_params.data(), sizeof(UpdateDataHeader));
|
||||
u32 memory_pool_count = worker_params.effect_count + (worker_params.voice_count * 4);
|
||||
ResultCode AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_params,
|
||||
std::vector<u8>& output_params) {
|
||||
|
||||
if (!behavior_info.UpdateInput(input_params, sizeof(UpdateDataHeader))) {
|
||||
InfoUpdater info_updater{input_params, output_params, behavior_info};
|
||||
|
||||
if (!info_updater.UpdateBehaviorInfo(behavior_info)) {
|
||||
LOG_ERROR(Audio, "Failed to update behavior info input parameters");
|
||||
return Audren::ERR_INVALID_PARAMETERS;
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
// Copy MemoryPoolInfo structs
|
||||
std::vector<MemoryPoolInfo> mem_pool_info(memory_pool_count);
|
||||
std::memcpy(mem_pool_info.data(),
|
||||
input_params.data() + sizeof(UpdateDataHeader) + config.behavior_size,
|
||||
memory_pool_count * sizeof(MemoryPoolInfo));
|
||||
|
||||
// Copy voice resources
|
||||
const std::size_t voice_resource_offset{sizeof(UpdateDataHeader) + config.behavior_size +
|
||||
config.memory_pools_size};
|
||||
std::memcpy(voice_resources.data(), input_params.data() + voice_resource_offset,
|
||||
sizeof(VoiceResourceInformation) * voice_resources.size());
|
||||
|
||||
// Copy VoiceInfo structs
|
||||
std::size_t voice_offset{sizeof(UpdateDataHeader) + config.behavior_size +
|
||||
config.memory_pools_size + config.voice_resource_size};
|
||||
for (auto& voice : voices) {
|
||||
std::memcpy(&voice.GetInfo(), input_params.data() + voice_offset, sizeof(VoiceInfo));
|
||||
voice_offset += sizeof(VoiceInfo);
|
||||
if (!info_updater.UpdateMemoryPools(memory_pool_info)) {
|
||||
LOG_ERROR(Audio, "Failed to update memory pool parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
std::size_t effect_offset{sizeof(UpdateDataHeader) + config.behavior_size +
|
||||
config.memory_pools_size + config.voice_resource_size +
|
||||
config.voices_size};
|
||||
for (auto& effect : effects) {
|
||||
std::memcpy(&effect.GetInfo(), input_params.data() + effect_offset, sizeof(EffectInStatus));
|
||||
effect_offset += sizeof(EffectInStatus);
|
||||
if (!info_updater.UpdateVoiceChannelResources(voice_context)) {
|
||||
LOG_ERROR(Audio, "Failed to update voice channel resource parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
// Update memory pool state
|
||||
std::vector<MemoryPoolEntry> memory_pool(memory_pool_count);
|
||||
for (std::size_t index = 0; index < memory_pool.size(); ++index) {
|
||||
if (mem_pool_info[index].pool_state == MemoryPoolStates::RequestAttach) {
|
||||
memory_pool[index].state = MemoryPoolStates::Attached;
|
||||
} else if (mem_pool_info[index].pool_state == MemoryPoolStates::RequestDetach) {
|
||||
memory_pool[index].state = MemoryPoolStates::Detached;
|
||||
if (!info_updater.UpdateVoices(voice_context, memory_pool_info, 0)) {
|
||||
LOG_ERROR(Audio, "Failed to update voice parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
// TODO(ogniK): Deal with stopped audio renderer but updates still taking place
|
||||
if (!info_updater.UpdateEffects(effect_context, true)) {
|
||||
LOG_ERROR(Audio, "Failed to update effect parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
if (behavior_info.IsSplitterSupported()) {
|
||||
if (!info_updater.UpdateSplitterInfo(splitter_context)) {
|
||||
LOG_ERROR(Audio, "Failed to update splitter parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
// Update voices
|
||||
for (auto& voice : voices) {
|
||||
voice.UpdateState();
|
||||
if (!voice.GetInfo().is_in_use) {
|
||||
continue;
|
||||
}
|
||||
if (voice.GetInfo().is_new) {
|
||||
voice.SetWaveIndex(voice.GetInfo().wave_buffer_head);
|
||||
}
|
||||
const auto mix_result = info_updater.UpdateMixes(mix_context, worker_params.mix_buffer_count,
|
||||
splitter_context, effect_context);
|
||||
|
||||
if (mix_result.IsError()) {
|
||||
LOG_ERROR(Audio, "Failed to update mix parameters");
|
||||
return mix_result;
|
||||
}
|
||||
|
||||
for (auto& effect : effects) {
|
||||
effect.UpdateState(memory);
|
||||
// TODO(ogniK): Sinks
|
||||
if (!info_updater.UpdateSinks(sink_context)) {
|
||||
LOG_ERROR(Audio, "Failed to update sink parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
// TODO(ogniK): Performance buffer
|
||||
if (!info_updater.UpdatePerformanceBuffer()) {
|
||||
LOG_ERROR(Audio, "Failed to update performance buffer parameters");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
if (!info_updater.UpdateErrorInfo(behavior_info)) {
|
||||
LOG_ERROR(Audio, "Failed to update error info");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
if (behavior_info.IsElapsedFrameCountSupported()) {
|
||||
if (!info_updater.UpdateRendererInfo(elapsed_frame_count)) {
|
||||
LOG_ERROR(Audio, "Failed to update renderer info");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
}
|
||||
// TODO(ogniK): Statistics
|
||||
|
||||
if (!info_updater.WriteOutputHeader()) {
|
||||
LOG_ERROR(Audio, "Failed to write output header");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
// TODO(ogniK): Check when all sections are implemented
|
||||
|
||||
if (!info_updater.CheckConsumedSize()) {
|
||||
LOG_ERROR(Audio, "Audio buffers were not consumed!");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
// Release previous buffers and queue next ones for playback
|
||||
ReleaseAndQueueBuffers();
|
||||
|
||||
// Copy output header
|
||||
UpdateDataHeader response_data{worker_params};
|
||||
if (behavior_info.IsElapsedFrameCountSupported()) {
|
||||
response_data.render_info = sizeof(RendererInfo);
|
||||
response_data.total_size += sizeof(RendererInfo);
|
||||
}
|
||||
|
||||
std::vector<u8> output_params(response_data.total_size);
|
||||
std::memcpy(output_params.data(), &response_data, sizeof(UpdateDataHeader));
|
||||
|
||||
// Copy output memory pool entries
|
||||
std::memcpy(output_params.data() + sizeof(UpdateDataHeader), memory_pool.data(),
|
||||
response_data.memory_pools_size);
|
||||
|
||||
// Copy output voice status
|
||||
std::size_t voice_out_status_offset{sizeof(UpdateDataHeader) + response_data.memory_pools_size};
|
||||
for (const auto& voice : voices) {
|
||||
std::memcpy(output_params.data() + voice_out_status_offset, &voice.GetOutStatus(),
|
||||
sizeof(VoiceOutStatus));
|
||||
voice_out_status_offset += sizeof(VoiceOutStatus);
|
||||
}
|
||||
|
||||
std::size_t effect_out_status_offset{
|
||||
sizeof(UpdateDataHeader) + response_data.memory_pools_size + response_data.voices_size +
|
||||
response_data.voice_resource_size};
|
||||
for (const auto& effect : effects) {
|
||||
std::memcpy(output_params.data() + effect_out_status_offset, &effect.GetOutStatus(),
|
||||
sizeof(EffectOutStatus));
|
||||
effect_out_status_offset += sizeof(EffectOutStatus);
|
||||
}
|
||||
|
||||
// Update behavior info output
|
||||
const std::size_t behavior_out_status_offset{
|
||||
sizeof(UpdateDataHeader) + response_data.memory_pools_size + response_data.voices_size +
|
||||
response_data.effects_size + response_data.sinks_size +
|
||||
response_data.performance_manager_size};
|
||||
|
||||
if (!behavior_info.UpdateOutput(output_params, behavior_out_status_offset)) {
|
||||
LOG_ERROR(Audio, "Failed to update behavior info output parameters");
|
||||
return Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
if (behavior_info.IsElapsedFrameCountSupported()) {
|
||||
const std::size_t renderer_info_offset{
|
||||
sizeof(UpdateDataHeader) + response_data.memory_pools_size + response_data.voices_size +
|
||||
response_data.effects_size + response_data.sinks_size +
|
||||
response_data.performance_manager_size + response_data.behavior_size};
|
||||
RendererInfo renderer_info{};
|
||||
renderer_info.elasped_frame_count = elapsed_frame_count;
|
||||
std::memcpy(output_params.data() + renderer_info_offset, &renderer_info,
|
||||
sizeof(RendererInfo));
|
||||
}
|
||||
|
||||
return MakeResult(output_params);
|
||||
}
|
||||
|
||||
void AudioRenderer::VoiceState::SetWaveIndex(std::size_t index) {
|
||||
wave_index = index & 3;
|
||||
is_refresh_pending = true;
|
||||
}
|
||||
|
||||
std::vector<s16> AudioRenderer::VoiceState::DequeueSamples(
|
||||
std::size_t sample_count, Core::Memory::Memory& memory,
|
||||
const VoiceChannelHolder& voice_resources) {
|
||||
if (!IsPlaying()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (is_refresh_pending) {
|
||||
RefreshBuffer(memory, voice_resources);
|
||||
}
|
||||
|
||||
const std::size_t max_size{samples.size() - offset};
|
||||
const std::size_t dequeue_offset{offset};
|
||||
std::size_t size{sample_count * STREAM_NUM_CHANNELS};
|
||||
if (size > max_size) {
|
||||
size = max_size;
|
||||
}
|
||||
|
||||
out_status.played_sample_count += size / STREAM_NUM_CHANNELS;
|
||||
offset += size;
|
||||
|
||||
const auto& wave_buffer{info.wave_buffer[wave_index]};
|
||||
if (offset == samples.size()) {
|
||||
offset = 0;
|
||||
|
||||
if (!wave_buffer.is_looping && wave_buffer.buffer_sz) {
|
||||
SetWaveIndex(wave_index + 1);
|
||||
}
|
||||
|
||||
if (wave_buffer.buffer_sz) {
|
||||
out_status.wave_buffer_consumed++;
|
||||
}
|
||||
|
||||
if (wave_buffer.end_of_stream || wave_buffer.buffer_sz == 0) {
|
||||
info.play_state = PlayState::Paused;
|
||||
}
|
||||
}
|
||||
|
||||
return {samples.begin() + dequeue_offset, samples.begin() + dequeue_offset + size};
|
||||
}
|
||||
|
||||
void AudioRenderer::VoiceState::UpdateState() {
|
||||
if (is_in_use && !info.is_in_use) {
|
||||
// No longer in use, reset state
|
||||
is_refresh_pending = true;
|
||||
wave_index = 0;
|
||||
offset = 0;
|
||||
out_status = {};
|
||||
}
|
||||
is_in_use = info.is_in_use;
|
||||
}
|
||||
|
||||
void AudioRenderer::VoiceState::RefreshBuffer(Core::Memory::Memory& memory,
|
||||
const VoiceChannelHolder& voice_resources) {
|
||||
const auto wave_buffer_address = info.wave_buffer[wave_index].buffer_addr;
|
||||
const auto wave_buffer_size = info.wave_buffer[wave_index].buffer_sz;
|
||||
std::vector<s16> new_samples(wave_buffer_size / sizeof(s16));
|
||||
memory.ReadBlock(wave_buffer_address, new_samples.data(), wave_buffer_size);
|
||||
|
||||
switch (static_cast<Codec::PcmFormat>(info.sample_format)) {
|
||||
case Codec::PcmFormat::Int16: {
|
||||
// PCM16 is played as-is
|
||||
break;
|
||||
}
|
||||
case Codec::PcmFormat::Adpcm: {
|
||||
// Decode ADPCM to PCM16
|
||||
Codec::ADPCM_Coeff coeffs;
|
||||
memory.ReadBlock(info.additional_params_addr, coeffs.data(), sizeof(Codec::ADPCM_Coeff));
|
||||
new_samples = Codec::DecodeADPCM(reinterpret_cast<u8*>(new_samples.data()),
|
||||
new_samples.size() * sizeof(s16), coeffs, adpcm_state);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented sample_format={}", info.sample_format);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info.channel_count) {
|
||||
case 1: {
|
||||
// 1 channel is upsampled to 2 channel
|
||||
samples.resize(new_samples.size() * 2);
|
||||
|
||||
for (std::size_t index = 0; index < new_samples.size(); ++index) {
|
||||
auto sample = static_cast<float>(new_samples[index]);
|
||||
if (voice_resources[0]->in_use) {
|
||||
sample *= voice_resources[0]->mix_volumes[0];
|
||||
}
|
||||
|
||||
samples[index * 2] = static_cast<s16>(sample * info.volume);
|
||||
samples[index * 2 + 1] = static_cast<s16>(sample * info.volume);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
// 2 channel is played as is
|
||||
samples = std::move(new_samples);
|
||||
const std::size_t sample_count = (samples.size() / 2);
|
||||
for (std::size_t index = 0; index < sample_count; ++index) {
|
||||
const std::size_t index_l = index * 2;
|
||||
const std::size_t index_r = index * 2 + 1;
|
||||
|
||||
auto sample_l = static_cast<float>(samples[index_l]);
|
||||
auto sample_r = static_cast<float>(samples[index_r]);
|
||||
|
||||
if (voice_resources[0]->in_use) {
|
||||
sample_l *= voice_resources[0]->mix_volumes[0];
|
||||
}
|
||||
|
||||
if (voice_resources[1]->in_use) {
|
||||
sample_r *= voice_resources[1]->mix_volumes[1];
|
||||
}
|
||||
|
||||
samples[index_l] = static_cast<s16>(sample_l * info.volume);
|
||||
samples[index_r] = static_cast<s16>(sample_r * info.volume);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
samples.resize((new_samples.size() / 6) * 2);
|
||||
const std::size_t sample_count = samples.size() / 2;
|
||||
|
||||
for (std::size_t index = 0; index < sample_count; ++index) {
|
||||
auto FL = static_cast<float>(new_samples[index * 6]);
|
||||
auto FR = static_cast<float>(new_samples[index * 6 + 1]);
|
||||
auto FC = static_cast<float>(new_samples[index * 6 + 2]);
|
||||
auto BL = static_cast<float>(new_samples[index * 6 + 4]);
|
||||
auto BR = static_cast<float>(new_samples[index * 6 + 5]);
|
||||
|
||||
if (voice_resources[0]->in_use) {
|
||||
FL *= voice_resources[0]->mix_volumes[0];
|
||||
}
|
||||
if (voice_resources[1]->in_use) {
|
||||
FR *= voice_resources[1]->mix_volumes[1];
|
||||
}
|
||||
if (voice_resources[2]->in_use) {
|
||||
FC *= voice_resources[2]->mix_volumes[2];
|
||||
}
|
||||
if (voice_resources[4]->in_use) {
|
||||
BL *= voice_resources[4]->mix_volumes[4];
|
||||
}
|
||||
if (voice_resources[5]->in_use) {
|
||||
BR *= voice_resources[5]->mix_volumes[5];
|
||||
}
|
||||
|
||||
samples[index * 2] =
|
||||
static_cast<s16>((0.3694f * FL + 0.2612f * FC + 0.3694f * BL) * info.volume);
|
||||
samples[index * 2 + 1] =
|
||||
static_cast<s16>((0.3694f * FR + 0.2612f * FC + 0.3694f * BR) * info.volume);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented channel_count={}", info.channel_count);
|
||||
break;
|
||||
}
|
||||
|
||||
// Only interpolate when necessary, expensive.
|
||||
if (GetInfo().sample_rate != STREAM_SAMPLE_RATE) {
|
||||
samples = Interpolate(interp_state, std::move(samples), GetInfo().sample_rate,
|
||||
STREAM_SAMPLE_RATE);
|
||||
}
|
||||
|
||||
is_refresh_pending = false;
|
||||
}
|
||||
|
||||
void AudioRenderer::EffectState::UpdateState(Core::Memory::Memory& memory) {
|
||||
if (info.is_new) {
|
||||
out_status.state = EffectStatus::New;
|
||||
} else {
|
||||
if (info.type == Effect::Aux) {
|
||||
ASSERT_MSG(memory.Read32(info.aux_info.return_buffer_info) == 0,
|
||||
"Aux buffers tried to update");
|
||||
ASSERT_MSG(memory.Read32(info.aux_info.send_buffer_info) == 0,
|
||||
"Aux buffers tried to update");
|
||||
ASSERT_MSG(memory.Read32(info.aux_info.return_buffer_base) == 0,
|
||||
"Aux buffers tried to update");
|
||||
ASSERT_MSG(memory.Read32(info.aux_info.send_buffer_base) == 0,
|
||||
"Aux buffers tried to update");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr s16 ClampToS16(s32 value) {
|
||||
return static_cast<s16>(std::clamp(value, -32768, 32767));
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void AudioRenderer::QueueMixedBuffer(Buffer::Tag tag) {
|
||||
constexpr std::size_t BUFFER_SIZE{512};
|
||||
command_generator.PreCommand();
|
||||
// Clear mix buffers before our next operation
|
||||
command_generator.ClearMixBuffers();
|
||||
|
||||
// If the splitter is not in use, sort our mixes
|
||||
if (!splitter_context.UsingSplitter()) {
|
||||
mix_context.SortInfo();
|
||||
}
|
||||
// Sort our voices
|
||||
voice_context.SortInfo();
|
||||
|
||||
// Handle samples
|
||||
command_generator.GenerateVoiceCommands();
|
||||
command_generator.GenerateSubMixCommands();
|
||||
command_generator.GenerateFinalMixCommands();
|
||||
|
||||
command_generator.PostCommand();
|
||||
// Base sample size
|
||||
std::size_t BUFFER_SIZE{worker_params.sample_count};
|
||||
// Samples
|
||||
std::vector<s16> buffer(BUFFER_SIZE * stream->GetNumChannels());
|
||||
// Make sure to clear our samples
|
||||
std::memset(buffer.data(), 0, buffer.size() * sizeof(s16));
|
||||
|
||||
for (auto& voice : voices) {
|
||||
if (!voice.IsPlaying()) {
|
||||
continue;
|
||||
}
|
||||
VoiceChannelHolder resources{};
|
||||
for (u32 channel = 0; channel < voice.GetInfo().channel_count; channel++) {
|
||||
const auto channel_resource_id = voice.GetInfo().voice_channel_resource_ids[channel];
|
||||
resources[channel] = &voice_resources[channel_resource_id];
|
||||
if (sink_context.InUse()) {
|
||||
const auto stream_channel_count = stream->GetNumChannels();
|
||||
const auto buffer_offsets = sink_context.OutputBuffers();
|
||||
const auto channel_count = buffer_offsets.size();
|
||||
const auto& final_mix = mix_context.GetFinalMixInfo();
|
||||
const auto& in_params = final_mix.GetInParams();
|
||||
std::vector<s32*> mix_buffers(channel_count);
|
||||
for (std::size_t i = 0; i < channel_count; i++) {
|
||||
mix_buffers[i] =
|
||||
command_generator.GetMixBuffer(in_params.buffer_offset + buffer_offsets[i]);
|
||||
}
|
||||
|
||||
std::size_t offset{};
|
||||
s64 samples_remaining{BUFFER_SIZE};
|
||||
while (samples_remaining > 0) {
|
||||
const std::vector<s16> samples{
|
||||
voice.DequeueSamples(samples_remaining, memory, resources)};
|
||||
for (std::size_t i = 0; i < BUFFER_SIZE; i++) {
|
||||
if (channel_count == 1) {
|
||||
const auto sample = ClampToS16(mix_buffers[0][i]);
|
||||
|
||||
if (samples.empty()) {
|
||||
break;
|
||||
}
|
||||
// Place sample in all channels
|
||||
for (u32 channel = 0; channel < stream_channel_count; channel++) {
|
||||
buffer[i * stream_channel_count + channel] = sample;
|
||||
}
|
||||
|
||||
samples_remaining -= samples.size() / stream->GetNumChannels();
|
||||
if (stream_channel_count == 6) {
|
||||
// Output stream has a LF channel, mute it!
|
||||
buffer[i * stream_channel_count + 3] = 0;
|
||||
}
|
||||
|
||||
for (const auto& sample : samples) {
|
||||
const s32 buffer_sample{buffer[offset]};
|
||||
buffer[offset++] =
|
||||
ClampToS16(buffer_sample + static_cast<s32>(sample * voice.GetInfo().volume));
|
||||
} else if (channel_count == 2) {
|
||||
const auto l_sample = ClampToS16(mix_buffers[0][i]);
|
||||
const auto r_sample = ClampToS16(mix_buffers[1][i]);
|
||||
if (stream_channel_count == 1) {
|
||||
buffer[i * stream_channel_count + 0] = Mix2To1(l_sample, r_sample);
|
||||
} else if (stream_channel_count == 2) {
|
||||
buffer[i * stream_channel_count + 0] = l_sample;
|
||||
buffer[i * stream_channel_count + 1] = r_sample;
|
||||
} else if (stream_channel_count == 6) {
|
||||
buffer[i * stream_channel_count + 0] = l_sample;
|
||||
buffer[i * stream_channel_count + 1] = r_sample;
|
||||
|
||||
// Combine both left and right channels to the center channel
|
||||
buffer[i * stream_channel_count + 2] = Mix2To1(l_sample, r_sample);
|
||||
|
||||
buffer[i * stream_channel_count + 4] = l_sample;
|
||||
buffer[i * stream_channel_count + 5] = r_sample;
|
||||
}
|
||||
|
||||
} else if (channel_count == 6) {
|
||||
const auto fl_sample = ClampToS16(mix_buffers[0][i]);
|
||||
const auto fr_sample = ClampToS16(mix_buffers[1][i]);
|
||||
const auto fc_sample = ClampToS16(mix_buffers[2][i]);
|
||||
const auto lf_sample = ClampToS16(mix_buffers[3][i]);
|
||||
const auto bl_sample = ClampToS16(mix_buffers[4][i]);
|
||||
const auto br_sample = ClampToS16(mix_buffers[5][i]);
|
||||
|
||||
if (stream_channel_count == 1) {
|
||||
// Games seem to ignore the center channel half the time, we use the front left
|
||||
// and right channel for mixing as that's where majority of the audio goes
|
||||
buffer[i * stream_channel_count + 0] = Mix2To1(fl_sample, fr_sample);
|
||||
} else if (stream_channel_count == 2) {
|
||||
// Mix all channels into 2 channels
|
||||
if (sink_context.HasDownMixingCoefficients()) {
|
||||
const auto [left, right] = Mix6To2WithCoefficients(
|
||||
fl_sample, fr_sample, fc_sample, lf_sample, bl_sample, br_sample,
|
||||
sink_context.GetDownmixCoefficients());
|
||||
buffer[i * stream_channel_count + 0] = left;
|
||||
buffer[i * stream_channel_count + 1] = right;
|
||||
} else {
|
||||
const auto [left, right] = Mix6To2(fl_sample, fr_sample, fc_sample,
|
||||
lf_sample, bl_sample, br_sample);
|
||||
buffer[i * stream_channel_count + 0] = left;
|
||||
buffer[i * stream_channel_count + 1] = right;
|
||||
}
|
||||
} else if (stream_channel_count == 6) {
|
||||
// Pass through
|
||||
buffer[i * stream_channel_count + 0] = fl_sample;
|
||||
buffer[i * stream_channel_count + 1] = fr_sample;
|
||||
buffer[i * stream_channel_count + 2] = fc_sample;
|
||||
buffer[i * stream_channel_count + 3] = lf_sample;
|
||||
buffer[i * stream_channel_count + 4] = bl_sample;
|
||||
buffer[i * stream_channel_count + 5] = br_sample;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
audio_out->QueueBuffer(stream, tag, std::move(buffer));
|
||||
elapsed_frame_count++;
|
||||
voice_context.UpdateStateByDspShared();
|
||||
}
|
||||
|
||||
void AudioRenderer::ReleaseAndQueueBuffers() {
|
||||
const auto released_buffers{audio_out->GetTagsAndReleaseBuffers(stream, 2)};
|
||||
const auto released_buffers{audio_out->GetTagsAndReleaseBuffers(stream)};
|
||||
for (const auto& tag : released_buffers) {
|
||||
QueueMixedBuffer(tag);
|
||||
}
|
||||
|
||||
@@ -9,261 +9,64 @@
|
||||
#include <vector>
|
||||
|
||||
#include "audio_core/behavior_info.h"
|
||||
#include "audio_core/command_generator.h"
|
||||
#include "audio_core/common.h"
|
||||
#include "audio_core/effect_context.h"
|
||||
#include "audio_core/memory_pool.h"
|
||||
#include "audio_core/mix_context.h"
|
||||
#include "audio_core/sink_context.h"
|
||||
#include "audio_core/splitter_context.h"
|
||||
#include "audio_core/stream.h"
|
||||
#include "audio_core/voice_context.h"
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/swap.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace Core::Timing {
|
||||
class CoreTiming;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class WritableEvent;
|
||||
}
|
||||
|
||||
namespace Core::Memory {
|
||||
class Memory;
|
||||
}
|
||||
|
||||
namespace AudioCore {
|
||||
using DSPStateHolder = std::array<VoiceState*, AudioCommon::MAX_CHANNEL_COUNT>;
|
||||
|
||||
class AudioOut;
|
||||
|
||||
enum class PlayState : u8 {
|
||||
Started = 0,
|
||||
Stopped = 1,
|
||||
Paused = 2,
|
||||
};
|
||||
|
||||
enum class Effect : u8 {
|
||||
None = 0,
|
||||
Aux = 2,
|
||||
};
|
||||
|
||||
enum class EffectStatus : u8 {
|
||||
None = 0,
|
||||
New = 1,
|
||||
};
|
||||
|
||||
struct AudioRendererParameter {
|
||||
u32_le sample_rate;
|
||||
u32_le sample_count;
|
||||
u32_le mix_buffer_count;
|
||||
u32_le submix_count;
|
||||
u32_le voice_count;
|
||||
u32_le sink_count;
|
||||
u32_le effect_count;
|
||||
u32_le performance_frame_count;
|
||||
u8 is_voice_drop_enabled;
|
||||
u8 unknown_21;
|
||||
u8 unknown_22;
|
||||
u8 execution_mode;
|
||||
u32_le splitter_count;
|
||||
u32_le num_splitter_send_channels;
|
||||
u32_le unknown_30;
|
||||
u32_le revision;
|
||||
};
|
||||
static_assert(sizeof(AudioRendererParameter) == 52, "AudioRendererParameter is an invalid size");
|
||||
|
||||
enum class MemoryPoolStates : u32 { // Should be LE
|
||||
Invalid = 0x0,
|
||||
Unknown = 0x1,
|
||||
RequestDetach = 0x2,
|
||||
Detached = 0x3,
|
||||
RequestAttach = 0x4,
|
||||
Attached = 0x5,
|
||||
Released = 0x6,
|
||||
};
|
||||
|
||||
struct MemoryPoolEntry {
|
||||
MemoryPoolStates state;
|
||||
u32_le unknown_4;
|
||||
u32_le unknown_8;
|
||||
u32_le unknown_c;
|
||||
};
|
||||
static_assert(sizeof(MemoryPoolEntry) == 0x10, "MemoryPoolEntry has wrong size");
|
||||
|
||||
struct MemoryPoolInfo {
|
||||
u64_le pool_address;
|
||||
u64_le pool_size;
|
||||
MemoryPoolStates pool_state;
|
||||
INSERT_PADDING_WORDS(3); // Unknown
|
||||
};
|
||||
static_assert(sizeof(MemoryPoolInfo) == 0x20, "MemoryPoolInfo has wrong size");
|
||||
struct BiquadFilter {
|
||||
u8 enable;
|
||||
INSERT_PADDING_BYTES(1);
|
||||
std::array<s16_le, 3> numerator;
|
||||
std::array<s16_le, 2> denominator;
|
||||
};
|
||||
static_assert(sizeof(BiquadFilter) == 0xc, "BiquadFilter has wrong size");
|
||||
|
||||
struct WaveBuffer {
|
||||
u64_le buffer_addr;
|
||||
u64_le buffer_sz;
|
||||
s32_le start_sample_offset;
|
||||
s32_le end_sample_offset;
|
||||
u8 is_looping;
|
||||
u8 end_of_stream;
|
||||
u8 sent_to_server;
|
||||
INSERT_PADDING_BYTES(5);
|
||||
u64 context_addr;
|
||||
u64 context_sz;
|
||||
INSERT_PADDING_BYTES(8);
|
||||
};
|
||||
static_assert(sizeof(WaveBuffer) == 0x38, "WaveBuffer has wrong size");
|
||||
|
||||
struct VoiceResourceInformation {
|
||||
s32_le id{};
|
||||
std::array<float_le, MAX_MIX_BUFFERS> mix_volumes{};
|
||||
bool in_use{};
|
||||
INSERT_PADDING_BYTES(11);
|
||||
};
|
||||
static_assert(sizeof(VoiceResourceInformation) == 0x70, "VoiceResourceInformation has wrong size");
|
||||
|
||||
struct VoiceInfo {
|
||||
u32_le id;
|
||||
u32_le node_id;
|
||||
u8 is_new;
|
||||
u8 is_in_use;
|
||||
PlayState play_state;
|
||||
u8 sample_format;
|
||||
u32_le sample_rate;
|
||||
u32_le priority;
|
||||
u32_le sorting_order;
|
||||
u32_le channel_count;
|
||||
float_le pitch;
|
||||
float_le volume;
|
||||
std::array<BiquadFilter, 2> biquad_filter;
|
||||
u32_le wave_buffer_count;
|
||||
u32_le wave_buffer_head;
|
||||
INSERT_PADDING_WORDS(1);
|
||||
u64_le additional_params_addr;
|
||||
u64_le additional_params_sz;
|
||||
u32_le mix_id;
|
||||
u32_le splitter_info_id;
|
||||
std::array<WaveBuffer, 4> wave_buffer;
|
||||
std::array<u32_le, 6> voice_channel_resource_ids;
|
||||
INSERT_PADDING_BYTES(24);
|
||||
};
|
||||
static_assert(sizeof(VoiceInfo) == 0x170, "VoiceInfo is wrong size");
|
||||
|
||||
struct VoiceOutStatus {
|
||||
u64_le played_sample_count;
|
||||
u32_le wave_buffer_consumed;
|
||||
u32_le voice_drops_count;
|
||||
};
|
||||
static_assert(sizeof(VoiceOutStatus) == 0x10, "VoiceOutStatus has wrong size");
|
||||
|
||||
struct AuxInfo {
|
||||
std::array<u8, 24> input_mix_buffers;
|
||||
std::array<u8, 24> output_mix_buffers;
|
||||
u32_le mix_buffer_count;
|
||||
u32_le sample_rate; // Stored in the aux buffer currently
|
||||
u32_le sample_count;
|
||||
u64_le send_buffer_info;
|
||||
u64_le send_buffer_base;
|
||||
|
||||
u64_le return_buffer_info;
|
||||
u64_le return_buffer_base;
|
||||
};
|
||||
static_assert(sizeof(AuxInfo) == 0x60, "AuxInfo is an invalid size");
|
||||
|
||||
struct EffectInStatus {
|
||||
Effect type;
|
||||
u8 is_new;
|
||||
u8 is_enabled;
|
||||
INSERT_PADDING_BYTES(1);
|
||||
u32_le mix_id;
|
||||
u64_le buffer_base;
|
||||
u64_le buffer_sz;
|
||||
s32_le priority;
|
||||
INSERT_PADDING_BYTES(4);
|
||||
union {
|
||||
std::array<u8, 0xa0> raw;
|
||||
AuxInfo aux_info;
|
||||
};
|
||||
};
|
||||
static_assert(sizeof(EffectInStatus) == 0xc0, "EffectInStatus is an invalid size");
|
||||
|
||||
struct EffectOutStatus {
|
||||
EffectStatus state;
|
||||
INSERT_PADDING_BYTES(0xf);
|
||||
};
|
||||
static_assert(sizeof(EffectOutStatus) == 0x10, "EffectOutStatus is an invalid size");
|
||||
|
||||
struct RendererInfo {
|
||||
u64_le elasped_frame_count{};
|
||||
INSERT_PADDING_WORDS(2);
|
||||
};
|
||||
static_assert(sizeof(RendererInfo) == 0x10, "RendererInfo is an invalid size");
|
||||
|
||||
struct UpdateDataHeader {
|
||||
UpdateDataHeader() {}
|
||||
|
||||
explicit UpdateDataHeader(const AudioRendererParameter& config) {
|
||||
revision = Common::MakeMagic('R', 'E', 'V', '8'); // 9.2.0 Revision
|
||||
behavior_size = 0xb0;
|
||||
memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10;
|
||||
voices_size = config.voice_count * 0x10;
|
||||
voice_resource_size = 0x0;
|
||||
effects_size = config.effect_count * 0x10;
|
||||
mixes_size = 0x0;
|
||||
sinks_size = config.sink_count * 0x20;
|
||||
performance_manager_size = 0x10;
|
||||
render_info = 0;
|
||||
total_size = sizeof(UpdateDataHeader) + behavior_size + memory_pools_size + voices_size +
|
||||
effects_size + sinks_size + performance_manager_size;
|
||||
}
|
||||
|
||||
u32_le revision{};
|
||||
u32_le behavior_size{};
|
||||
u32_le memory_pools_size{};
|
||||
u32_le voices_size{};
|
||||
u32_le voice_resource_size{};
|
||||
u32_le effects_size{};
|
||||
u32_le mixes_size{};
|
||||
u32_le sinks_size{};
|
||||
u32_le performance_manager_size{};
|
||||
u32_le splitter_size{};
|
||||
u32_le render_info{};
|
||||
INSERT_PADDING_WORDS(4);
|
||||
u32_le total_size{};
|
||||
};
|
||||
static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader has wrong size");
|
||||
|
||||
class AudioRenderer {
|
||||
public:
|
||||
AudioRenderer(Core::Timing::CoreTiming& core_timing, Core::Memory::Memory& memory_,
|
||||
AudioRendererParameter params,
|
||||
std::shared_ptr<Kernel::WritableEvent> buffer_event, std::size_t instance_number);
|
||||
AudioCommon::AudioRendererParameter params,
|
||||
Stream::ReleaseCallback&& release_callback, std::size_t instance_number);
|
||||
~AudioRenderer();
|
||||
|
||||
ResultVal<std::vector<u8>> UpdateAudioRenderer(const std::vector<u8>& input_params);
|
||||
[[nodiscard]] ResultCode UpdateAudioRenderer(const std::vector<u8>& input_params,
|
||||
std::vector<u8>& output_params);
|
||||
void QueueMixedBuffer(Buffer::Tag tag);
|
||||
void ReleaseAndQueueBuffers();
|
||||
u32 GetSampleRate() const;
|
||||
u32 GetSampleCount() const;
|
||||
u32 GetMixBufferCount() const;
|
||||
Stream::State GetStreamState() const;
|
||||
[[nodiscard]] u32 GetSampleRate() const;
|
||||
[[nodiscard]] u32 GetSampleCount() const;
|
||||
[[nodiscard]] u32 GetMixBufferCount() const;
|
||||
[[nodiscard]] Stream::State GetStreamState() const;
|
||||
|
||||
private:
|
||||
class EffectState;
|
||||
class VoiceState;
|
||||
BehaviorInfo behavior_info{};
|
||||
|
||||
AudioRendererParameter worker_params;
|
||||
std::shared_ptr<Kernel::WritableEvent> buffer_event;
|
||||
AudioCommon::AudioRendererParameter worker_params;
|
||||
std::vector<ServerMemoryPoolInfo> memory_pool_info;
|
||||
VoiceContext voice_context;
|
||||
EffectContext effect_context;
|
||||
MixContext mix_context;
|
||||
SinkContext sink_context;
|
||||
SplitterContext splitter_context;
|
||||
std::vector<VoiceState> voices;
|
||||
std::vector<VoiceResourceInformation> voice_resources;
|
||||
std::vector<EffectState> effects;
|
||||
std::unique_ptr<AudioOut> audio_out;
|
||||
StreamPtr stream;
|
||||
Core::Memory::Memory& memory;
|
||||
CommandGenerator command_generator;
|
||||
std::size_t elapsed_frame_count{};
|
||||
};
|
||||
|
||||
|
||||
@@ -9,39 +9,11 @@
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
BehaviorInfo::BehaviorInfo() : process_revision(CURRENT_PROCESS_REVISION) {}
|
||||
BehaviorInfo::BehaviorInfo() : process_revision(AudioCommon::CURRENT_PROCESS_REVISION) {}
|
||||
BehaviorInfo::~BehaviorInfo() = default;
|
||||
|
||||
bool BehaviorInfo::UpdateInput(const std::vector<u8>& buffer, std::size_t offset) {
|
||||
if (!CanConsumeBuffer(buffer.size(), offset, sizeof(InParams))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
InParams params{};
|
||||
std::memcpy(¶ms, buffer.data() + offset, sizeof(InParams));
|
||||
|
||||
if (!IsValidRevision(params.revision)) {
|
||||
LOG_ERROR(Audio, "Invalid input revision, revision=0x{:08X}", params.revision);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (user_revision != params.revision) {
|
||||
LOG_ERROR(Audio,
|
||||
"User revision differs from input revision, expecting 0x{:08X} but got 0x{:08X}",
|
||||
user_revision, params.revision);
|
||||
return false;
|
||||
}
|
||||
|
||||
ClearError();
|
||||
UpdateFlags(params.flags);
|
||||
|
||||
// TODO(ogniK): Check input params size when InfoUpdater is used
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BehaviorInfo::UpdateOutput(std::vector<u8>& buffer, std::size_t offset) {
|
||||
if (!CanConsumeBuffer(buffer.size(), offset, sizeof(OutParams))) {
|
||||
if (!AudioCommon::CanConsumeBuffer(buffer.size(), offset, sizeof(OutParams))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
@@ -65,36 +37,69 @@ void BehaviorInfo::SetUserRevision(u32_le revision) {
|
||||
user_revision = revision;
|
||||
}
|
||||
|
||||
u32_le BehaviorInfo::GetUserRevision() const {
|
||||
return user_revision;
|
||||
}
|
||||
|
||||
u32_le BehaviorInfo::GetProcessRevision() const {
|
||||
return process_revision;
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsAdpcmLoopContextBugFixed() const {
|
||||
return IsRevisionSupported(2, user_revision);
|
||||
return AudioCommon::IsRevisionSupported(2, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsSplitterSupported() const {
|
||||
return IsRevisionSupported(2, user_revision);
|
||||
return AudioCommon::IsRevisionSupported(2, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsLongSizePreDelaySupported() const {
|
||||
return IsRevisionSupported(3, user_revision);
|
||||
return AudioCommon::IsRevisionSupported(3, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsAudioRenererProcessingTimeLimit80PercentSupported() const {
|
||||
return IsRevisionSupported(5, user_revision);
|
||||
bool BehaviorInfo::IsAudioRendererProcessingTimeLimit80PercentSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(5, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsAudioRenererProcessingTimeLimit75PercentSupported() const {
|
||||
return IsRevisionSupported(4, user_revision);
|
||||
bool BehaviorInfo::IsAudioRendererProcessingTimeLimit75PercentSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(4, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsAudioRenererProcessingTimeLimit70PercentSupported() const {
|
||||
return IsRevisionSupported(1, user_revision);
|
||||
bool BehaviorInfo::IsAudioRendererProcessingTimeLimit70PercentSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(1, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsElapsedFrameCountSupported() const {
|
||||
return IsRevisionSupported(5, user_revision);
|
||||
return AudioCommon::IsRevisionSupported(5, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsMemoryPoolForceMappingEnabled() const {
|
||||
return (flags & 1) != 0;
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsFlushVoiceWaveBuffersSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(5, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsVoicePlayedSampleCountResetAtLoopPointSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(5, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsVoicePitchAndSrcSkippedSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(5, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsMixInParameterDirtyOnlyUpdateSupported() const {
|
||||
return AudioCommon::IsRevisionSupported(7, user_revision);
|
||||
}
|
||||
|
||||
bool BehaviorInfo::IsSplitterBugFixed() const {
|
||||
return AudioCommon::IsRevisionSupported(5, user_revision);
|
||||
}
|
||||
|
||||
void BehaviorInfo::CopyErrorInfo(BehaviorInfo::OutParams& dst) {
|
||||
dst.error_count = static_cast<u32>(error_count);
|
||||
std::copy(errors.begin(), errors.begin() + error_count, dst.errors.begin());
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
|
||||
@@ -14,30 +14,6 @@
|
||||
namespace AudioCore {
|
||||
class BehaviorInfo {
|
||||
public:
|
||||
explicit BehaviorInfo();
|
||||
~BehaviorInfo();
|
||||
|
||||
bool UpdateInput(const std::vector<u8>& buffer, std::size_t offset);
|
||||
bool UpdateOutput(std::vector<u8>& buffer, std::size_t offset);
|
||||
|
||||
void ClearError();
|
||||
void UpdateFlags(u64_le dest_flags);
|
||||
void SetUserRevision(u32_le revision);
|
||||
|
||||
bool IsAdpcmLoopContextBugFixed() const;
|
||||
bool IsSplitterSupported() const;
|
||||
bool IsLongSizePreDelaySupported() const;
|
||||
bool IsAudioRenererProcessingTimeLimit80PercentSupported() const;
|
||||
bool IsAudioRenererProcessingTimeLimit75PercentSupported() const;
|
||||
bool IsAudioRenererProcessingTimeLimit70PercentSupported() const;
|
||||
bool IsElapsedFrameCountSupported() const;
|
||||
bool IsMemoryPoolForceMappingEnabled() const;
|
||||
|
||||
private:
|
||||
u32_le process_revision{};
|
||||
u32_le user_revision{};
|
||||
u64_le flags{};
|
||||
|
||||
struct ErrorInfo {
|
||||
u32_le result{};
|
||||
INSERT_PADDING_WORDS(1);
|
||||
@@ -45,9 +21,6 @@ private:
|
||||
};
|
||||
static_assert(sizeof(ErrorInfo) == 0x10, "ErrorInfo is an invalid size");
|
||||
|
||||
std::array<ErrorInfo, 10> errors{};
|
||||
std::size_t error_count{};
|
||||
|
||||
struct InParams {
|
||||
u32_le revision{};
|
||||
u32_le padding{};
|
||||
@@ -61,6 +34,39 @@ private:
|
||||
INSERT_PADDING_BYTES(12);
|
||||
};
|
||||
static_assert(sizeof(OutParams) == 0xb0, "OutParams is an invalid size");
|
||||
|
||||
explicit BehaviorInfo();
|
||||
~BehaviorInfo();
|
||||
|
||||
bool UpdateOutput(std::vector<u8>& buffer, std::size_t offset);
|
||||
|
||||
void ClearError();
|
||||
void UpdateFlags(u64_le dest_flags);
|
||||
void SetUserRevision(u32_le revision);
|
||||
[[nodiscard]] u32_le GetUserRevision() const;
|
||||
[[nodiscard]] u32_le GetProcessRevision() const;
|
||||
|
||||
[[nodiscard]] bool IsAdpcmLoopContextBugFixed() const;
|
||||
[[nodiscard]] bool IsSplitterSupported() const;
|
||||
[[nodiscard]] bool IsLongSizePreDelaySupported() const;
|
||||
[[nodiscard]] bool IsAudioRendererProcessingTimeLimit80PercentSupported() const;
|
||||
[[nodiscard]] bool IsAudioRendererProcessingTimeLimit75PercentSupported() const;
|
||||
[[nodiscard]] bool IsAudioRendererProcessingTimeLimit70PercentSupported() const;
|
||||
[[nodiscard]] bool IsElapsedFrameCountSupported() const;
|
||||
[[nodiscard]] bool IsMemoryPoolForceMappingEnabled() const;
|
||||
[[nodiscard]] bool IsFlushVoiceWaveBuffersSupported() const;
|
||||
[[nodiscard]] bool IsVoicePlayedSampleCountResetAtLoopPointSupported() const;
|
||||
[[nodiscard]] bool IsVoicePitchAndSrcSkippedSupported() const;
|
||||
[[nodiscard]] bool IsMixInParameterDirtyOnlyUpdateSupported() const;
|
||||
[[nodiscard]] bool IsSplitterBugFixed() const;
|
||||
void CopyErrorInfo(OutParams& dst);
|
||||
|
||||
private:
|
||||
u32_le process_revision{};
|
||||
u32_le user_revision{};
|
||||
u64_le flags{};
|
||||
std::array<ErrorInfo, 10> errors{};
|
||||
std::size_t error_count{};
|
||||
};
|
||||
|
||||
} // namespace AudioCore
|
||||
|
||||
@@ -18,7 +18,7 @@ class Buffer {
|
||||
public:
|
||||
using Tag = u64;
|
||||
|
||||
Buffer(Tag tag, std::vector<s16>&& samples) : tag{tag}, samples{std::move(samples)} {}
|
||||
Buffer(Tag tag_, std::vector<s16>&& samples_) : tag{tag_}, samples{std::move(samples_)} {}
|
||||
|
||||
/// Returns the raw audio data for the buffer
|
||||
std::vector<s16>& GetSamples() {
|
||||
|
||||
@@ -16,8 +16,9 @@ std::vector<s16> DecodeADPCM(const u8* const data, std::size_t size, const ADPCM
|
||||
|
||||
constexpr std::size_t FRAME_LEN = 8;
|
||||
constexpr std::size_t SAMPLES_PER_FRAME = 14;
|
||||
constexpr std::array<int, 16> SIGNED_NIBBLES = {
|
||||
{0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}};
|
||||
static constexpr std::array<int, 16> SIGNED_NIBBLES{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1,
|
||||
};
|
||||
|
||||
const std::size_t sample_count = (size / FRAME_LEN) * SAMPLES_PER_FRAME;
|
||||
const std::size_t ret_size =
|
||||
|
||||
@@ -38,7 +38,7 @@ using ADPCM_Coeff = std::array<s16, 16>;
|
||||
* @param state ADPCM state, this is updated with new state
|
||||
* @return Decoded stereo signed PCM16 data, sample_count in length
|
||||
*/
|
||||
std::vector<s16> DecodeADPCM(const u8* const data, std::size_t size, const ADPCM_Coeff& coeff,
|
||||
std::vector<s16> DecodeADPCM(const u8* data, std::size_t size, const ADPCM_Coeff& coeff,
|
||||
ADPCMState& state);
|
||||
|
||||
}; // namespace AudioCore::Codec
|
||||
|
||||
982
src/audio_core/command_generator.cpp
Normal file
@@ -0,0 +1,982 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "audio_core/algorithm/interpolate.h"
|
||||
#include "audio_core/command_generator.h"
|
||||
#include "audio_core/effect_context.h"
|
||||
#include "audio_core/mix_context.h"
|
||||
#include "audio_core/voice_context.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace AudioCore {
|
||||
namespace {
|
||||
constexpr std::size_t MIX_BUFFER_SIZE = 0x3f00;
|
||||
constexpr std::size_t SCALED_MIX_BUFFER_SIZE = MIX_BUFFER_SIZE << 15ULL;
|
||||
|
||||
template <std::size_t N>
|
||||
void ApplyMix(s32* output, const s32* input, s32 gain, s32 sample_count) {
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(sample_count); i += N) {
|
||||
for (std::size_t j = 0; j < N; j++) {
|
||||
output[i + j] +=
|
||||
static_cast<s32>((static_cast<s64>(input[i + j]) * gain + 0x4000) >> 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 ApplyMixRamp(s32* output, const s32* input, float gain, float delta, s32 sample_count) {
|
||||
s32 x = 0;
|
||||
for (s32 i = 0; i < sample_count; i++) {
|
||||
x = static_cast<s32>(static_cast<float>(input[i]) * gain);
|
||||
output[i] += x;
|
||||
gain += delta;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
void ApplyGain(s32* output, const s32* input, s32 gain, s32 delta, s32 sample_count) {
|
||||
for (s32 i = 0; i < sample_count; i++) {
|
||||
output[i] = static_cast<s32>((static_cast<s64>(input[i]) * gain + 0x4000) >> 15);
|
||||
gain += delta;
|
||||
}
|
||||
}
|
||||
|
||||
void ApplyGainWithoutDelta(s32* output, const s32* input, s32 gain, s32 sample_count) {
|
||||
for (s32 i = 0; i < sample_count; i++) {
|
||||
output[i] = static_cast<s32>((static_cast<s64>(input[i]) * gain + 0x4000) >> 15);
|
||||
}
|
||||
}
|
||||
|
||||
s32 ApplyMixDepop(s32* output, s32 first_sample, s32 delta, s32 sample_count) {
|
||||
const bool positive = first_sample > 0;
|
||||
auto final_sample = std::abs(first_sample);
|
||||
for (s32 i = 0; i < sample_count; i++) {
|
||||
final_sample = static_cast<s32>((static_cast<s64>(final_sample) * delta) >> 15);
|
||||
if (positive) {
|
||||
output[i] += final_sample;
|
||||
} else {
|
||||
output[i] -= final_sample;
|
||||
}
|
||||
}
|
||||
if (positive) {
|
||||
return final_sample;
|
||||
} else {
|
||||
return -final_sample;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CommandGenerator::CommandGenerator(AudioCommon::AudioRendererParameter& worker_params_,
|
||||
VoiceContext& voice_context_, MixContext& mix_context_,
|
||||
SplitterContext& splitter_context_,
|
||||
EffectContext& effect_context_, Core::Memory::Memory& memory_)
|
||||
: worker_params(worker_params_), voice_context(voice_context_), mix_context(mix_context_),
|
||||
splitter_context(splitter_context_), effect_context(effect_context_), memory(memory_),
|
||||
mix_buffer((worker_params.mix_buffer_count + AudioCommon::MAX_CHANNEL_COUNT) *
|
||||
worker_params.sample_count),
|
||||
sample_buffer(MIX_BUFFER_SIZE),
|
||||
depop_buffer((worker_params.mix_buffer_count + AudioCommon::MAX_CHANNEL_COUNT) *
|
||||
worker_params.sample_count) {}
|
||||
CommandGenerator::~CommandGenerator() = default;
|
||||
|
||||
void CommandGenerator::ClearMixBuffers() {
|
||||
std::fill(mix_buffer.begin(), mix_buffer.end(), 0);
|
||||
std::fill(sample_buffer.begin(), sample_buffer.end(), 0);
|
||||
// std::fill(depop_buffer.begin(), depop_buffer.end(), 0);
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateVoiceCommands() {
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio, "(DSP_TRACE) GenerateVoiceCommands");
|
||||
}
|
||||
// Grab all our voices
|
||||
const auto voice_count = voice_context.GetVoiceCount();
|
||||
for (std::size_t i = 0; i < voice_count; i++) {
|
||||
auto& voice_info = voice_context.GetSortedInfo(i);
|
||||
// Update voices and check if we should queue them
|
||||
if (voice_info.ShouldSkip() || !voice_info.UpdateForCommandGeneration(voice_context)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Queue our voice
|
||||
GenerateVoiceCommand(voice_info);
|
||||
}
|
||||
// Update our splitters
|
||||
splitter_context.UpdateInternalState();
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateVoiceCommand(ServerVoiceInfo& voice_info) {
|
||||
auto& in_params = voice_info.GetInParams();
|
||||
const auto channel_count = in_params.channel_count;
|
||||
|
||||
for (s32 channel = 0; channel < channel_count; channel++) {
|
||||
const auto resource_id = in_params.voice_channel_resource_id[channel];
|
||||
auto& dsp_state = voice_context.GetDspSharedState(resource_id);
|
||||
auto& channel_resource = voice_context.GetChannelResource(resource_id);
|
||||
|
||||
// Decode our samples for our channel
|
||||
GenerateDataSourceCommand(voice_info, dsp_state, channel);
|
||||
|
||||
if (in_params.should_depop) {
|
||||
in_params.last_volume = 0.0f;
|
||||
} else if (in_params.splitter_info_id != AudioCommon::NO_SPLITTER ||
|
||||
in_params.mix_id != AudioCommon::NO_MIX) {
|
||||
// Apply a biquad filter if needed
|
||||
GenerateBiquadFilterCommandForVoice(voice_info, dsp_state,
|
||||
worker_params.mix_buffer_count, channel);
|
||||
// Base voice volume ramping
|
||||
GenerateVolumeRampCommand(in_params.last_volume, in_params.volume, channel,
|
||||
in_params.node_id);
|
||||
in_params.last_volume = in_params.volume;
|
||||
|
||||
if (in_params.mix_id != AudioCommon::NO_MIX) {
|
||||
// If we're using a mix id
|
||||
auto& mix_info = mix_context.GetInfo(in_params.mix_id);
|
||||
const auto& dest_mix_params = mix_info.GetInParams();
|
||||
|
||||
// Voice Mixing
|
||||
GenerateVoiceMixCommand(
|
||||
channel_resource.GetCurrentMixVolume(), channel_resource.GetLastMixVolume(),
|
||||
dsp_state, dest_mix_params.buffer_offset, dest_mix_params.buffer_count,
|
||||
worker_params.mix_buffer_count + channel, in_params.node_id);
|
||||
|
||||
// Update last mix volumes
|
||||
channel_resource.UpdateLastMixVolumes();
|
||||
} else if (in_params.splitter_info_id != AudioCommon::NO_SPLITTER) {
|
||||
s32 base = channel;
|
||||
while (auto* destination_data =
|
||||
GetDestinationData(in_params.splitter_info_id, base)) {
|
||||
base += channel_count;
|
||||
|
||||
if (!destination_data->IsConfigured()) {
|
||||
continue;
|
||||
}
|
||||
if (destination_data->GetMixId() >= static_cast<int>(mix_context.GetCount())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& mix_info = mix_context.GetInfo(destination_data->GetMixId());
|
||||
const auto& dest_mix_params = mix_info.GetInParams();
|
||||
GenerateVoiceMixCommand(
|
||||
destination_data->CurrentMixVolumes(), destination_data->LastMixVolumes(),
|
||||
dsp_state, dest_mix_params.buffer_offset, dest_mix_params.buffer_count,
|
||||
worker_params.mix_buffer_count + channel, in_params.node_id);
|
||||
destination_data->MarkDirty();
|
||||
}
|
||||
}
|
||||
// Update biquad filter enabled states
|
||||
for (std::size_t i = 0; i < AudioCommon::MAX_BIQUAD_FILTERS; i++) {
|
||||
in_params.was_biquad_filter_enabled[i] = in_params.biquad_filter[i].enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateSubMixCommands() {
|
||||
const auto mix_count = mix_context.GetCount();
|
||||
for (std::size_t i = 0; i < mix_count; i++) {
|
||||
auto& mix_info = mix_context.GetSortedInfo(i);
|
||||
const auto& in_params = mix_info.GetInParams();
|
||||
if (!in_params.in_use || in_params.mix_id == AudioCommon::FINAL_MIX) {
|
||||
continue;
|
||||
}
|
||||
GenerateSubMixCommand(mix_info);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateFinalMixCommands() {
|
||||
GenerateFinalMixCommand();
|
||||
}
|
||||
|
||||
void CommandGenerator::PreCommand() {
|
||||
if (!dumping_frame) {
|
||||
return;
|
||||
}
|
||||
for (std::size_t i = 0; i < splitter_context.GetInfoCount(); i++) {
|
||||
const auto& base = splitter_context.GetInfo(i);
|
||||
std::string graph = fmt::format("b[{}]", i);
|
||||
const auto* head = base.GetHead();
|
||||
while (head != nullptr) {
|
||||
graph += fmt::format("->{}", head->GetMixId());
|
||||
head = head->GetNextDestination();
|
||||
}
|
||||
LOG_DEBUG(Audio, "(DSP_TRACE) SplitterGraph splitter_info={}, {}", i, graph);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::PostCommand() {
|
||||
if (!dumping_frame) {
|
||||
return;
|
||||
}
|
||||
dumping_frame = false;
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateDataSourceCommand(ServerVoiceInfo& voice_info, VoiceState& dsp_state,
|
||||
s32 channel) {
|
||||
const auto& in_params = voice_info.GetInParams();
|
||||
const auto depop = in_params.should_depop;
|
||||
|
||||
if (depop) {
|
||||
if (in_params.mix_id != AudioCommon::NO_MIX) {
|
||||
auto& mix_info = mix_context.GetInfo(in_params.mix_id);
|
||||
const auto& mix_in = mix_info.GetInParams();
|
||||
GenerateDepopPrepareCommand(dsp_state, mix_in.buffer_count, mix_in.buffer_offset);
|
||||
} else if (in_params.splitter_info_id != AudioCommon::NO_SPLITTER) {
|
||||
s32 index{};
|
||||
while (const auto* destination =
|
||||
GetDestinationData(in_params.splitter_info_id, index++)) {
|
||||
if (!destination->IsConfigured()) {
|
||||
continue;
|
||||
}
|
||||
auto& mix_info = mix_context.GetInfo(destination->GetMixId());
|
||||
const auto& mix_in = mix_info.GetInParams();
|
||||
GenerateDepopPrepareCommand(dsp_state, mix_in.buffer_count, mix_in.buffer_offset);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (in_params.sample_format) {
|
||||
case SampleFormat::Pcm16:
|
||||
DecodeFromWaveBuffers(voice_info, GetChannelMixBuffer(channel), dsp_state, channel,
|
||||
worker_params.sample_rate, worker_params.sample_count,
|
||||
in_params.node_id);
|
||||
break;
|
||||
case SampleFormat::Adpcm:
|
||||
ASSERT(channel == 0 && in_params.channel_count == 1);
|
||||
DecodeFromWaveBuffers(voice_info, GetChannelMixBuffer(0), dsp_state, 0,
|
||||
worker_params.sample_rate, worker_params.sample_count,
|
||||
in_params.node_id);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unimplemented sample format={}", in_params.sample_format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateBiquadFilterCommandForVoice(ServerVoiceInfo& voice_info,
|
||||
VoiceState& dsp_state,
|
||||
[[maybe_unused]] s32 mix_buffer_count,
|
||||
[[maybe_unused]] s32 channel) {
|
||||
for (std::size_t i = 0; i < AudioCommon::MAX_BIQUAD_FILTERS; i++) {
|
||||
const auto& in_params = voice_info.GetInParams();
|
||||
auto& biquad_filter = in_params.biquad_filter[i];
|
||||
// Check if biquad filter is actually used
|
||||
if (!biquad_filter.enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reinitialize our biquad filter state if it was enabled previously
|
||||
if (!in_params.was_biquad_filter_enabled[i]) {
|
||||
dsp_state.biquad_filter_state.fill(0);
|
||||
}
|
||||
|
||||
// Generate biquad filter
|
||||
// GenerateBiquadFilterCommand(mix_buffer_count, biquad_filter,
|
||||
// dsp_state.biquad_filter_state,
|
||||
// mix_buffer_count + channel, mix_buffer_count +
|
||||
// channel, worker_params.sample_count,
|
||||
// voice_info.GetInParams().node_id);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateBiquadFilterCommand([[maybe_unused]] s32 mix_buffer_id,
|
||||
const BiquadFilterParameter& params,
|
||||
std::array<s64, 2>& state,
|
||||
std::size_t input_offset,
|
||||
std::size_t output_offset, s32 sample_count,
|
||||
s32 node_id) {
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio,
|
||||
"(DSP_TRACE) GenerateBiquadFilterCommand node_id={}, "
|
||||
"input_mix_buffer={}, output_mix_buffer={}",
|
||||
node_id, input_offset, output_offset);
|
||||
}
|
||||
const auto* input = GetMixBuffer(input_offset);
|
||||
auto* output = GetMixBuffer(output_offset);
|
||||
|
||||
// Biquad filter parameters
|
||||
const auto [n0, n1, n2] = params.numerator;
|
||||
const auto [d0, d1] = params.denominator;
|
||||
|
||||
// Biquad filter states
|
||||
auto [s0, s1] = state;
|
||||
|
||||
constexpr s64 int32_min = std::numeric_limits<s32>::min();
|
||||
constexpr s64 int32_max = std::numeric_limits<s32>::max();
|
||||
|
||||
for (int i = 0; i < sample_count; ++i) {
|
||||
const auto sample = static_cast<s64>(input[i]);
|
||||
const auto f = (sample * n0 + s0 + 0x4000) >> 15;
|
||||
const auto y = std::clamp(f, int32_min, int32_max);
|
||||
s0 = sample * n1 + y * d0 + s1;
|
||||
s1 = sample * n2 + y * d1;
|
||||
output[i] = static_cast<s32>(y);
|
||||
}
|
||||
|
||||
state = {s0, s1};
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateDepopPrepareCommand(VoiceState& dsp_state,
|
||||
std::size_t mix_buffer_count,
|
||||
std::size_t mix_buffer_offset) {
|
||||
for (std::size_t i = 0; i < mix_buffer_count; i++) {
|
||||
auto& sample = dsp_state.previous_samples[i];
|
||||
if (sample != 0) {
|
||||
depop_buffer[mix_buffer_offset + i] += sample;
|
||||
sample = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateDepopForMixBuffersCommand(std::size_t mix_buffer_count,
|
||||
std::size_t mix_buffer_offset,
|
||||
s32 sample_rate) {
|
||||
const std::size_t end_offset =
|
||||
std::min(mix_buffer_offset + mix_buffer_count, GetTotalMixBufferCount());
|
||||
const s32 delta = sample_rate == 48000 ? 0x7B29 : 0x78CB;
|
||||
for (std::size_t i = mix_buffer_offset; i < end_offset; i++) {
|
||||
if (depop_buffer[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
depop_buffer[i] =
|
||||
ApplyMixDepop(GetMixBuffer(i), depop_buffer[i], delta, worker_params.sample_count);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateEffectCommand(ServerMixInfo& mix_info) {
|
||||
const std::size_t effect_count = effect_context.GetCount();
|
||||
const auto buffer_offset = mix_info.GetInParams().buffer_offset;
|
||||
for (std::size_t i = 0; i < effect_count; i++) {
|
||||
const auto index = mix_info.GetEffectOrder(i);
|
||||
if (index == AudioCommon::NO_EFFECT_ORDER) {
|
||||
break;
|
||||
}
|
||||
auto* info = effect_context.GetInfo(index);
|
||||
const auto type = info->GetType();
|
||||
|
||||
// TODO(ogniK): Finish remaining effects
|
||||
switch (type) {
|
||||
case EffectType::Aux:
|
||||
GenerateAuxCommand(buffer_offset, info, info->IsEnabled());
|
||||
break;
|
||||
case EffectType::I3dl2Reverb:
|
||||
GenerateI3dl2ReverbEffectCommand(buffer_offset, info, info->IsEnabled());
|
||||
break;
|
||||
case EffectType::BiquadFilter:
|
||||
GenerateBiquadFilterEffectCommand(buffer_offset, info, info->IsEnabled());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
info->UpdateForCommandGeneration();
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateI3dl2ReverbEffectCommand(s32 mix_buffer_offset, EffectBase* info,
|
||||
bool enabled) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
const auto& params = dynamic_cast<EffectI3dl2Reverb*>(info)->GetParams();
|
||||
const auto channel_count = params.channel_count;
|
||||
for (s32 i = 0; i < channel_count; i++) {
|
||||
// TODO(ogniK): Actually implement reverb
|
||||
if (params.input[i] != params.output[i]) {
|
||||
const auto* input = GetMixBuffer(mix_buffer_offset + params.input[i]);
|
||||
auto* output = GetMixBuffer(mix_buffer_offset + params.output[i]);
|
||||
ApplyMix<1>(output, input, 32768, worker_params.sample_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateBiquadFilterEffectCommand(s32 mix_buffer_offset, EffectBase* info,
|
||||
bool enabled) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
const auto& params = dynamic_cast<EffectBiquadFilter*>(info)->GetParams();
|
||||
const auto channel_count = params.channel_count;
|
||||
for (s32 i = 0; i < channel_count; i++) {
|
||||
// TODO(ogniK): Actually implement biquad filter
|
||||
if (params.input[i] != params.output[i]) {
|
||||
const auto* input = GetMixBuffer(mix_buffer_offset + params.input[i]);
|
||||
auto* output = GetMixBuffer(mix_buffer_offset + params.output[i]);
|
||||
ApplyMix<1>(output, input, 32768, worker_params.sample_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateAuxCommand(s32 mix_buffer_offset, EffectBase* info, bool enabled) {
|
||||
auto* aux = dynamic_cast<EffectAuxInfo*>(info);
|
||||
const auto& params = aux->GetParams();
|
||||
if (aux->GetSendBuffer() != 0 && aux->GetRecvBuffer() != 0) {
|
||||
const auto max_channels = params.count;
|
||||
u32 offset{};
|
||||
for (u32 channel = 0; channel < max_channels; channel++) {
|
||||
u32 write_count = 0;
|
||||
if (channel == (max_channels - 1)) {
|
||||
write_count = offset + worker_params.sample_count;
|
||||
}
|
||||
|
||||
const auto input_index = params.input_mix_buffers[channel] + mix_buffer_offset;
|
||||
const auto output_index = params.output_mix_buffers[channel] + mix_buffer_offset;
|
||||
|
||||
if (enabled) {
|
||||
AuxInfoDSP send_info{};
|
||||
AuxInfoDSP recv_info{};
|
||||
memory.ReadBlock(aux->GetSendInfo(), &send_info, sizeof(AuxInfoDSP));
|
||||
memory.ReadBlock(aux->GetRecvInfo(), &recv_info, sizeof(AuxInfoDSP));
|
||||
|
||||
WriteAuxBuffer(send_info, aux->GetSendBuffer(), params.sample_count,
|
||||
GetMixBuffer(input_index), worker_params.sample_count, offset,
|
||||
write_count);
|
||||
memory.WriteBlock(aux->GetSendInfo(), &send_info, sizeof(AuxInfoDSP));
|
||||
|
||||
const auto samples_read = ReadAuxBuffer(
|
||||
recv_info, aux->GetRecvBuffer(), params.sample_count,
|
||||
GetMixBuffer(output_index), worker_params.sample_count, offset, write_count);
|
||||
memory.WriteBlock(aux->GetRecvInfo(), &recv_info, sizeof(AuxInfoDSP));
|
||||
|
||||
if (samples_read != static_cast<int>(worker_params.sample_count) &&
|
||||
samples_read <= params.sample_count) {
|
||||
std::memset(GetMixBuffer(output_index), 0, params.sample_count - samples_read);
|
||||
}
|
||||
} else {
|
||||
AuxInfoDSP empty{};
|
||||
memory.WriteBlock(aux->GetSendInfo(), &empty, sizeof(AuxInfoDSP));
|
||||
memory.WriteBlock(aux->GetRecvInfo(), &empty, sizeof(AuxInfoDSP));
|
||||
if (output_index != input_index) {
|
||||
std::memcpy(GetMixBuffer(output_index), GetMixBuffer(input_index),
|
||||
worker_params.sample_count * sizeof(s32));
|
||||
}
|
||||
}
|
||||
|
||||
offset += worker_params.sample_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ServerSplitterDestinationData* CommandGenerator::GetDestinationData(s32 splitter_id, s32 index) {
|
||||
if (splitter_id == AudioCommon::NO_SPLITTER) {
|
||||
return nullptr;
|
||||
}
|
||||
return splitter_context.GetDestinationData(splitter_id, index);
|
||||
}
|
||||
|
||||
s32 CommandGenerator::WriteAuxBuffer(AuxInfoDSP& dsp_info, VAddr send_buffer, u32 max_samples,
|
||||
const s32* data, u32 sample_count, u32 write_offset,
|
||||
u32 write_count) {
|
||||
if (max_samples == 0) {
|
||||
return 0;
|
||||
}
|
||||
u32 offset = dsp_info.write_offset + write_offset;
|
||||
if (send_buffer == 0 || offset > max_samples) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::size_t data_offset{};
|
||||
u32 remaining = sample_count;
|
||||
while (remaining > 0) {
|
||||
// Get position in buffer
|
||||
const auto base = send_buffer + (offset * sizeof(u32));
|
||||
const auto samples_to_grab = std::min(max_samples - offset, remaining);
|
||||
// Write to output
|
||||
memory.WriteBlock(base, (data + data_offset), samples_to_grab * sizeof(u32));
|
||||
offset = (offset + samples_to_grab) % max_samples;
|
||||
remaining -= samples_to_grab;
|
||||
data_offset += samples_to_grab;
|
||||
}
|
||||
|
||||
if (write_count != 0) {
|
||||
dsp_info.write_offset = (dsp_info.write_offset + write_count) % max_samples;
|
||||
}
|
||||
return sample_count;
|
||||
}
|
||||
|
||||
s32 CommandGenerator::ReadAuxBuffer(AuxInfoDSP& recv_info, VAddr recv_buffer, u32 max_samples,
|
||||
s32* out_data, u32 sample_count, u32 read_offset,
|
||||
u32 read_count) {
|
||||
if (max_samples == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 offset = recv_info.read_offset + read_offset;
|
||||
if (recv_buffer == 0 || offset > max_samples) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 remaining = sample_count;
|
||||
while (remaining > 0) {
|
||||
const auto base = recv_buffer + (offset * sizeof(u32));
|
||||
const auto samples_to_grab = std::min(max_samples - offset, remaining);
|
||||
std::vector<s32> buffer(samples_to_grab);
|
||||
memory.ReadBlock(base, buffer.data(), buffer.size() * sizeof(u32));
|
||||
std::memcpy(out_data, buffer.data(), buffer.size() * sizeof(u32));
|
||||
out_data += samples_to_grab;
|
||||
offset = (offset + samples_to_grab) % max_samples;
|
||||
remaining -= samples_to_grab;
|
||||
}
|
||||
|
||||
if (read_count != 0) {
|
||||
recv_info.read_offset = (recv_info.read_offset + read_count) % max_samples;
|
||||
}
|
||||
return sample_count;
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateVolumeRampCommand(float last_volume, float current_volume,
|
||||
s32 channel, s32 node_id) {
|
||||
const auto last = static_cast<s32>(last_volume * 32768.0f);
|
||||
const auto current = static_cast<s32>(current_volume * 32768.0f);
|
||||
const auto delta = static_cast<s32>((static_cast<float>(current) - static_cast<float>(last)) /
|
||||
static_cast<float>(worker_params.sample_count));
|
||||
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio,
|
||||
"(DSP_TRACE) GenerateVolumeRampCommand node_id={}, input={}, output={}, "
|
||||
"last_volume={}, current_volume={}",
|
||||
node_id, GetMixChannelBufferOffset(channel), GetMixChannelBufferOffset(channel),
|
||||
last_volume, current_volume);
|
||||
}
|
||||
// Apply generic gain on samples
|
||||
ApplyGain(GetChannelMixBuffer(channel), GetChannelMixBuffer(channel), last, delta,
|
||||
worker_params.sample_count);
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateVoiceMixCommand(const MixVolumeBuffer& mix_volumes,
|
||||
const MixVolumeBuffer& last_mix_volumes,
|
||||
VoiceState& dsp_state, s32 mix_buffer_offset,
|
||||
s32 mix_buffer_count, s32 voice_index, s32 node_id) {
|
||||
// Loop all our mix buffers
|
||||
for (s32 i = 0; i < mix_buffer_count; i++) {
|
||||
if (last_mix_volumes[i] != 0.0f || mix_volumes[i] != 0.0f) {
|
||||
const auto delta = static_cast<float>((mix_volumes[i] - last_mix_volumes[i])) /
|
||||
static_cast<float>(worker_params.sample_count);
|
||||
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio,
|
||||
"(DSP_TRACE) GenerateVoiceMixCommand node_id={}, input={}, "
|
||||
"output={}, last_volume={}, current_volume={}",
|
||||
node_id, voice_index, mix_buffer_offset + i, last_mix_volumes[i],
|
||||
mix_volumes[i]);
|
||||
}
|
||||
|
||||
dsp_state.previous_samples[i] =
|
||||
ApplyMixRamp(GetMixBuffer(mix_buffer_offset + i), GetMixBuffer(voice_index),
|
||||
last_mix_volumes[i], delta, worker_params.sample_count);
|
||||
} else {
|
||||
dsp_state.previous_samples[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateSubMixCommand(ServerMixInfo& mix_info) {
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio, "(DSP_TRACE) GenerateSubMixCommand");
|
||||
}
|
||||
const auto& in_params = mix_info.GetInParams();
|
||||
GenerateDepopForMixBuffersCommand(in_params.buffer_count, in_params.buffer_offset,
|
||||
in_params.sample_rate);
|
||||
|
||||
GenerateEffectCommand(mix_info);
|
||||
|
||||
GenerateMixCommands(mix_info);
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateMixCommands(ServerMixInfo& mix_info) {
|
||||
if (!mix_info.HasAnyConnection()) {
|
||||
return;
|
||||
}
|
||||
const auto& in_params = mix_info.GetInParams();
|
||||
if (in_params.dest_mix_id != AudioCommon::NO_MIX) {
|
||||
const auto& dest_mix = mix_context.GetInfo(in_params.dest_mix_id);
|
||||
const auto& dest_in_params = dest_mix.GetInParams();
|
||||
|
||||
const auto buffer_count = in_params.buffer_count;
|
||||
|
||||
for (s32 i = 0; i < buffer_count; i++) {
|
||||
for (s32 j = 0; j < dest_in_params.buffer_count; j++) {
|
||||
const auto mixed_volume = in_params.volume * in_params.mix_volume[i][j];
|
||||
if (mixed_volume != 0.0f) {
|
||||
GenerateMixCommand(dest_in_params.buffer_offset + j,
|
||||
in_params.buffer_offset + i, mixed_volume,
|
||||
in_params.node_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (in_params.splitter_id != AudioCommon::NO_SPLITTER) {
|
||||
s32 base{};
|
||||
while (const auto* destination_data = GetDestinationData(in_params.splitter_id, base++)) {
|
||||
if (!destination_data->IsConfigured()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& dest_mix = mix_context.GetInfo(destination_data->GetMixId());
|
||||
const auto& dest_in_params = dest_mix.GetInParams();
|
||||
const auto mix_index = (base - 1) % in_params.buffer_count + in_params.buffer_offset;
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(dest_in_params.buffer_count);
|
||||
i++) {
|
||||
const auto mixed_volume = in_params.volume * destination_data->GetMixVolume(i);
|
||||
if (mixed_volume != 0.0f) {
|
||||
GenerateMixCommand(dest_in_params.buffer_offset + i, mix_index, mixed_volume,
|
||||
in_params.node_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateMixCommand(std::size_t output_offset, std::size_t input_offset,
|
||||
float volume, s32 node_id) {
|
||||
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio,
|
||||
"(DSP_TRACE) GenerateMixCommand node_id={}, input={}, output={}, volume={}",
|
||||
node_id, input_offset, output_offset, volume);
|
||||
}
|
||||
|
||||
auto* output = GetMixBuffer(output_offset);
|
||||
const auto* input = GetMixBuffer(input_offset);
|
||||
|
||||
const s32 gain = static_cast<s32>(volume * 32768.0f);
|
||||
// Mix with loop unrolling
|
||||
if (worker_params.sample_count % 4 == 0) {
|
||||
ApplyMix<4>(output, input, gain, worker_params.sample_count);
|
||||
} else if (worker_params.sample_count % 2 == 0) {
|
||||
ApplyMix<2>(output, input, gain, worker_params.sample_count);
|
||||
} else {
|
||||
ApplyMix<1>(output, input, gain, worker_params.sample_count);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandGenerator::GenerateFinalMixCommand() {
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio, "(DSP_TRACE) GenerateFinalMixCommand");
|
||||
}
|
||||
auto& mix_info = mix_context.GetFinalMixInfo();
|
||||
const auto& in_params = mix_info.GetInParams();
|
||||
|
||||
GenerateDepopForMixBuffersCommand(in_params.buffer_count, in_params.buffer_offset,
|
||||
in_params.sample_rate);
|
||||
|
||||
GenerateEffectCommand(mix_info);
|
||||
|
||||
for (s32 i = 0; i < in_params.buffer_count; i++) {
|
||||
const s32 gain = static_cast<s32>(in_params.volume * 32768.0f);
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(
|
||||
Audio,
|
||||
"(DSP_TRACE) ApplyGainWithoutDelta node_id={}, input={}, output={}, volume={}",
|
||||
in_params.node_id, in_params.buffer_offset + i, in_params.buffer_offset + i,
|
||||
in_params.volume);
|
||||
}
|
||||
ApplyGainWithoutDelta(GetMixBuffer(in_params.buffer_offset + i),
|
||||
GetMixBuffer(in_params.buffer_offset + i), gain,
|
||||
worker_params.sample_count);
|
||||
}
|
||||
}
|
||||
|
||||
s32 CommandGenerator::DecodePcm16(ServerVoiceInfo& voice_info, VoiceState& dsp_state,
|
||||
s32 sample_count, s32 channel, std::size_t mix_offset) {
|
||||
const auto& in_params = voice_info.GetInParams();
|
||||
const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index];
|
||||
if (wave_buffer.buffer_address == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (wave_buffer.buffer_size == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (wave_buffer.end_sample_offset < wave_buffer.start_sample_offset) {
|
||||
return 0;
|
||||
}
|
||||
const auto samples_remaining =
|
||||
(wave_buffer.end_sample_offset - wave_buffer.start_sample_offset) - dsp_state.offset;
|
||||
const auto start_offset =
|
||||
((wave_buffer.start_sample_offset + dsp_state.offset) * in_params.channel_count) *
|
||||
sizeof(s16);
|
||||
const auto buffer_pos = wave_buffer.buffer_address + start_offset;
|
||||
const auto samples_processed = std::min(sample_count, samples_remaining);
|
||||
|
||||
if (in_params.channel_count == 1) {
|
||||
std::vector<s16> buffer(samples_processed);
|
||||
memory.ReadBlock(buffer_pos, buffer.data(), buffer.size() * sizeof(s16));
|
||||
for (std::size_t i = 0; i < buffer.size(); i++) {
|
||||
sample_buffer[mix_offset + i] = buffer[i];
|
||||
}
|
||||
} else {
|
||||
const auto channel_count = in_params.channel_count;
|
||||
std::vector<s16> buffer(samples_processed * channel_count);
|
||||
memory.ReadBlock(buffer_pos, buffer.data(), buffer.size() * sizeof(s16));
|
||||
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(samples_processed); i++) {
|
||||
sample_buffer[mix_offset + i] = buffer[i * channel_count + channel];
|
||||
}
|
||||
}
|
||||
|
||||
return samples_processed;
|
||||
}
|
||||
|
||||
s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_state,
|
||||
s32 sample_count, [[maybe_unused]] s32 channel,
|
||||
std::size_t mix_offset) {
|
||||
const auto& in_params = voice_info.GetInParams();
|
||||
const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index];
|
||||
if (wave_buffer.buffer_address == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (wave_buffer.buffer_size == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (wave_buffer.end_sample_offset < wave_buffer.start_sample_offset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static constexpr std::array<int, 16> SIGNED_NIBBLES{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1,
|
||||
};
|
||||
|
||||
constexpr std::size_t FRAME_LEN = 8;
|
||||
constexpr std::size_t NIBBLES_PER_SAMPLE = 16;
|
||||
constexpr std::size_t SAMPLES_PER_FRAME = 14;
|
||||
|
||||
auto frame_header = dsp_state.context.header;
|
||||
s32 idx = (frame_header >> 4) & 0xf;
|
||||
s32 scale = frame_header & 0xf;
|
||||
s16 yn1 = dsp_state.context.yn1;
|
||||
s16 yn2 = dsp_state.context.yn2;
|
||||
|
||||
Codec::ADPCM_Coeff coeffs;
|
||||
memory.ReadBlock(in_params.additional_params_address, coeffs.data(),
|
||||
sizeof(Codec::ADPCM_Coeff));
|
||||
|
||||
s32 coef1 = coeffs[idx * 2];
|
||||
s32 coef2 = coeffs[idx * 2 + 1];
|
||||
|
||||
const auto samples_remaining =
|
||||
(wave_buffer.end_sample_offset - wave_buffer.start_sample_offset) - dsp_state.offset;
|
||||
const auto samples_processed = std::min(sample_count, samples_remaining);
|
||||
const auto sample_pos = wave_buffer.start_sample_offset + dsp_state.offset;
|
||||
|
||||
const auto samples_remaining_in_frame = sample_pos % SAMPLES_PER_FRAME;
|
||||
auto position_in_frame = ((sample_pos / SAMPLES_PER_FRAME) * NIBBLES_PER_SAMPLE) +
|
||||
samples_remaining_in_frame + (samples_remaining_in_frame != 0 ? 2 : 0);
|
||||
|
||||
const auto decode_sample = [&](const int nibble) -> s16 {
|
||||
const int xn = nibble * (1 << scale);
|
||||
// We first transform everything into 11 bit fixed point, perform the second order
|
||||
// digital filter, then transform back.
|
||||
// 0x400 == 0.5 in 11 bit fixed point.
|
||||
// Filter: y[n] = x[n] + 0.5 + c1 * y[n-1] + c2 * y[n-2]
|
||||
int val = ((xn << 11) + 0x400 + coef1 * yn1 + coef2 * yn2) >> 11;
|
||||
// Clamp to output range.
|
||||
val = std::clamp<s32>(val, -32768, 32767);
|
||||
// Advance output feedback.
|
||||
yn2 = yn1;
|
||||
yn1 = static_cast<s16>(val);
|
||||
return yn1;
|
||||
};
|
||||
|
||||
std::size_t buffer_offset{};
|
||||
std::vector<u8> buffer(
|
||||
std::max((samples_processed / FRAME_LEN) * SAMPLES_PER_FRAME, FRAME_LEN));
|
||||
memory.ReadBlock(wave_buffer.buffer_address + (position_in_frame / 2), buffer.data(),
|
||||
buffer.size());
|
||||
std::size_t cur_mix_offset = mix_offset;
|
||||
|
||||
auto remaining_samples = samples_processed;
|
||||
while (remaining_samples > 0) {
|
||||
if (position_in_frame % NIBBLES_PER_SAMPLE == 0) {
|
||||
// Read header
|
||||
frame_header = buffer[buffer_offset++];
|
||||
idx = (frame_header >> 4) & 0xf;
|
||||
scale = frame_header & 0xf;
|
||||
coef1 = coeffs[idx * 2];
|
||||
coef2 = coeffs[idx * 2 + 1];
|
||||
position_in_frame += 2;
|
||||
|
||||
// Decode entire frame
|
||||
if (remaining_samples >= static_cast<int>(SAMPLES_PER_FRAME)) {
|
||||
for (std::size_t i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
|
||||
// Sample 1
|
||||
const s32 s0 = SIGNED_NIBBLES[buffer[buffer_offset] >> 4];
|
||||
const s32 s1 = SIGNED_NIBBLES[buffer[buffer_offset++] & 0xf];
|
||||
const s16 sample_1 = decode_sample(s0);
|
||||
const s16 sample_2 = decode_sample(s1);
|
||||
sample_buffer[cur_mix_offset++] = sample_1;
|
||||
sample_buffer[cur_mix_offset++] = sample_2;
|
||||
}
|
||||
remaining_samples -= static_cast<int>(SAMPLES_PER_FRAME);
|
||||
position_in_frame += SAMPLES_PER_FRAME;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Decode mid frame
|
||||
s32 current_nibble = buffer[buffer_offset];
|
||||
if (position_in_frame++ & 0x1) {
|
||||
current_nibble &= 0xf;
|
||||
buffer_offset++;
|
||||
} else {
|
||||
current_nibble >>= 4;
|
||||
}
|
||||
const s16 sample = decode_sample(SIGNED_NIBBLES[current_nibble]);
|
||||
sample_buffer[cur_mix_offset++] = sample;
|
||||
remaining_samples--;
|
||||
}
|
||||
|
||||
dsp_state.context.header = frame_header;
|
||||
dsp_state.context.yn1 = yn1;
|
||||
dsp_state.context.yn2 = yn2;
|
||||
|
||||
return samples_processed;
|
||||
}
|
||||
|
||||
s32* CommandGenerator::GetMixBuffer(std::size_t index) {
|
||||
return mix_buffer.data() + (index * worker_params.sample_count);
|
||||
}
|
||||
|
||||
const s32* CommandGenerator::GetMixBuffer(std::size_t index) const {
|
||||
return mix_buffer.data() + (index * worker_params.sample_count);
|
||||
}
|
||||
|
||||
std::size_t CommandGenerator::GetMixChannelBufferOffset(s32 channel) const {
|
||||
return worker_params.mix_buffer_count + channel;
|
||||
}
|
||||
|
||||
std::size_t CommandGenerator::GetTotalMixBufferCount() const {
|
||||
return worker_params.mix_buffer_count + AudioCommon::MAX_CHANNEL_COUNT;
|
||||
}
|
||||
|
||||
s32* CommandGenerator::GetChannelMixBuffer(s32 channel) {
|
||||
return GetMixBuffer(worker_params.mix_buffer_count + channel);
|
||||
}
|
||||
|
||||
const s32* CommandGenerator::GetChannelMixBuffer(s32 channel) const {
|
||||
return GetMixBuffer(worker_params.mix_buffer_count + channel);
|
||||
}
|
||||
|
||||
void CommandGenerator::DecodeFromWaveBuffers(ServerVoiceInfo& voice_info, s32* output,
|
||||
VoiceState& dsp_state, s32 channel,
|
||||
s32 target_sample_rate, s32 sample_count,
|
||||
s32 node_id) {
|
||||
const auto& in_params = voice_info.GetInParams();
|
||||
if (dumping_frame) {
|
||||
LOG_DEBUG(Audio,
|
||||
"(DSP_TRACE) DecodeFromWaveBuffers, node_id={}, channel={}, "
|
||||
"format={}, sample_count={}, sample_rate={}, mix_id={}, splitter_id={}",
|
||||
node_id, channel, in_params.sample_format, sample_count, in_params.sample_rate,
|
||||
in_params.mix_id, in_params.splitter_info_id);
|
||||
}
|
||||
ASSERT_OR_EXECUTE(output != nullptr, { return; });
|
||||
|
||||
const auto resample_rate = static_cast<s32>(
|
||||
static_cast<float>(in_params.sample_rate) / static_cast<float>(target_sample_rate) *
|
||||
static_cast<float>(static_cast<s32>(in_params.pitch * 32768.0f)));
|
||||
if (dsp_state.fraction + sample_count * resample_rate >
|
||||
static_cast<s32>(SCALED_MIX_BUFFER_SIZE - 4ULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto min_required_samples =
|
||||
std::min(static_cast<s32>(SCALED_MIX_BUFFER_SIZE) - dsp_state.fraction, resample_rate);
|
||||
if (min_required_samples >= sample_count) {
|
||||
min_required_samples = sample_count;
|
||||
}
|
||||
|
||||
std::size_t temp_mix_offset{};
|
||||
bool is_buffer_completed{false};
|
||||
auto samples_remaining = sample_count;
|
||||
while (samples_remaining > 0 && !is_buffer_completed) {
|
||||
const auto samples_to_output = std::min(samples_remaining, min_required_samples);
|
||||
const auto samples_to_read = (samples_to_output * resample_rate + dsp_state.fraction) >> 15;
|
||||
|
||||
if (!in_params.behavior_flags.is_pitch_and_src_skipped) {
|
||||
// Append sample histtory for resampler
|
||||
for (std::size_t i = 0; i < AudioCommon::MAX_SAMPLE_HISTORY; i++) {
|
||||
sample_buffer[temp_mix_offset + i] = dsp_state.sample_history[i];
|
||||
}
|
||||
temp_mix_offset += 4;
|
||||
}
|
||||
|
||||
s32 samples_read{};
|
||||
while (samples_read < samples_to_read) {
|
||||
const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index];
|
||||
// No more data can be read
|
||||
if (!dsp_state.is_wave_buffer_valid[dsp_state.wave_buffer_index]) {
|
||||
is_buffer_completed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (in_params.sample_format == SampleFormat::Adpcm && dsp_state.offset == 0 &&
|
||||
wave_buffer.context_address != 0 && wave_buffer.context_size != 0) {
|
||||
// TODO(ogniK): ADPCM loop context
|
||||
}
|
||||
|
||||
s32 samples_decoded{0};
|
||||
switch (in_params.sample_format) {
|
||||
case SampleFormat::Pcm16:
|
||||
samples_decoded = DecodePcm16(voice_info, dsp_state, samples_to_read - samples_read,
|
||||
channel, temp_mix_offset);
|
||||
break;
|
||||
case SampleFormat::Adpcm:
|
||||
samples_decoded = DecodeAdpcm(voice_info, dsp_state, samples_to_read - samples_read,
|
||||
channel, temp_mix_offset);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unimplemented sample format={}", in_params.sample_format);
|
||||
}
|
||||
|
||||
temp_mix_offset += samples_decoded;
|
||||
samples_read += samples_decoded;
|
||||
dsp_state.offset += samples_decoded;
|
||||
dsp_state.played_sample_count += samples_decoded;
|
||||
|
||||
if (dsp_state.offset >=
|
||||
(wave_buffer.end_sample_offset - wave_buffer.start_sample_offset) ||
|
||||
samples_decoded == 0) {
|
||||
// Reset our sample offset
|
||||
dsp_state.offset = 0;
|
||||
if (wave_buffer.is_looping) {
|
||||
if (samples_decoded == 0) {
|
||||
// End of our buffer
|
||||
is_buffer_completed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (in_params.behavior_flags.is_played_samples_reset_at_loop_point.Value()) {
|
||||
dsp_state.played_sample_count = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Update our wave buffer states
|
||||
dsp_state.is_wave_buffer_valid[dsp_state.wave_buffer_index] = false;
|
||||
dsp_state.wave_buffer_consumed++;
|
||||
dsp_state.wave_buffer_index =
|
||||
(dsp_state.wave_buffer_index + 1) % AudioCommon::MAX_WAVE_BUFFERS;
|
||||
if (wave_buffer.end_of_stream) {
|
||||
dsp_state.played_sample_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_params.behavior_flags.is_pitch_and_src_skipped.Value()) {
|
||||
// No need to resample
|
||||
std::memcpy(output, sample_buffer.data(), samples_read * sizeof(s32));
|
||||
} else {
|
||||
std::fill(sample_buffer.begin() + temp_mix_offset,
|
||||
sample_buffer.begin() + temp_mix_offset + (samples_to_read - samples_read),
|
||||
0);
|
||||
AudioCore::Resample(output, sample_buffer.data(), resample_rate, dsp_state.fraction,
|
||||
samples_to_output);
|
||||
// Resample
|
||||
for (std::size_t i = 0; i < AudioCommon::MAX_SAMPLE_HISTORY; i++) {
|
||||
dsp_state.sample_history[i] = sample_buffer[samples_to_read + i];
|
||||
}
|
||||
}
|
||||
output += samples_to_output;
|
||||
samples_remaining -= samples_to_output;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
102
src/audio_core/command_generator.h
Normal file
@@ -0,0 +1,102 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include "audio_core/common.h"
|
||||
#include "audio_core/voice_context.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Core::Memory {
|
||||
class Memory;
|
||||
}
|
||||
|
||||
namespace AudioCore {
|
||||
class MixContext;
|
||||
class SplitterContext;
|
||||
class ServerSplitterDestinationData;
|
||||
class ServerMixInfo;
|
||||
class EffectContext;
|
||||
class EffectBase;
|
||||
struct AuxInfoDSP;
|
||||
using MixVolumeBuffer = std::array<float, AudioCommon::MAX_MIX_BUFFERS>;
|
||||
|
||||
class CommandGenerator {
|
||||
public:
|
||||
explicit CommandGenerator(AudioCommon::AudioRendererParameter& worker_params_,
|
||||
VoiceContext& voice_context_, MixContext& mix_context_,
|
||||
SplitterContext& splitter_context_, EffectContext& effect_context_,
|
||||
Core::Memory::Memory& memory_);
|
||||
~CommandGenerator();
|
||||
|
||||
void ClearMixBuffers();
|
||||
void GenerateVoiceCommands();
|
||||
void GenerateVoiceCommand(ServerVoiceInfo& voice_info);
|
||||
void GenerateSubMixCommands();
|
||||
void GenerateFinalMixCommands();
|
||||
void PreCommand();
|
||||
void PostCommand();
|
||||
|
||||
[[nodiscard]] s32* GetChannelMixBuffer(s32 channel);
|
||||
[[nodiscard]] const s32* GetChannelMixBuffer(s32 channel) const;
|
||||
[[nodiscard]] s32* GetMixBuffer(std::size_t index);
|
||||
[[nodiscard]] const s32* GetMixBuffer(std::size_t index) const;
|
||||
[[nodiscard]] std::size_t GetMixChannelBufferOffset(s32 channel) const;
|
||||
|
||||
[[nodiscard]] std::size_t GetTotalMixBufferCount() const;
|
||||
|
||||
private:
|
||||
void GenerateDataSourceCommand(ServerVoiceInfo& voice_info, VoiceState& dsp_state, s32 channel);
|
||||
void GenerateBiquadFilterCommandForVoice(ServerVoiceInfo& voice_info, VoiceState& dsp_state,
|
||||
s32 mix_buffer_count, s32 channel);
|
||||
void GenerateVolumeRampCommand(float last_volume, float current_volume, s32 channel,
|
||||
s32 node_id);
|
||||
void GenerateVoiceMixCommand(const MixVolumeBuffer& mix_volumes,
|
||||
const MixVolumeBuffer& last_mix_volumes, VoiceState& dsp_state,
|
||||
s32 mix_buffer_offset, s32 mix_buffer_count, s32 voice_index,
|
||||
s32 node_id);
|
||||
void GenerateSubMixCommand(ServerMixInfo& mix_info);
|
||||
void GenerateMixCommands(ServerMixInfo& mix_info);
|
||||
void GenerateMixCommand(std::size_t output_offset, std::size_t input_offset, float volume,
|
||||
s32 node_id);
|
||||
void GenerateFinalMixCommand();
|
||||
void GenerateBiquadFilterCommand(s32 mix_buffer, const BiquadFilterParameter& params,
|
||||
std::array<s64, 2>& state, std::size_t input_offset,
|
||||
std::size_t output_offset, s32 sample_count, s32 node_id);
|
||||
void GenerateDepopPrepareCommand(VoiceState& dsp_state, std::size_t mix_buffer_count,
|
||||
std::size_t mix_buffer_offset);
|
||||
void GenerateDepopForMixBuffersCommand(std::size_t mix_buffer_count,
|
||||
std::size_t mix_buffer_offset, s32 sample_rate);
|
||||
void GenerateEffectCommand(ServerMixInfo& mix_info);
|
||||
void GenerateI3dl2ReverbEffectCommand(s32 mix_buffer_offset, EffectBase* info, bool enabled);
|
||||
void GenerateBiquadFilterEffectCommand(s32 mix_buffer_offset, EffectBase* info, bool enabled);
|
||||
void GenerateAuxCommand(s32 mix_buffer_offset, EffectBase* info, bool enabled);
|
||||
[[nodiscard]] ServerSplitterDestinationData* GetDestinationData(s32 splitter_id, s32 index);
|
||||
|
||||
s32 WriteAuxBuffer(AuxInfoDSP& dsp_info, VAddr send_buffer, u32 max_samples, const s32* data,
|
||||
u32 sample_count, u32 write_offset, u32 write_count);
|
||||
s32 ReadAuxBuffer(AuxInfoDSP& recv_info, VAddr recv_buffer, u32 max_samples, s32* out_data,
|
||||
u32 sample_count, u32 read_offset, u32 read_count);
|
||||
|
||||
// DSP Code
|
||||
s32 DecodePcm16(ServerVoiceInfo& voice_info, VoiceState& dsp_state, s32 sample_count,
|
||||
s32 channel, std::size_t mix_offset);
|
||||
s32 DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_state, s32 sample_count,
|
||||
s32 channel, std::size_t mix_offset);
|
||||
void DecodeFromWaveBuffers(ServerVoiceInfo& voice_info, s32* output, VoiceState& dsp_state,
|
||||
s32 channel, s32 target_sample_rate, s32 sample_count, s32 node_id);
|
||||
|
||||
AudioCommon::AudioRendererParameter& worker_params;
|
||||
VoiceContext& voice_context;
|
||||
MixContext& mix_context;
|
||||
SplitterContext& splitter_context;
|
||||
EffectContext& effect_context;
|
||||
Core::Memory::Memory& memory;
|
||||
std::vector<s32> mix_buffer{};
|
||||
std::vector<s32> sample_buffer{};
|
||||
std::vector<s32> depop_buffer{};
|
||||
bool dumping_frame{false};
|
||||
};
|
||||
} // namespace AudioCore
|
||||
@@ -3,18 +3,36 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/swap.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
namespace AudioCore {
|
||||
namespace AudioCommon {
|
||||
namespace Audren {
|
||||
constexpr ResultCode ERR_INVALID_PARAMETERS{ErrorModule::Audio, 41};
|
||||
}
|
||||
constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43};
|
||||
} // namespace Audren
|
||||
|
||||
constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '8');
|
||||
constexpr std::size_t MAX_MIX_BUFFERS = 24;
|
||||
constexpr std::size_t MAX_BIQUAD_FILTERS = 2;
|
||||
constexpr std::size_t MAX_CHANNEL_COUNT = 6;
|
||||
constexpr std::size_t MAX_WAVE_BUFFERS = 4;
|
||||
constexpr std::size_t MAX_SAMPLE_HISTORY = 4;
|
||||
constexpr u32 STREAM_SAMPLE_RATE = 48000;
|
||||
constexpr u32 STREAM_NUM_CHANNELS = 2;
|
||||
constexpr s32 NO_SPLITTER = -1;
|
||||
constexpr s32 NO_MIX = 0x7fffffff;
|
||||
constexpr s32 NO_FINAL_MIX = std::numeric_limits<s32>::min();
|
||||
constexpr s32 FINAL_MIX = 0;
|
||||
constexpr s32 NO_EFFECT_ORDER = -1;
|
||||
constexpr std::size_t TEMP_MIX_BASE_SIZE = 0x3f00; // TODO(ogniK): Work out this constant
|
||||
// Any size checks seem to take the sample history into account
|
||||
// and our const ends up being 0x3f04, the 4 bytes are most
|
||||
// likely the sample history
|
||||
constexpr std::size_t TOTAL_TEMP_MIX_SIZE = TEMP_MIX_BASE_SIZE + AudioCommon::MAX_SAMPLE_HISTORY;
|
||||
|
||||
static constexpr u32 VersionFromRevision(u32_le rev) {
|
||||
// "REV7" -> 7
|
||||
@@ -45,4 +63,46 @@ static constexpr bool CanConsumeBuffer(std::size_t size, std::size_t offset, std
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
struct UpdateDataSizes {
|
||||
u32_le behavior{};
|
||||
u32_le memory_pool{};
|
||||
u32_le voice{};
|
||||
u32_le voice_channel_resource{};
|
||||
u32_le effect{};
|
||||
u32_le mixer{};
|
||||
u32_le sink{};
|
||||
u32_le performance{};
|
||||
u32_le splitter{};
|
||||
u32_le render_info{};
|
||||
INSERT_PADDING_WORDS(4);
|
||||
};
|
||||
static_assert(sizeof(UpdateDataSizes) == 0x38, "UpdateDataSizes is an invalid size");
|
||||
|
||||
struct UpdateDataHeader {
|
||||
u32_le revision{};
|
||||
UpdateDataSizes size{};
|
||||
u32_le total_size{};
|
||||
};
|
||||
static_assert(sizeof(UpdateDataHeader) == 0x40, "UpdateDataHeader is an invalid size");
|
||||
|
||||
struct AudioRendererParameter {
|
||||
u32_le sample_rate;
|
||||
u32_le sample_count;
|
||||
u32_le mix_buffer_count;
|
||||
u32_le submix_count;
|
||||
u32_le voice_count;
|
||||
u32_le sink_count;
|
||||
u32_le effect_count;
|
||||
u32_le performance_frame_count;
|
||||
u8 is_voice_drop_enabled;
|
||||
u8 unknown_21;
|
||||
u8 unknown_22;
|
||||
u8 execution_mode;
|
||||
u32_le splitter_count;
|
||||
u32_le num_splitter_send_channels;
|
||||
u32_le unknown_30;
|
||||
u32_le revision;
|
||||
};
|
||||
static_assert(sizeof(AudioRendererParameter) == 52, "AudioRendererParameter is an invalid size");
|
||||
|
||||
} // namespace AudioCommon
|
||||
|
||||
@@ -21,16 +21,27 @@ namespace AudioCore {
|
||||
|
||||
class CubebSinkStream final : public SinkStream {
|
||||
public:
|
||||
CubebSinkStream(cubeb* ctx, u32 sample_rate, u32 num_channels_, cubeb_devid output_device,
|
||||
CubebSinkStream(cubeb* ctx_, u32 sample_rate, u32 num_channels_, cubeb_devid output_device,
|
||||
const std::string& name)
|
||||
: ctx{ctx}, num_channels{std::min(num_channels_, 2u)}, time_stretch{sample_rate,
|
||||
num_channels} {
|
||||
: ctx{ctx_}, num_channels{std::min(num_channels_, 6u)}, time_stretch{sample_rate,
|
||||
num_channels} {
|
||||
|
||||
cubeb_stream_params params{};
|
||||
params.rate = sample_rate;
|
||||
params.channels = num_channels;
|
||||
params.format = CUBEB_SAMPLE_S16NE;
|
||||
params.layout = num_channels == 1 ? CUBEB_LAYOUT_MONO : CUBEB_LAYOUT_STEREO;
|
||||
params.prefs = CUBEB_STREAM_PREF_PERSIST;
|
||||
switch (num_channels) {
|
||||
case 1:
|
||||
params.layout = CUBEB_LAYOUT_MONO;
|
||||
break;
|
||||
case 2:
|
||||
params.layout = CUBEB_LAYOUT_STEREO;
|
||||
break;
|
||||
case 6:
|
||||
params.layout = CUBEB_LAYOUT_3F2_LFE;
|
||||
break;
|
||||
}
|
||||
|
||||
u32 minimum_latency{};
|
||||
if (cubeb_get_min_latency(ctx, ¶ms, &minimum_latency) != CUBEB_OK) {
|
||||
@@ -83,8 +94,10 @@ public:
|
||||
constexpr s32 clev{707}; // center mixing level coefficient
|
||||
constexpr s32 slev{707}; // surround mixing level coefficient
|
||||
|
||||
buf.push_back(left + (clev * center / 1000) + (slev * surround_left / 1000));
|
||||
buf.push_back(right + (clev * center / 1000) + (slev * surround_right / 1000));
|
||||
buf.push_back(static_cast<s16>(left + (clev * center / 1000) +
|
||||
(slev * surround_left / 1000)));
|
||||
buf.push_back(static_cast<s16>(right + (clev * center / 1000) +
|
||||
(slev * surround_right / 1000)));
|
||||
}
|
||||
queue.Push(buf);
|
||||
return;
|
||||
@@ -180,10 +193,11 @@ SinkStream& CubebSink::AcquireSinkStream(u32 sample_rate, u32 num_channels,
|
||||
return *sink_streams.back();
|
||||
}
|
||||
|
||||
long CubebSinkStream::DataCallback(cubeb_stream* stream, void* user_data, const void* input_buffer,
|
||||
void* output_buffer, long num_frames) {
|
||||
CubebSinkStream* impl = static_cast<CubebSinkStream*>(user_data);
|
||||
u8* buffer = reinterpret_cast<u8*>(output_buffer);
|
||||
long CubebSinkStream::DataCallback([[maybe_unused]] cubeb_stream* stream, void* user_data,
|
||||
[[maybe_unused]] const void* input_buffer, void* output_buffer,
|
||||
long num_frames) {
|
||||
auto* impl = static_cast<CubebSinkStream*>(user_data);
|
||||
auto* buffer = static_cast<u8*>(output_buffer);
|
||||
|
||||
if (!impl) {
|
||||
return {};
|
||||
@@ -193,6 +207,7 @@ long CubebSinkStream::DataCallback(cubeb_stream* stream, void* user_data, const
|
||||
const std::size_t samples_to_write = num_channels * num_frames;
|
||||
std::size_t samples_written;
|
||||
|
||||
/*
|
||||
if (Settings::values.enable_audio_stretching.GetValue()) {
|
||||
const std::vector<s16> in{impl->queue.Pop()};
|
||||
const std::size_t num_in{in.size() / num_channels};
|
||||
@@ -207,7 +222,8 @@ long CubebSinkStream::DataCallback(cubeb_stream* stream, void* user_data, const
|
||||
}
|
||||
} else {
|
||||
samples_written = impl->queue.Pop(buffer, samples_to_write);
|
||||
}
|
||||
}*/
|
||||
samples_written = impl->queue.Pop(buffer, samples_to_write);
|
||||
|
||||
if (samples_written >= num_channels) {
|
||||
std::memcpy(&impl->last_frame[0], buffer + (samples_written - num_channels) * sizeof(s16),
|
||||
@@ -222,7 +238,9 @@ long CubebSinkStream::DataCallback(cubeb_stream* stream, void* user_data, const
|
||||
return num_frames;
|
||||
}
|
||||
|
||||
void CubebSinkStream::StateCallback(cubeb_stream* stream, void* user_data, cubeb_state state) {}
|
||||
void CubebSinkStream::StateCallback([[maybe_unused]] cubeb_stream* stream,
|
||||
[[maybe_unused]] void* user_data,
|
||||
[[maybe_unused]] cubeb_state state) {}
|
||||
|
||||
std::vector<std::string> ListCubebSinkDevices() {
|
||||
std::vector<std::string> device_list;
|
||||
|
||||
299
src/audio_core/effect_context.cpp
Normal file
@@ -0,0 +1,299 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include "audio_core/effect_context.h"
|
||||
|
||||
namespace AudioCore {
|
||||
namespace {
|
||||
bool ValidChannelCountForEffect(s32 channel_count) {
|
||||
return channel_count == 1 || channel_count == 2 || channel_count == 4 || channel_count == 6;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
EffectContext::EffectContext(std::size_t effect_count_) : effect_count(effect_count_) {
|
||||
effects.reserve(effect_count);
|
||||
std::generate_n(std::back_inserter(effects), effect_count,
|
||||
[] { return std::make_unique<EffectStubbed>(); });
|
||||
}
|
||||
EffectContext::~EffectContext() = default;
|
||||
|
||||
std::size_t EffectContext::GetCount() const {
|
||||
return effect_count;
|
||||
}
|
||||
|
||||
EffectBase* EffectContext::GetInfo(std::size_t i) {
|
||||
return effects.at(i).get();
|
||||
}
|
||||
|
||||
EffectBase* EffectContext::RetargetEffect(std::size_t i, EffectType effect) {
|
||||
switch (effect) {
|
||||
case EffectType::Invalid:
|
||||
effects[i] = std::make_unique<EffectStubbed>();
|
||||
break;
|
||||
case EffectType::BufferMixer:
|
||||
effects[i] = std::make_unique<EffectBufferMixer>();
|
||||
break;
|
||||
case EffectType::Aux:
|
||||
effects[i] = std::make_unique<EffectAuxInfo>();
|
||||
break;
|
||||
case EffectType::Delay:
|
||||
effects[i] = std::make_unique<EffectDelay>();
|
||||
break;
|
||||
case EffectType::Reverb:
|
||||
effects[i] = std::make_unique<EffectReverb>();
|
||||
break;
|
||||
case EffectType::I3dl2Reverb:
|
||||
effects[i] = std::make_unique<EffectI3dl2Reverb>();
|
||||
break;
|
||||
case EffectType::BiquadFilter:
|
||||
effects[i] = std::make_unique<EffectBiquadFilter>();
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unimplemented effect {}", effect);
|
||||
effects[i] = std::make_unique<EffectStubbed>();
|
||||
}
|
||||
return GetInfo(i);
|
||||
}
|
||||
|
||||
const EffectBase* EffectContext::GetInfo(std::size_t i) const {
|
||||
return effects.at(i).get();
|
||||
}
|
||||
|
||||
EffectStubbed::EffectStubbed() : EffectBase(EffectType::Invalid) {}
|
||||
EffectStubbed::~EffectStubbed() = default;
|
||||
|
||||
void EffectStubbed::Update([[maybe_unused]] EffectInfo::InParams& in_params) {}
|
||||
void EffectStubbed::UpdateForCommandGeneration() {}
|
||||
|
||||
EffectBase::EffectBase(EffectType effect_type_) : effect_type(effect_type_) {}
|
||||
EffectBase::~EffectBase() = default;
|
||||
|
||||
UsageState EffectBase::GetUsage() const {
|
||||
return usage;
|
||||
}
|
||||
|
||||
EffectType EffectBase::GetType() const {
|
||||
return effect_type;
|
||||
}
|
||||
|
||||
bool EffectBase::IsEnabled() const {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
s32 EffectBase::GetMixID() const {
|
||||
return mix_id;
|
||||
}
|
||||
|
||||
s32 EffectBase::GetProcessingOrder() const {
|
||||
return processing_order;
|
||||
}
|
||||
|
||||
EffectI3dl2Reverb::EffectI3dl2Reverb() : EffectGeneric(EffectType::I3dl2Reverb) {}
|
||||
EffectI3dl2Reverb::~EffectI3dl2Reverb() = default;
|
||||
|
||||
void EffectI3dl2Reverb::Update(EffectInfo::InParams& in_params) {
|
||||
auto& params = GetParams();
|
||||
const auto* reverb_params = reinterpret_cast<I3dl2ReverbParams*>(in_params.raw.data());
|
||||
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
||||
UNREACHABLE_MSG("Invalid reverb max channel count {}", reverb_params->max_channels);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto last_status = params.status;
|
||||
mix_id = in_params.mix_id;
|
||||
processing_order = in_params.processing_order;
|
||||
params = *reverb_params;
|
||||
if (!ValidChannelCountForEffect(reverb_params->channel_count)) {
|
||||
params.channel_count = params.max_channels;
|
||||
}
|
||||
enabled = in_params.is_enabled;
|
||||
if (last_status != ParameterStatus::Updated) {
|
||||
params.status = last_status;
|
||||
}
|
||||
|
||||
if (in_params.is_new || skipped) {
|
||||
usage = UsageState::Initialized;
|
||||
params.status = ParameterStatus::Initialized;
|
||||
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EffectI3dl2Reverb::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage = UsageState::Running;
|
||||
} else {
|
||||
usage = UsageState::Stopped;
|
||||
}
|
||||
GetParams().status = ParameterStatus::Updated;
|
||||
}
|
||||
|
||||
EffectBiquadFilter::EffectBiquadFilter() : EffectGeneric(EffectType::BiquadFilter) {}
|
||||
EffectBiquadFilter::~EffectBiquadFilter() = default;
|
||||
|
||||
void EffectBiquadFilter::Update(EffectInfo::InParams& in_params) {
|
||||
auto& params = GetParams();
|
||||
const auto* biquad_params = reinterpret_cast<BiquadFilterParams*>(in_params.raw.data());
|
||||
mix_id = in_params.mix_id;
|
||||
processing_order = in_params.processing_order;
|
||||
params = *biquad_params;
|
||||
enabled = in_params.is_enabled;
|
||||
}
|
||||
|
||||
void EffectBiquadFilter::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage = UsageState::Running;
|
||||
} else {
|
||||
usage = UsageState::Stopped;
|
||||
}
|
||||
GetParams().status = ParameterStatus::Updated;
|
||||
}
|
||||
|
||||
EffectAuxInfo::EffectAuxInfo() : EffectGeneric(EffectType::Aux) {}
|
||||
EffectAuxInfo::~EffectAuxInfo() = default;
|
||||
|
||||
void EffectAuxInfo::Update(EffectInfo::InParams& in_params) {
|
||||
const auto* aux_params = reinterpret_cast<AuxInfo*>(in_params.raw.data());
|
||||
mix_id = in_params.mix_id;
|
||||
processing_order = in_params.processing_order;
|
||||
GetParams() = *aux_params;
|
||||
enabled = in_params.is_enabled;
|
||||
|
||||
if (in_params.is_new || skipped) {
|
||||
skipped = aux_params->send_buffer_info == 0 || aux_params->return_buffer_info == 0;
|
||||
if (skipped) {
|
||||
return;
|
||||
}
|
||||
|
||||
// There's two AuxInfos which are an identical size, the first one is managed by the cpu,
|
||||
// the second is managed by the dsp. All we care about is managing the DSP one
|
||||
send_info = aux_params->send_buffer_info + sizeof(AuxInfoDSP);
|
||||
send_buffer = aux_params->send_buffer_info + (sizeof(AuxInfoDSP) * 2);
|
||||
|
||||
recv_info = aux_params->return_buffer_info + sizeof(AuxInfoDSP);
|
||||
recv_buffer = aux_params->return_buffer_info + (sizeof(AuxInfoDSP) * 2);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectAuxInfo::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage = UsageState::Running;
|
||||
} else {
|
||||
usage = UsageState::Stopped;
|
||||
}
|
||||
}
|
||||
|
||||
VAddr EffectAuxInfo::GetSendInfo() const {
|
||||
return send_info;
|
||||
}
|
||||
|
||||
VAddr EffectAuxInfo::GetSendBuffer() const {
|
||||
return send_buffer;
|
||||
}
|
||||
|
||||
VAddr EffectAuxInfo::GetRecvInfo() const {
|
||||
return recv_info;
|
||||
}
|
||||
|
||||
VAddr EffectAuxInfo::GetRecvBuffer() const {
|
||||
return recv_buffer;
|
||||
}
|
||||
|
||||
EffectDelay::EffectDelay() : EffectGeneric(EffectType::Delay) {}
|
||||
EffectDelay::~EffectDelay() = default;
|
||||
|
||||
void EffectDelay::Update(EffectInfo::InParams& in_params) {
|
||||
const auto* delay_params = reinterpret_cast<DelayParams*>(in_params.raw.data());
|
||||
auto& params = GetParams();
|
||||
if (!ValidChannelCountForEffect(delay_params->max_channels)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto last_status = params.status;
|
||||
mix_id = in_params.mix_id;
|
||||
processing_order = in_params.processing_order;
|
||||
params = *delay_params;
|
||||
if (!ValidChannelCountForEffect(delay_params->channels)) {
|
||||
params.channels = params.max_channels;
|
||||
}
|
||||
enabled = in_params.is_enabled;
|
||||
|
||||
if (last_status != ParameterStatus::Updated) {
|
||||
params.status = last_status;
|
||||
}
|
||||
|
||||
if (in_params.is_new || skipped) {
|
||||
usage = UsageState::Initialized;
|
||||
params.status = ParameterStatus::Initialized;
|
||||
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EffectDelay::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage = UsageState::Running;
|
||||
} else {
|
||||
usage = UsageState::Stopped;
|
||||
}
|
||||
GetParams().status = ParameterStatus::Updated;
|
||||
}
|
||||
|
||||
EffectBufferMixer::EffectBufferMixer() : EffectGeneric(EffectType::BufferMixer) {}
|
||||
EffectBufferMixer::~EffectBufferMixer() = default;
|
||||
|
||||
void EffectBufferMixer::Update(EffectInfo::InParams& in_params) {
|
||||
mix_id = in_params.mix_id;
|
||||
processing_order = in_params.processing_order;
|
||||
GetParams() = *reinterpret_cast<BufferMixerParams*>(in_params.raw.data());
|
||||
enabled = in_params.is_enabled;
|
||||
}
|
||||
|
||||
void EffectBufferMixer::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage = UsageState::Running;
|
||||
} else {
|
||||
usage = UsageState::Stopped;
|
||||
}
|
||||
}
|
||||
|
||||
EffectReverb::EffectReverb() : EffectGeneric(EffectType::Reverb) {}
|
||||
EffectReverb::~EffectReverb() = default;
|
||||
|
||||
void EffectReverb::Update(EffectInfo::InParams& in_params) {
|
||||
const auto* reverb_params = reinterpret_cast<ReverbParams*>(in_params.raw.data());
|
||||
auto& params = GetParams();
|
||||
if (!ValidChannelCountForEffect(reverb_params->max_channels)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto last_status = params.status;
|
||||
mix_id = in_params.mix_id;
|
||||
processing_order = in_params.processing_order;
|
||||
params = *reverb_params;
|
||||
if (!ValidChannelCountForEffect(reverb_params->channels)) {
|
||||
params.channels = params.max_channels;
|
||||
}
|
||||
enabled = in_params.is_enabled;
|
||||
|
||||
if (last_status != ParameterStatus::Updated) {
|
||||
params.status = last_status;
|
||||
}
|
||||
|
||||
if (in_params.is_new || skipped) {
|
||||
usage = UsageState::Initialized;
|
||||
params.status = ParameterStatus::Initialized;
|
||||
skipped = in_params.buffer_address == 0 || in_params.buffer_size == 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EffectReverb::UpdateForCommandGeneration() {
|
||||
if (enabled) {
|
||||
usage = UsageState::Running;
|
||||
} else {
|
||||
usage = UsageState::Stopped;
|
||||
}
|
||||
GetParams().status = ParameterStatus::Updated;
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
321
src/audio_core/effect_context.h
Normal file
@@ -0,0 +1,321 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "audio_core/common.h"
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/swap.h"
|
||||
|
||||
namespace AudioCore {
|
||||
enum class EffectType : u8 {
|
||||
Invalid = 0,
|
||||
BufferMixer = 1,
|
||||
Aux = 2,
|
||||
Delay = 3,
|
||||
Reverb = 4,
|
||||
I3dl2Reverb = 5,
|
||||
BiquadFilter = 6,
|
||||
};
|
||||
|
||||
enum class UsageStatus : u8 {
|
||||
Invalid = 0,
|
||||
New = 1,
|
||||
Initialized = 2,
|
||||
Used = 3,
|
||||
Removed = 4,
|
||||
};
|
||||
|
||||
enum class UsageState {
|
||||
Invalid = 0,
|
||||
Initialized = 1,
|
||||
Running = 2,
|
||||
Stopped = 3,
|
||||
};
|
||||
|
||||
enum class ParameterStatus : u8 {
|
||||
Initialized = 0,
|
||||
Updating = 1,
|
||||
Updated = 2,
|
||||
};
|
||||
|
||||
struct BufferMixerParams {
|
||||
std::array<s8, AudioCommon::MAX_MIX_BUFFERS> input{};
|
||||
std::array<s8, AudioCommon::MAX_MIX_BUFFERS> output{};
|
||||
std::array<float_le, AudioCommon::MAX_MIX_BUFFERS> volume{};
|
||||
s32_le count{};
|
||||
};
|
||||
static_assert(sizeof(BufferMixerParams) == 0x94, "BufferMixerParams is an invalid size");
|
||||
|
||||
struct AuxInfoDSP {
|
||||
u32_le read_offset{};
|
||||
u32_le write_offset{};
|
||||
u32_le remaining{};
|
||||
INSERT_PADDING_WORDS(13);
|
||||
};
|
||||
static_assert(sizeof(AuxInfoDSP) == 0x40, "AuxInfoDSP is an invalid size");
|
||||
|
||||
struct AuxInfo {
|
||||
std::array<s8, AudioCommon::MAX_MIX_BUFFERS> input_mix_buffers{};
|
||||
std::array<s8, AudioCommon::MAX_MIX_BUFFERS> output_mix_buffers{};
|
||||
u32_le count{};
|
||||
s32_le sample_rate{};
|
||||
s32_le sample_count{};
|
||||
s32_le mix_buffer_count{};
|
||||
u64_le send_buffer_info{};
|
||||
u64_le send_buffer_base{};
|
||||
|
||||
u64_le return_buffer_info{};
|
||||
u64_le return_buffer_base{};
|
||||
};
|
||||
static_assert(sizeof(AuxInfo) == 0x60, "AuxInfo is an invalid size");
|
||||
|
||||
struct I3dl2ReverbParams {
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> input{};
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> output{};
|
||||
u16_le max_channels{};
|
||||
u16_le channel_count{};
|
||||
INSERT_PADDING_BYTES(1);
|
||||
u32_le sample_rate{};
|
||||
f32 room_hf{};
|
||||
f32 hf_reference{};
|
||||
f32 decay_time{};
|
||||
f32 hf_decay_ratio{};
|
||||
f32 room{};
|
||||
f32 reflection{};
|
||||
f32 reverb{};
|
||||
f32 diffusion{};
|
||||
f32 reflection_delay{};
|
||||
f32 reverb_delay{};
|
||||
f32 density{};
|
||||
f32 dry_gain{};
|
||||
ParameterStatus status{};
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(I3dl2ReverbParams) == 0x4c, "I3dl2ReverbParams is an invalid size");
|
||||
|
||||
struct BiquadFilterParams {
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> input{};
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> output{};
|
||||
std::array<s16_le, 3> numerator;
|
||||
std::array<s16_le, 2> denominator;
|
||||
s8 channel_count{};
|
||||
ParameterStatus status{};
|
||||
};
|
||||
static_assert(sizeof(BiquadFilterParams) == 0x18, "BiquadFilterParams is an invalid size");
|
||||
|
||||
struct DelayParams {
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> input{};
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> output{};
|
||||
u16_le max_channels{};
|
||||
u16_le channels{};
|
||||
s32_le max_delay{};
|
||||
s32_le delay{};
|
||||
s32_le sample_rate{};
|
||||
s32_le gain{};
|
||||
s32_le feedback_gain{};
|
||||
s32_le out_gain{};
|
||||
s32_le dry_gain{};
|
||||
s32_le channel_spread{};
|
||||
s32_le low_pass{};
|
||||
ParameterStatus status{};
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(DelayParams) == 0x38, "DelayParams is an invalid size");
|
||||
|
||||
struct ReverbParams {
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> input{};
|
||||
std::array<s8, AudioCommon::MAX_CHANNEL_COUNT> output{};
|
||||
u16_le max_channels{};
|
||||
u16_le channels{};
|
||||
s32_le sample_rate{};
|
||||
s32_le mode0{};
|
||||
s32_le mode0_gain{};
|
||||
s32_le pre_delay{};
|
||||
s32_le mode1{};
|
||||
s32_le mode1_gain{};
|
||||
s32_le decay{};
|
||||
s32_le hf_decay_ratio{};
|
||||
s32_le coloration{};
|
||||
s32_le reverb_gain{};
|
||||
s32_le out_gain{};
|
||||
s32_le dry_gain{};
|
||||
ParameterStatus status{};
|
||||
INSERT_PADDING_BYTES(3);
|
||||
};
|
||||
static_assert(sizeof(ReverbParams) == 0x44, "ReverbParams is an invalid size");
|
||||
|
||||
class EffectInfo {
|
||||
public:
|
||||
struct InParams {
|
||||
EffectType type{};
|
||||
u8 is_new{};
|
||||
u8 is_enabled{};
|
||||
INSERT_PADDING_BYTES(1);
|
||||
s32_le mix_id{};
|
||||
u64_le buffer_address{};
|
||||
u64_le buffer_size{};
|
||||
s32_le processing_order{};
|
||||
INSERT_PADDING_BYTES(4);
|
||||
union {
|
||||
std::array<u8, 0xa0> raw;
|
||||
};
|
||||
};
|
||||
static_assert(sizeof(InParams) == 0xc0, "InParams is an invalid size");
|
||||
|
||||
struct OutParams {
|
||||
UsageStatus status{};
|
||||
INSERT_PADDING_BYTES(15);
|
||||
};
|
||||
static_assert(sizeof(OutParams) == 0x10, "OutParams is an invalid size");
|
||||
};
|
||||
|
||||
struct AuxAddress {
|
||||
VAddr send_dsp_info{};
|
||||
VAddr send_buffer_base{};
|
||||
VAddr return_dsp_info{};
|
||||
VAddr return_buffer_base{};
|
||||
};
|
||||
|
||||
class EffectBase {
|
||||
public:
|
||||
explicit EffectBase(EffectType effect_type_);
|
||||
virtual ~EffectBase();
|
||||
|
||||
virtual void Update(EffectInfo::InParams& in_params) = 0;
|
||||
virtual void UpdateForCommandGeneration() = 0;
|
||||
[[nodiscard]] UsageState GetUsage() const;
|
||||
[[nodiscard]] EffectType GetType() const;
|
||||
[[nodiscard]] bool IsEnabled() const;
|
||||
[[nodiscard]] s32 GetMixID() const;
|
||||
[[nodiscard]] s32 GetProcessingOrder() const;
|
||||
|
||||
protected:
|
||||
UsageState usage{UsageState::Invalid};
|
||||
EffectType effect_type{};
|
||||
s32 mix_id{};
|
||||
s32 processing_order{};
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class EffectGeneric : public EffectBase {
|
||||
public:
|
||||
explicit EffectGeneric(EffectType effect_type_) : EffectBase(effect_type_) {}
|
||||
|
||||
T& GetParams() {
|
||||
return internal_params;
|
||||
}
|
||||
|
||||
const I3dl2ReverbParams& GetParams() const {
|
||||
return internal_params;
|
||||
}
|
||||
|
||||
private:
|
||||
T internal_params{};
|
||||
};
|
||||
|
||||
class EffectStubbed : public EffectBase {
|
||||
public:
|
||||
explicit EffectStubbed();
|
||||
~EffectStubbed() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
};
|
||||
|
||||
class EffectI3dl2Reverb : public EffectGeneric<I3dl2ReverbParams> {
|
||||
public:
|
||||
explicit EffectI3dl2Reverb();
|
||||
~EffectI3dl2Reverb() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
private:
|
||||
bool skipped = false;
|
||||
};
|
||||
|
||||
class EffectBiquadFilter : public EffectGeneric<BiquadFilterParams> {
|
||||
public:
|
||||
explicit EffectBiquadFilter();
|
||||
~EffectBiquadFilter() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
};
|
||||
|
||||
class EffectAuxInfo : public EffectGeneric<AuxInfo> {
|
||||
public:
|
||||
explicit EffectAuxInfo();
|
||||
~EffectAuxInfo() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
[[nodiscard]] VAddr GetSendInfo() const;
|
||||
[[nodiscard]] VAddr GetSendBuffer() const;
|
||||
[[nodiscard]] VAddr GetRecvInfo() const;
|
||||
[[nodiscard]] VAddr GetRecvBuffer() const;
|
||||
|
||||
private:
|
||||
VAddr send_info{};
|
||||
VAddr send_buffer{};
|
||||
VAddr recv_info{};
|
||||
VAddr recv_buffer{};
|
||||
bool skipped = false;
|
||||
AuxAddress addresses{};
|
||||
};
|
||||
|
||||
class EffectDelay : public EffectGeneric<DelayParams> {
|
||||
public:
|
||||
explicit EffectDelay();
|
||||
~EffectDelay() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
private:
|
||||
bool skipped = false;
|
||||
};
|
||||
|
||||
class EffectBufferMixer : public EffectGeneric<BufferMixerParams> {
|
||||
public:
|
||||
explicit EffectBufferMixer();
|
||||
~EffectBufferMixer() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
};
|
||||
|
||||
class EffectReverb : public EffectGeneric<ReverbParams> {
|
||||
public:
|
||||
explicit EffectReverb();
|
||||
~EffectReverb() override;
|
||||
|
||||
void Update(EffectInfo::InParams& in_params) override;
|
||||
void UpdateForCommandGeneration() override;
|
||||
|
||||
private:
|
||||
bool skipped = false;
|
||||
};
|
||||
|
||||
class EffectContext {
|
||||
public:
|
||||
explicit EffectContext(std::size_t effect_count_);
|
||||
~EffectContext();
|
||||
|
||||
[[nodiscard]] std::size_t GetCount() const;
|
||||
[[nodiscard]] EffectBase* GetInfo(std::size_t i);
|
||||
[[nodiscard]] EffectBase* RetargetEffect(std::size_t i, EffectType effect);
|
||||
[[nodiscard]] const EffectBase* GetInfo(std::size_t i) const;
|
||||
|
||||
private:
|
||||
std::size_t effect_count{};
|
||||
std::vector<std::unique_ptr<EffectBase>> effects;
|
||||
};
|
||||
} // namespace AudioCore
|
||||
516
src/audio_core/info_updater.cpp
Normal file
@@ -0,0 +1,516 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "audio_core/behavior_info.h"
|
||||
#include "audio_core/effect_context.h"
|
||||
#include "audio_core/info_updater.h"
|
||||
#include "audio_core/memory_pool.h"
|
||||
#include "audio_core/mix_context.h"
|
||||
#include "audio_core/sink_context.h"
|
||||
#include "audio_core/splitter_context.h"
|
||||
#include "audio_core/voice_context.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
InfoUpdater::InfoUpdater(const std::vector<u8>& in_params_, std::vector<u8>& out_params_,
|
||||
BehaviorInfo& behavior_info_)
|
||||
: in_params(in_params_), out_params(out_params_), behavior_info(behavior_info_) {
|
||||
ASSERT(
|
||||
AudioCommon::CanConsumeBuffer(in_params.size(), 0, sizeof(AudioCommon::UpdateDataHeader)));
|
||||
std::memcpy(&input_header, in_params.data(), sizeof(AudioCommon::UpdateDataHeader));
|
||||
output_header.total_size = sizeof(AudioCommon::UpdateDataHeader);
|
||||
}
|
||||
|
||||
InfoUpdater::~InfoUpdater() = default;
|
||||
|
||||
bool InfoUpdater::UpdateBehaviorInfo(BehaviorInfo& in_behavior_info) {
|
||||
if (input_header.size.behavior != sizeof(BehaviorInfo::InParams)) {
|
||||
LOG_ERROR(Audio, "Behavior info is an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
sizeof(BehaviorInfo::InParams), input_header.size.behavior);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset,
|
||||
sizeof(BehaviorInfo::InParams))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
BehaviorInfo::InParams behavior_in{};
|
||||
std::memcpy(&behavior_in, in_params.data() + input_offset, sizeof(BehaviorInfo::InParams));
|
||||
input_offset += sizeof(BehaviorInfo::InParams);
|
||||
|
||||
// Make sure it's an audio revision we can actually support
|
||||
if (!AudioCommon::IsValidRevision(behavior_in.revision)) {
|
||||
LOG_ERROR(Audio, "Invalid input revision, revision=0x{:08X}", behavior_in.revision);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure that our behavior info revision matches the input
|
||||
if (in_behavior_info.GetUserRevision() != behavior_in.revision) {
|
||||
LOG_ERROR(Audio,
|
||||
"User revision differs from input revision, expecting 0x{:08X} but got 0x{:08X}",
|
||||
in_behavior_info.GetUserRevision(), behavior_in.revision);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update behavior info flags
|
||||
in_behavior_info.ClearError();
|
||||
in_behavior_info.UpdateFlags(behavior_in.flags);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateMemoryPools(std::vector<ServerMemoryPoolInfo>& memory_pool_info) {
|
||||
const auto memory_pool_count = memory_pool_info.size();
|
||||
const auto total_memory_pool_in = sizeof(ServerMemoryPoolInfo::InParams) * memory_pool_count;
|
||||
const auto total_memory_pool_out = sizeof(ServerMemoryPoolInfo::OutParams) * memory_pool_count;
|
||||
|
||||
if (input_header.size.memory_pool != total_memory_pool_in) {
|
||||
LOG_ERROR(Audio, "Memory pools are an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
total_memory_pool_in, input_header.size.memory_pool);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset, total_memory_pool_in)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<ServerMemoryPoolInfo::InParams> mempool_in(memory_pool_count);
|
||||
std::vector<ServerMemoryPoolInfo::OutParams> mempool_out(memory_pool_count);
|
||||
|
||||
std::memcpy(mempool_in.data(), in_params.data() + input_offset, total_memory_pool_in);
|
||||
input_offset += total_memory_pool_in;
|
||||
|
||||
// Update our memory pools
|
||||
for (std::size_t i = 0; i < memory_pool_count; i++) {
|
||||
if (!memory_pool_info[i].Update(mempool_in[i], mempool_out[i])) {
|
||||
LOG_ERROR(Audio, "Failed to update memory pool {}!", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset,
|
||||
sizeof(BehaviorInfo::InParams))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::memcpy(out_params.data() + output_offset, mempool_out.data(), total_memory_pool_out);
|
||||
output_offset += total_memory_pool_out;
|
||||
output_header.size.memory_pool = static_cast<u32>(total_memory_pool_out);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateVoiceChannelResources(VoiceContext& voice_context) {
|
||||
const auto voice_count = voice_context.GetVoiceCount();
|
||||
const auto voice_size = voice_count * sizeof(VoiceChannelResource::InParams);
|
||||
std::vector<VoiceChannelResource::InParams> resources_in(voice_count);
|
||||
|
||||
if (input_header.size.voice_channel_resource != voice_size) {
|
||||
LOG_ERROR(Audio, "VoiceChannelResource is an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
voice_size, input_header.size.voice_channel_resource);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset, voice_size)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::memcpy(resources_in.data(), in_params.data() + input_offset, voice_size);
|
||||
input_offset += voice_size;
|
||||
|
||||
// Update our channel resources
|
||||
for (std::size_t i = 0; i < voice_count; i++) {
|
||||
// Grab our channel resource
|
||||
auto& resource = voice_context.GetChannelResource(i);
|
||||
resource.Update(resources_in[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
||||
[[maybe_unused]] std::vector<ServerMemoryPoolInfo>& memory_pool_info,
|
||||
[[maybe_unused]] VAddr audio_codec_dsp_addr) {
|
||||
const auto voice_count = voice_context.GetVoiceCount();
|
||||
std::vector<VoiceInfo::InParams> voice_in(voice_count);
|
||||
std::vector<VoiceInfo::OutParams> voice_out(voice_count);
|
||||
|
||||
const auto voice_in_size = voice_count * sizeof(VoiceInfo::InParams);
|
||||
const auto voice_out_size = voice_count * sizeof(VoiceInfo::OutParams);
|
||||
|
||||
if (input_header.size.voice != voice_in_size) {
|
||||
LOG_ERROR(Audio, "Voices are an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
voice_in_size, input_header.size.voice);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset, voice_in_size)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::memcpy(voice_in.data(), in_params.data() + input_offset, voice_in_size);
|
||||
input_offset += voice_in_size;
|
||||
|
||||
// Set all voices to not be in use
|
||||
for (std::size_t i = 0; i < voice_count; i++) {
|
||||
voice_context.GetInfo(i).GetInParams().in_use = false;
|
||||
}
|
||||
|
||||
// Update our voices
|
||||
for (std::size_t i = 0; i < voice_count; i++) {
|
||||
auto& voice_in_params = voice_in[i];
|
||||
const auto channel_count = static_cast<std::size_t>(voice_in_params.channel_count);
|
||||
// Skip if it's not currently in use
|
||||
if (!voice_in_params.is_in_use) {
|
||||
continue;
|
||||
}
|
||||
// Voice states for each channel
|
||||
std::array<VoiceState*, AudioCommon::MAX_CHANNEL_COUNT> voice_states{};
|
||||
ASSERT(static_cast<std::size_t>(voice_in_params.id) < voice_count);
|
||||
|
||||
// Grab our current voice info
|
||||
auto& voice_info = voice_context.GetInfo(static_cast<std::size_t>(voice_in_params.id));
|
||||
|
||||
ASSERT(channel_count <= AudioCommon::MAX_CHANNEL_COUNT);
|
||||
|
||||
// Get all our channel voice states
|
||||
for (std::size_t channel = 0; channel < channel_count; channel++) {
|
||||
voice_states[channel] =
|
||||
&voice_context.GetState(voice_in_params.voice_channel_resource_ids[channel]);
|
||||
}
|
||||
|
||||
if (voice_in_params.is_new) {
|
||||
// Default our values for our voice
|
||||
voice_info.Initialize();
|
||||
if (channel_count == 0 || channel_count > AudioCommon::MAX_CHANNEL_COUNT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Zero out our voice states
|
||||
for (std::size_t channel = 0; channel < channel_count; channel++) {
|
||||
std::memset(voice_states[channel], 0, sizeof(VoiceState));
|
||||
}
|
||||
}
|
||||
|
||||
// Update our voice
|
||||
voice_info.UpdateParameters(voice_in_params, behavior_info);
|
||||
// TODO(ogniK): Handle mapping errors with behavior info based on in params response
|
||||
|
||||
// Update our wave buffers
|
||||
voice_info.UpdateWaveBuffers(voice_in_params, voice_states, behavior_info);
|
||||
voice_info.WriteOutStatus(voice_out[i], voice_in_params, voice_states);
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, voice_out_size)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
std::memcpy(out_params.data() + output_offset, voice_out.data(), voice_out_size);
|
||||
output_offset += voice_out_size;
|
||||
output_header.size.voice = static_cast<u32>(voice_out_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateEffects(EffectContext& effect_context, bool is_active) {
|
||||
const auto effect_count = effect_context.GetCount();
|
||||
std::vector<EffectInfo::InParams> effect_in(effect_count);
|
||||
std::vector<EffectInfo::OutParams> effect_out(effect_count);
|
||||
|
||||
const auto total_effect_in = effect_count * sizeof(EffectInfo::InParams);
|
||||
const auto total_effect_out = effect_count * sizeof(EffectInfo::OutParams);
|
||||
|
||||
if (input_header.size.effect != total_effect_in) {
|
||||
LOG_ERROR(Audio, "Effects are an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
total_effect_in, input_header.size.effect);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset, total_effect_in)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::memcpy(effect_in.data(), in_params.data() + input_offset, total_effect_in);
|
||||
input_offset += total_effect_in;
|
||||
|
||||
// Update effects
|
||||
for (std::size_t i = 0; i < effect_count; i++) {
|
||||
auto* info = effect_context.GetInfo(i);
|
||||
if (effect_in[i].type != info->GetType()) {
|
||||
info = effect_context.RetargetEffect(i, effect_in[i].type);
|
||||
}
|
||||
|
||||
info->Update(effect_in[i]);
|
||||
|
||||
if ((!is_active && info->GetUsage() != UsageState::Initialized) ||
|
||||
info->GetUsage() == UsageState::Stopped) {
|
||||
effect_out[i].status = UsageStatus::Removed;
|
||||
} else {
|
||||
effect_out[i].status = UsageStatus::Used;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, total_effect_out)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::memcpy(out_params.data() + output_offset, effect_out.data(), total_effect_out);
|
||||
output_offset += total_effect_out;
|
||||
output_header.size.effect = static_cast<u32>(total_effect_out);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateSplitterInfo(SplitterContext& splitter_context) {
|
||||
std::size_t start_offset = input_offset;
|
||||
std::size_t bytes_read{};
|
||||
// Update splitter context
|
||||
if (!splitter_context.Update(in_params, input_offset, bytes_read)) {
|
||||
LOG_ERROR(Audio, "Failed to update splitter context!");
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto consumed = input_offset - start_offset;
|
||||
|
||||
if (input_header.size.splitter != consumed) {
|
||||
LOG_ERROR(Audio, "Splitters is an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
bytes_read, input_header.size.splitter);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ResultCode InfoUpdater::UpdateMixes(MixContext& mix_context, std::size_t mix_buffer_count,
|
||||
SplitterContext& splitter_context,
|
||||
EffectContext& effect_context) {
|
||||
std::vector<MixInfo::InParams> mix_in_params;
|
||||
|
||||
if (!behavior_info.IsMixInParameterDirtyOnlyUpdateSupported()) {
|
||||
// If we're not dirty, get ALL mix in parameters
|
||||
const auto context_mix_count = mix_context.GetCount();
|
||||
const auto total_mix_in = context_mix_count * sizeof(MixInfo::InParams);
|
||||
if (input_header.size.mixer != total_mix_in) {
|
||||
LOG_ERROR(Audio, "Mixer is an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
total_mix_in, input_header.size.mixer);
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset, total_mix_in)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
mix_in_params.resize(context_mix_count);
|
||||
std::memcpy(mix_in_params.data(), in_params.data() + input_offset, total_mix_in);
|
||||
|
||||
input_offset += total_mix_in;
|
||||
} else {
|
||||
// Only update the "dirty" mixes
|
||||
MixInfo::DirtyHeader dirty_header{};
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset,
|
||||
sizeof(MixInfo::DirtyHeader))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
std::memcpy(&dirty_header, in_params.data() + input_offset, sizeof(MixInfo::DirtyHeader));
|
||||
input_offset += sizeof(MixInfo::DirtyHeader);
|
||||
|
||||
const auto total_mix_in =
|
||||
dirty_header.mixer_count * sizeof(MixInfo::InParams) + sizeof(MixInfo::DirtyHeader);
|
||||
|
||||
if (input_header.size.mixer != total_mix_in) {
|
||||
LOG_ERROR(Audio, "Mixer is an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
total_mix_in, input_header.size.mixer);
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
if (dirty_header.mixer_count != 0) {
|
||||
mix_in_params.resize(dirty_header.mixer_count);
|
||||
std::memcpy(mix_in_params.data(), in_params.data() + input_offset,
|
||||
mix_in_params.size() * sizeof(MixInfo::InParams));
|
||||
input_offset += mix_in_params.size() * sizeof(MixInfo::InParams);
|
||||
}
|
||||
}
|
||||
|
||||
// Get our total input count
|
||||
const auto mix_count = mix_in_params.size();
|
||||
|
||||
if (!behavior_info.IsMixInParameterDirtyOnlyUpdateSupported()) {
|
||||
// Only verify our buffer count if we're not dirty
|
||||
std::size_t total_buffer_count{};
|
||||
for (std::size_t i = 0; i < mix_count; i++) {
|
||||
const auto& in = mix_in_params[i];
|
||||
total_buffer_count += in.buffer_count;
|
||||
if (static_cast<std::size_t>(in.dest_mix_id) > mix_count &&
|
||||
in.dest_mix_id != AudioCommon::NO_MIX && in.mix_id != AudioCommon::FINAL_MIX) {
|
||||
LOG_ERROR(
|
||||
Audio,
|
||||
"Invalid mix destination, mix_id={:X}, dest_mix_id={:X}, mix_buffer_count={:X}",
|
||||
in.mix_id, in.dest_mix_id, mix_buffer_count);
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
if (total_buffer_count > mix_buffer_count) {
|
||||
LOG_ERROR(Audio,
|
||||
"Too many mix buffers used! mix_buffer_count={:X}, requesting_buffers={:X}",
|
||||
mix_buffer_count, total_buffer_count);
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
if (mix_buffer_count == 0) {
|
||||
LOG_ERROR(Audio, "No mix buffers!");
|
||||
return AudioCommon::Audren::ERR_INVALID_PARAMETERS;
|
||||
}
|
||||
|
||||
bool should_sort = false;
|
||||
for (std::size_t i = 0; i < mix_count; i++) {
|
||||
const auto& mix_in = mix_in_params[i];
|
||||
std::size_t target_mix{};
|
||||
if (behavior_info.IsMixInParameterDirtyOnlyUpdateSupported()) {
|
||||
target_mix = mix_in.mix_id;
|
||||
} else {
|
||||
// Non dirty supported games just use i instead of the actual mix_id
|
||||
target_mix = i;
|
||||
}
|
||||
auto& mix_info = mix_context.GetInfo(target_mix);
|
||||
auto& mix_info_params = mix_info.GetInParams();
|
||||
if (mix_info_params.in_use != mix_in.in_use) {
|
||||
mix_info_params.in_use = mix_in.in_use;
|
||||
mix_info.ResetEffectProcessingOrder();
|
||||
should_sort = true;
|
||||
}
|
||||
|
||||
if (mix_in.in_use) {
|
||||
should_sort |= mix_info.Update(mix_context.GetEdgeMatrix(), mix_in, behavior_info,
|
||||
splitter_context, effect_context);
|
||||
}
|
||||
}
|
||||
|
||||
if (should_sort && behavior_info.IsSplitterSupported()) {
|
||||
// Sort our splitter data
|
||||
if (!mix_context.TsortInfo(splitter_context)) {
|
||||
return AudioCommon::Audren::ERR_SPLITTER_SORT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(ogniK): Sort when splitter is suppoorted
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateSinks(SinkContext& sink_context) {
|
||||
const auto sink_count = sink_context.GetCount();
|
||||
std::vector<SinkInfo::InParams> sink_in_params(sink_count);
|
||||
const auto total_sink_in = sink_count * sizeof(SinkInfo::InParams);
|
||||
|
||||
if (input_header.size.sink != total_sink_in) {
|
||||
LOG_ERROR(Audio, "Sinks are an invalid size, expecting 0x{:X} but got 0x{:X}",
|
||||
total_sink_in, input_header.size.effect);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(in_params.size(), input_offset, total_sink_in)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::memcpy(sink_in_params.data(), in_params.data() + input_offset, total_sink_in);
|
||||
input_offset += total_sink_in;
|
||||
|
||||
// TODO(ogniK): Properly update sinks
|
||||
if (!sink_in_params.empty()) {
|
||||
sink_context.UpdateMainSink(sink_in_params[0]);
|
||||
}
|
||||
|
||||
output_header.size.sink = static_cast<u32>(0x20 * sink_count);
|
||||
output_offset += 0x20 * sink_count;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdatePerformanceBuffer() {
|
||||
output_header.size.performance = 0x10;
|
||||
output_offset += 0x10;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::UpdateErrorInfo([[maybe_unused]] BehaviorInfo& in_behavior_info) {
|
||||
const auto total_beahvior_info_out = sizeof(BehaviorInfo::OutParams);
|
||||
|
||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, total_beahvior_info_out)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
|
||||
BehaviorInfo::OutParams behavior_info_out{};
|
||||
behavior_info.CopyErrorInfo(behavior_info_out);
|
||||
|
||||
std::memcpy(out_params.data() + output_offset, &behavior_info_out, total_beahvior_info_out);
|
||||
output_offset += total_beahvior_info_out;
|
||||
output_header.size.behavior = total_beahvior_info_out;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct RendererInfo {
|
||||
u64_le elasped_frame_count{};
|
||||
INSERT_PADDING_WORDS(2);
|
||||
};
|
||||
static_assert(sizeof(RendererInfo) == 0x10, "RendererInfo is an invalid size");
|
||||
|
||||
bool InfoUpdater::UpdateRendererInfo(std::size_t elapsed_frame_count) {
|
||||
const auto total_renderer_info_out = sizeof(RendererInfo);
|
||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), output_offset, total_renderer_info_out)) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
RendererInfo out{};
|
||||
out.elasped_frame_count = elapsed_frame_count;
|
||||
std::memcpy(out_params.data() + output_offset, &out, total_renderer_info_out);
|
||||
output_offset += total_renderer_info_out;
|
||||
output_header.size.render_info = total_renderer_info_out;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::CheckConsumedSize() const {
|
||||
if (output_offset != out_params.size()) {
|
||||
LOG_ERROR(Audio, "Output is not consumed! Consumed {}, but requires {}. {} bytes remaining",
|
||||
output_offset, out_params.size(), out_params.size() - output_offset);
|
||||
return false;
|
||||
}
|
||||
/*if (input_offset != in_params.size()) {
|
||||
LOG_ERROR(Audio, "Input is not consumed!");
|
||||
return false;
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoUpdater::WriteOutputHeader() {
|
||||
if (!AudioCommon::CanConsumeBuffer(out_params.size(), 0,
|
||||
sizeof(AudioCommon::UpdateDataHeader))) {
|
||||
LOG_ERROR(Audio, "Buffer is an invalid size!");
|
||||
return false;
|
||||
}
|
||||
output_header.revision = AudioCommon::CURRENT_PROCESS_REVISION;
|
||||
const auto& sz = output_header.size;
|
||||
output_header.total_size += sz.behavior + sz.memory_pool + sz.voice +
|
||||
sz.voice_channel_resource + sz.effect + sz.mixer + sz.sink +
|
||||
sz.performance + sz.splitter + sz.render_info;
|
||||
|
||||
std::memcpy(out_params.data(), &output_header, sizeof(AudioCommon::UpdateDataHeader));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
58
src/audio_core/info_updater.h
Normal file
@@ -0,0 +1,58 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "audio_core/common.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
class BehaviorInfo;
|
||||
class ServerMemoryPoolInfo;
|
||||
class VoiceContext;
|
||||
class EffectContext;
|
||||
class MixContext;
|
||||
class SinkContext;
|
||||
class SplitterContext;
|
||||
|
||||
class InfoUpdater {
|
||||
public:
|
||||
// TODO(ogniK): Pass process handle when we support it
|
||||
InfoUpdater(const std::vector<u8>& in_params_, std::vector<u8>& out_params_,
|
||||
BehaviorInfo& behavior_info_);
|
||||
~InfoUpdater();
|
||||
|
||||
bool UpdateBehaviorInfo(BehaviorInfo& in_behavior_info);
|
||||
bool UpdateMemoryPools(std::vector<ServerMemoryPoolInfo>& memory_pool_info);
|
||||
bool UpdateVoiceChannelResources(VoiceContext& voice_context);
|
||||
bool UpdateVoices(VoiceContext& voice_context,
|
||||
std::vector<ServerMemoryPoolInfo>& memory_pool_info,
|
||||
VAddr audio_codec_dsp_addr);
|
||||
bool UpdateEffects(EffectContext& effect_context, bool is_active);
|
||||
bool UpdateSplitterInfo(SplitterContext& splitter_context);
|
||||
ResultCode UpdateMixes(MixContext& mix_context, std::size_t mix_buffer_count,
|
||||
SplitterContext& splitter_context, EffectContext& effect_context);
|
||||
bool UpdateSinks(SinkContext& sink_context);
|
||||
bool UpdatePerformanceBuffer();
|
||||
bool UpdateErrorInfo(BehaviorInfo& in_behavior_info);
|
||||
bool UpdateRendererInfo(std::size_t elapsed_frame_count);
|
||||
bool CheckConsumedSize() const;
|
||||
|
||||
bool WriteOutputHeader();
|
||||
|
||||
private:
|
||||
const std::vector<u8>& in_params;
|
||||
std::vector<u8>& out_params;
|
||||
BehaviorInfo& behavior_info;
|
||||
|
||||
AudioCommon::UpdateDataHeader input_header{};
|
||||
AudioCommon::UpdateDataHeader output_header{};
|
||||
|
||||
std::size_t input_offset{sizeof(AudioCommon::UpdateDataHeader)};
|
||||
std::size_t output_offset{sizeof(AudioCommon::UpdateDataHeader)};
|
||||
};
|
||||
|
||||
} // namespace AudioCore
|
||||
61
src/audio_core/memory_pool.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "audio_core/memory_pool.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
ServerMemoryPoolInfo::ServerMemoryPoolInfo() = default;
|
||||
ServerMemoryPoolInfo::~ServerMemoryPoolInfo() = default;
|
||||
|
||||
bool ServerMemoryPoolInfo::Update(const InParams& in_params, OutParams& out_params) {
|
||||
// Our state does not need to be changed
|
||||
if (in_params.state != State::RequestAttach && in_params.state != State::RequestDetach) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Address or size is null
|
||||
if (in_params.address == 0 || in_params.size == 0) {
|
||||
LOG_ERROR(Audio, "Memory pool address or size is zero! address={:X}, size={:X}",
|
||||
in_params.address, in_params.size);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Address or size is not aligned
|
||||
if ((in_params.address % 0x1000) != 0 || (in_params.size % 0x1000) != 0) {
|
||||
LOG_ERROR(Audio, "Memory pool address or size is not aligned! address={:X}, size={:X}",
|
||||
in_params.address, in_params.size);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (in_params.state == State::RequestAttach) {
|
||||
cpu_address = in_params.address;
|
||||
size = in_params.size;
|
||||
used = true;
|
||||
out_params.state = State::Attached;
|
||||
} else {
|
||||
// Unexpected address
|
||||
if (cpu_address != in_params.address) {
|
||||
LOG_ERROR(Audio, "Memory pool address differs! Expecting {:X} but address is {:X}",
|
||||
cpu_address, in_params.address);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (size != in_params.size) {
|
||||
LOG_ERROR(Audio, "Memory pool size differs! Expecting {:X} but size is {:X}", size,
|
||||
in_params.size);
|
||||
return false;
|
||||
}
|
||||
|
||||
cpu_address = 0;
|
||||
size = 0;
|
||||
used = false;
|
||||
out_params.state = State::Detached;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||
52
src/audio_core/memory_pool.h
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/swap.h"
|
||||
|
||||
namespace AudioCore {
|
||||
|
||||
class ServerMemoryPoolInfo {
|
||||
public:
|
||||
ServerMemoryPoolInfo();
|
||||
~ServerMemoryPoolInfo();
|
||||
|
||||
enum class State : u32_le {
|
||||
Invalid = 0x0,
|
||||
Aquired = 0x1,
|
||||
RequestDetach = 0x2,
|
||||
Detached = 0x3,
|
||||
RequestAttach = 0x4,
|
||||
Attached = 0x5,
|
||||
Released = 0x6,
|
||||
};
|
||||
|
||||
struct InParams {
|
||||
u64_le address{};
|
||||
u64_le size{};
|
||||
State state{};
|
||||
INSERT_PADDING_WORDS(3);
|
||||
};
|
||||
static_assert(sizeof(InParams) == 0x20, "InParams are an invalid size");
|
||||
|
||||
struct OutParams {
|
||||
State state{};
|
||||
INSERT_PADDING_WORDS(3);
|
||||
};
|
||||
static_assert(sizeof(OutParams) == 0x10, "OutParams are an invalid size");
|
||||
|
||||
bool Update(const InParams& in_params, OutParams& out_params);
|
||||
|
||||
private:
|
||||
// There's another entry here which is the DSP address, however since we're not talking to the
|
||||
// DSP we can just use the same address provided by the guest without needing to remap
|
||||
u64_le cpu_address{};
|
||||
u64_le size{};
|
||||
bool used{};
|
||||
};
|
||||
|
||||
} // namespace AudioCore
|
||||
296
src/audio_core/mix_context.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
// Copyright 2020 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "audio_core/behavior_info.h"
|
||||
#include "audio_core/common.h"
|
||||
#include "audio_core/effect_context.h"
|
||||
#include "audio_core/mix_context.h"
|
||||
#include "audio_core/splitter_context.h"
|
||||
|
||||
namespace AudioCore {
|
||||
MixContext::MixContext() = default;
|
||||
MixContext::~MixContext() = default;
|
||||
|
||||
void MixContext::Initialize(const BehaviorInfo& behavior_info, std::size_t mix_count,
|
||||
std::size_t effect_count) {
|
||||
info_count = mix_count;
|
||||
infos.resize(info_count);
|
||||
auto& final_mix = GetInfo(AudioCommon::FINAL_MIX);
|
||||
final_mix.GetInParams().mix_id = AudioCommon::FINAL_MIX;
|
||||
sorted_info.reserve(infos.size());
|
||||
for (auto& info : infos) {
|
||||
sorted_info.push_back(&info);
|
||||
}
|
||||
|
||||
for (auto& info : infos) {
|
||||
info.SetEffectCount(effect_count);
|
||||
}
|
||||
|
||||
// Only initialize our edge matrix and node states if splitters are supported
|
||||
if (behavior_info.IsSplitterSupported()) {
|
||||
node_states.Initialize(mix_count);
|
||||
edge_matrix.Initialize(mix_count);
|
||||
}
|
||||
}
|
||||
|
||||
void MixContext::UpdateDistancesFromFinalMix() {
|
||||
// Set all distances to be invalid
|
||||
for (std::size_t i = 0; i < info_count; i++) {
|
||||
GetInfo(i).GetInParams().final_mix_distance = AudioCommon::NO_FINAL_MIX;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < info_count; i++) {
|
||||
auto& info = GetInfo(i);
|
||||
auto& in_params = info.GetInParams();
|
||||
// Populate our sorted info
|
||||
sorted_info[i] = &info;
|
||||
|
||||
if (!in_params.in_use) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto mix_id = in_params.mix_id;
|
||||
// Needs to be referenced out of scope
|
||||
s32 distance_to_final_mix{AudioCommon::FINAL_MIX};
|
||||
for (; distance_to_final_mix < static_cast<s32>(info_count); distance_to_final_mix++) {
|
||||
if (mix_id == AudioCommon::FINAL_MIX) {
|
||||
// If we're at the final mix, we're done
|
||||
break;
|
||||
} else if (mix_id == AudioCommon::NO_MIX) {
|
||||
// If we have no more mix ids, we're done
|
||||
distance_to_final_mix = AudioCommon::NO_FINAL_MIX;
|
||||
break;
|
||||
} else {
|
||||
const auto& dest_mix = GetInfo(mix_id);
|
||||
const auto dest_mix_distance = dest_mix.GetInParams().final_mix_distance;
|
||||
|
||||
if (dest_mix_distance == AudioCommon::NO_FINAL_MIX) {
|
||||
// If our current mix isn't pointing to a final mix, follow through
|
||||
mix_id = dest_mix.GetInParams().dest_mix_id;
|
||||
} else {
|
||||
// Our current mix + 1 = final distance
|
||||
distance_to_final_mix = dest_mix_distance + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we're out of range for our distance, mark it as no final mix
|
||||
if (distance_to_final_mix >= static_cast<s32>(info_count)) {
|
||||
distance_to_final_mix = AudioCommon::NO_FINAL_MIX;
|
||||
}
|
||||
|
||||
in_params.final_mix_distance = distance_to_final_mix;
|
||||
}
|
||||
}
|
||||
|
||||
void MixContext::CalcMixBufferOffset() {
|
||||
s32 offset{};
|
||||
for (std::size_t i = 0; i < info_count; i++) {
|
||||
auto& info = GetSortedInfo(i);
|
||||
auto& in_params = info.GetInParams();
|
||||
if (in_params.in_use) {
|
||||
// Only update if in use
|
||||
in_params.buffer_offset = offset;
|
||||
offset += in_params.buffer_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MixContext::SortInfo() {
|
||||
// Get the distance to the final mix
|
||||
UpdateDistancesFromFinalMix();
|
||||
|
||||
// Sort based on the distance to the final mix
|
||||
std::sort(sorted_info.begin(), sorted_info.end(),
|
||||
[](const ServerMixInfo* lhs, const ServerMixInfo* rhs) {
|
||||
return lhs->GetInParams().final_mix_distance >
|
||||
rhs->GetInParams().final_mix_distance;
|
||||
});
|
||||
|
||||
// Calculate the mix buffer offset
|
||||
CalcMixBufferOffset();
|
||||
}
|
||||
|
||||
bool MixContext::TsortInfo(SplitterContext& splitter_context) {
|
||||
// If we're not using mixes, just calculate the mix buffer offset
|
||||
if (!splitter_context.UsingSplitter()) {
|
||||
CalcMixBufferOffset();
|
||||
return true;
|
||||
}
|
||||
// Sort our node states
|
||||
if (!node_states.Tsort(edge_matrix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get our sorted list
|
||||
const auto sorted_list = node_states.GetIndexList();
|
||||
std::size_t info_id{};
|
||||
for (auto itr = sorted_list.rbegin(); itr != sorted_list.rend(); ++itr) {
|
||||
// Set our sorted info
|
||||
sorted_info[info_id++] = &GetInfo(*itr);
|
||||
}
|
||||
|
||||
// Calculate the mix buffer offset
|
||||
CalcMixBufferOffset();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::size_t MixContext::GetCount() const {
|
||||
return info_count;
|
||||
}
|
||||
|
||||
ServerMixInfo& MixContext::GetInfo(std::size_t i) {
|
||||
ASSERT(i < info_count);
|
||||
return infos.at(i);
|
||||
}
|
||||
|
||||
const ServerMixInfo& MixContext::GetInfo(std::size_t i) const {
|
||||
ASSERT(i < info_count);
|
||||
return infos.at(i);
|
||||
}
|
||||
|
||||
ServerMixInfo& MixContext::GetSortedInfo(std::size_t i) {
|
||||
ASSERT(i < info_count);
|
||||
return *sorted_info.at(i);
|
||||
}
|
||||
|
||||
const ServerMixInfo& MixContext::GetSortedInfo(std::size_t i) const {
|
||||
ASSERT(i < info_count);
|
||||
return *sorted_info.at(i);
|
||||
}
|
||||
|
||||
ServerMixInfo& MixContext::GetFinalMixInfo() {
|
||||
return infos.at(AudioCommon::FINAL_MIX);
|
||||
}
|
||||
|
||||
const ServerMixInfo& MixContext::GetFinalMixInfo() const {
|
||||
return infos.at(AudioCommon::FINAL_MIX);
|
||||
}
|
||||
|
||||
EdgeMatrix& MixContext::GetEdgeMatrix() {
|
||||
return edge_matrix;
|
||||
}
|
||||
|
||||
const EdgeMatrix& MixContext::GetEdgeMatrix() const {
|
||||
return edge_matrix;
|
||||
}
|
||||
|
||||
ServerMixInfo::ServerMixInfo() {
|
||||
Cleanup();
|
||||
}
|
||||
ServerMixInfo::~ServerMixInfo() = default;
|
||||
|
||||
const ServerMixInfo::InParams& ServerMixInfo::GetInParams() const {
|
||||
return in_params;
|
||||
}
|
||||
|
||||
ServerMixInfo::InParams& ServerMixInfo::GetInParams() {
|
||||
return in_params;
|
||||
}
|
||||
|
||||
bool ServerMixInfo::Update(EdgeMatrix& edge_matrix, const MixInfo::InParams& mix_in,
|
||||
BehaviorInfo& behavior_info, SplitterContext& splitter_context,
|
||||
EffectContext& effect_context) {
|
||||
in_params.volume = mix_in.volume;
|
||||
in_params.sample_rate = mix_in.sample_rate;
|
||||
in_params.buffer_count = mix_in.buffer_count;
|
||||
in_params.in_use = mix_in.in_use;
|
||||
in_params.mix_id = mix_in.mix_id;
|
||||
in_params.node_id = mix_in.node_id;
|
||||
for (std::size_t i = 0; i < mix_in.mix_volume.size(); i++) {
|
||||
std::copy(mix_in.mix_volume[i].begin(), mix_in.mix_volume[i].end(),
|
||||
in_params.mix_volume[i].begin());
|
||||
}
|
||||
|
||||
bool require_sort = false;
|
||||
|
||||
if (behavior_info.IsSplitterSupported()) {
|
||||
require_sort = UpdateConnection(edge_matrix, mix_in, splitter_context);
|
||||
} else {
|
||||
in_params.dest_mix_id = mix_in.dest_mix_id;
|
||||
in_params.splitter_id = AudioCommon::NO_SPLITTER;
|
||||
}
|
||||
|
||||
ResetEffectProcessingOrder();
|
||||
const auto effect_count = effect_context.GetCount();
|
||||
for (std::size_t i = 0; i < effect_count; i++) {
|
||||
auto* effect_info = effect_context.GetInfo(i);
|
||||
if (effect_info->GetMixID() == in_params.mix_id) {
|
||||
effect_processing_order[effect_info->GetProcessingOrder()] = static_cast<s32>(i);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(ogniK): Update effect processing order
|
||||
return require_sort;
|
||||
}
|
||||
|
||||
bool ServerMixInfo::HasAnyConnection() const {
|
||||
return in_params.splitter_id != AudioCommon::NO_SPLITTER ||
|
||||
in_params.mix_id != AudioCommon::NO_MIX;
|
||||
}
|
||||
|
||||
void ServerMixInfo::Cleanup() {
|
||||
in_params.volume = 0.0f;
|
||||
in_params.sample_rate = 0;
|
||||
in_params.buffer_count = 0;
|
||||
in_params.in_use = false;
|
||||
in_params.mix_id = AudioCommon::NO_MIX;
|
||||
in_params.node_id = 0;
|
||||
in_params.buffer_offset = 0;
|
||||
in_params.dest_mix_id = AudioCommon::NO_MIX;
|
||||
in_params.splitter_id = AudioCommon::NO_SPLITTER;
|
||||
std::memset(in_params.mix_volume.data(), 0, sizeof(float) * in_params.mix_volume.size());
|
||||
}
|
||||
|
||||
void ServerMixInfo::SetEffectCount(std::size_t count) {
|
||||
effect_processing_order.resize(count);
|
||||
ResetEffectProcessingOrder();
|
||||
}
|
||||
|
||||
void ServerMixInfo::ResetEffectProcessingOrder() {
|
||||
for (auto& order : effect_processing_order) {
|
||||
order = AudioCommon::NO_EFFECT_ORDER;
|
||||
}
|
||||
}
|
||||
|
||||
s32 ServerMixInfo::GetEffectOrder(std::size_t i) const {
|
||||
return effect_processing_order.at(i);
|
||||
}
|
||||
|
||||
bool ServerMixInfo::UpdateConnection(EdgeMatrix& edge_matrix, const MixInfo::InParams& mix_in,
|
||||
SplitterContext& splitter_context) {
|
||||
// Mixes are identical
|
||||
if (in_params.dest_mix_id == mix_in.dest_mix_id &&
|
||||
in_params.splitter_id == mix_in.splitter_id &&
|
||||
((in_params.splitter_id == AudioCommon::NO_SPLITTER) ||
|
||||
!splitter_context.GetInfo(in_params.splitter_id).HasNewConnection())) {
|
||||
return false;
|
||||
}
|
||||
// Remove current edges for mix id
|
||||
edge_matrix.RemoveEdges(in_params.mix_id);
|
||||
if (mix_in.dest_mix_id != AudioCommon::NO_MIX) {
|
||||
// If we have a valid destination mix id, set our edge matrix
|
||||
edge_matrix.Connect(in_params.mix_id, mix_in.dest_mix_id);
|
||||
} else if (mix_in.splitter_id != AudioCommon::NO_SPLITTER) {
|
||||
// Recurse our splitter linked and set our edges
|
||||
auto& splitter_info = splitter_context.GetInfo(mix_in.splitter_id);
|
||||
const auto length = splitter_info.GetLength();
|
||||
for (s32 i = 0; i < length; i++) {
|
||||
const auto* splitter_destination =
|
||||
splitter_context.GetDestinationData(mix_in.splitter_id, i);
|
||||
if (splitter_destination == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (splitter_destination->ValidMixId()) {
|
||||
edge_matrix.Connect(in_params.mix_id, splitter_destination->GetMixId());
|
||||
}
|
||||
}
|
||||
}
|
||||
in_params.dest_mix_id = mix_in.dest_mix_id;
|
||||
in_params.splitter_id = mix_in.splitter_id;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace AudioCore
|
||||