summaryrefslogtreecommitdiffstats
path: root/third_party/rust/audio-mixer
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/audio-mixer')
-rw-r--r--third_party/rust/audio-mixer/.cargo-checksum.json2
-rw-r--r--third_party/rust/audio-mixer/Cargo.lock207
-rw-r--r--third_party/rust/audio-mixer/Cargo.toml2
-rw-r--r--third_party/rust/audio-mixer/src/channel.rs4
-rw-r--r--third_party/rust/audio-mixer/src/coefficient.rs239
5 files changed, 255 insertions, 199 deletions
diff --git a/third_party/rust/audio-mixer/.cargo-checksum.json b/third_party/rust/audio-mixer/.cargo-checksum.json
index 4fbdd1518d..9872eab023 100644
--- a/third_party/rust/audio-mixer/.cargo-checksum.json
+++ b/third_party/rust/audio-mixer/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.lock":"ac8d6a7af46ee8f72d22abb80575109b75bcb2a20ea6cacb6626a20f337fe51f","Cargo.toml":"9316753099606b9531ea52aec87270a83e74c15b6563f8f979b0e961e0cf73fd","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"e2e6b7d80550743e01faa26c19f6c8520fd0dc5db68021c042fd523eed46c799","benches/benchmark.rs":"33e9d85cee38fb7752e9315ccf5f816179309062bfb78118288f7e1495e3616f","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_sanitizers.sh":"e31b4a11559b52043920c63e6ad4e57051d6205883ecf2b2c48e105ba522015b","run_tests.sh":"21ca30cb6d41c6b35e6207e3283292933ef6628575dd587287fad6db2afb22bd","src/channel.rs":"d948d890219b810632277d2b04297334a47dc6639ef93309e74495ff408f82b6","src/coefficient.rs":"24f56281a1b800769feefc735d77c2ec03f1aa8d7c58c256b25ce1a9053a06cc","src/lib.rs":"f0ee59ac224ce6ba0cc6cb9e1796e85b9b751ba4d92c58fe3fb8b10c95b72cc4","src/main.rs":"b5ba05638c727040581c49ffd2d784493af658495cd424ce8c9365f779994baf"},"package":"c41dc008c1973ce58ff3cfc52df53814a9b7b78d73d95b071b5ff0ed4b2db3e1"} \ No newline at end of file
+{"files":{"Cargo.lock":"819b29d15e418e551415a161f56eee3d2848f4e2e0936a4d8f3d4be11d2ef598","Cargo.toml":"b3de055f40a2d1895630310c8b41d7dd86fcd99b5c719f625e5ddaa9c2a3775d","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"e2e6b7d80550743e01faa26c19f6c8520fd0dc5db68021c042fd523eed46c799","benches/benchmark.rs":"33e9d85cee38fb7752e9315ccf5f816179309062bfb78118288f7e1495e3616f","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_sanitizers.sh":"e31b4a11559b52043920c63e6ad4e57051d6205883ecf2b2c48e105ba522015b","run_tests.sh":"21ca30cb6d41c6b35e6207e3283292933ef6628575dd587287fad6db2afb22bd","src/channel.rs":"243a51c37d07755b67bcce54ca2a27e0f3099b4ea510a7b7e60c4b3f17402167","src/coefficient.rs":"64a6cda5fc8630f033c80717616183f6e172da5fd2d338028e52f77d8b7e0830","src/lib.rs":"f0ee59ac224ce6ba0cc6cb9e1796e85b9b751ba4d92c58fe3fb8b10c95b72cc4","src/main.rs":"b5ba05638c727040581c49ffd2d784493af658495cd424ce8c9365f779994baf"},"package":"4f1245ab2f85c284bac1ac1f03565539644566295ef6eb9c4eae42e9a40c51b2"} \ No newline at end of file
diff --git a/third_party/rust/audio-mixer/Cargo.lock b/third_party/rust/audio-mixer/Cargo.lock
index 68d1ba2441..ac92b80559 100644
--- a/third_party/rust/audio-mixer/Cargo.lock
+++ b/third_party/rust/audio-mixer/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "aho-corasick"
-version = "1.1.0"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
@@ -17,14 +17,14 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
- "hermit-abi 0.1.19",
+ "hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "audio-mixer"
-version = "0.1.3"
+version = "0.2.0"
dependencies = [
"bitflags",
"criterion",
@@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "autocfg"
-version = "1.1.0"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]]
name = "bitflags"
@@ -45,9 +45,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
-version = "3.14.0"
+version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
+checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "cast"
@@ -109,53 +109,35 @@ dependencies = [
]
[[package]]
-name = "crossbeam-channel"
-version = "0.5.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
-dependencies = [
- "cfg-if",
- "crossbeam-utils",
-]
-
-[[package]]
name = "crossbeam-deque"
-version = "0.8.3"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
+checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
- "cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
-version = "0.9.15"
+version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
+checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
- "autocfg",
- "cfg-if",
"crossbeam-utils",
- "memoffset",
- "scopeguard",
]
[[package]]
name = "crossbeam-utils"
-version = "0.8.16"
+version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
-dependencies = [
- "cfg-if",
-]
+checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "csv"
-version = "1.2.2"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086"
+checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe"
dependencies = [
"csv-core",
"itoa",
@@ -165,18 +147,18 @@ dependencies = [
[[package]]
name = "csv-core"
-version = "0.1.10"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
+checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70"
dependencies = [
"memchr",
]
[[package]]
name = "either"
-version = "1.9.0"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
[[package]]
name = "float-cmp"
@@ -189,9 +171,9 @@ dependencies = [
[[package]]
name = "half"
-version = "1.8.2"
+version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
+checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
[[package]]
name = "hermit-abi"
@@ -203,12 +185,6 @@ dependencies = [
]
[[package]]
-name = "hermit-abi"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
-
-[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -219,15 +195,15 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.9"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
+checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "js-sys"
-version = "0.3.64"
+version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
+checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
dependencies = [
"wasm-bindgen",
]
@@ -240,55 +216,36 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.148"
+version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "log"
-version = "0.4.20"
+version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "memchr"
-version = "2.6.3"
+version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
-
-[[package]]
-name = "memoffset"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
-dependencies = [
- "autocfg",
-]
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "num-traits"
-version = "0.2.16"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
+checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
-name = "num_cpus"
-version = "1.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
-dependencies = [
- "hermit-abi 0.3.2",
- "libc",
-]
-
-[[package]]
name = "once_cell"
-version = "1.18.0"
+version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "oorandom"
@@ -326,27 +283,27 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.67"
+version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
+checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.33"
+version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rayon"
-version = "1.7.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
+checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
@@ -354,21 +311,19 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.11.0"
+version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
+checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
- "crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
- "num_cpus",
]
[[package]]
name = "regex"
-version = "1.9.5"
+version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
+checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
@@ -378,9 +333,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.3.8"
+version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
+checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
@@ -389,15 +344,15 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.7.5"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
+checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "ryu"
-version = "1.0.15"
+version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
+checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "same-file"
@@ -409,16 +364,10 @@ dependencies = [
]
[[package]]
-name = "scopeguard"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-
-[[package]]
name = "serde"
-version = "1.0.188"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
+checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
@@ -435,9 +384,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.188"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
+checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
@@ -446,9 +395,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.107"
+version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
+checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
dependencies = [
"itoa",
"ryu",
@@ -457,9 +406,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.37"
+version = "2.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
+checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a"
dependencies = [
"proc-macro2",
"quote",
@@ -493,15 +442,15 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-width"
-version = "0.1.10"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "walkdir"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
"winapi-util",
@@ -509,9 +458,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
-version = "0.2.87"
+version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
+checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -519,9 +468,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.87"
+version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
+checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
dependencies = [
"bumpalo",
"log",
@@ -534,9 +483,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.87"
+version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
+checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -544,9 +493,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.87"
+version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
+checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
@@ -557,15 +506,15 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.87"
+version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
+checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
[[package]]
name = "web-sys"
-version = "0.3.64"
+version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
+checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -589,9 +538,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
dependencies = [
"winapi",
]
diff --git a/third_party/rust/audio-mixer/Cargo.toml b/third_party/rust/audio-mixer/Cargo.toml
index 92293f25db..703d89bd23 100644
--- a/third_party/rust/audio-mixer/Cargo.toml
+++ b/third_party/rust/audio-mixer/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "audio-mixer"
-version = "0.1.3"
+version = "0.2.0"
authors = ["Chun-Min Chang <chun.m.chang@gmail.com>"]
description = "Mixing audio by the input and output channel layout"
readme = "README.md"
diff --git a/third_party/rust/audio-mixer/src/channel.rs b/third_party/rust/audio-mixer/src/channel.rs
index b32936895e..d913df39e8 100644
--- a/third_party/rust/audio-mixer/src/channel.rs
+++ b/third_party/rust/audio-mixer/src/channel.rs
@@ -21,6 +21,7 @@ pub enum Channel {
TopBackCenter = 16,
TopBackRight = 17,
Silence = 18,
+ Discrete = 19, // To be used based on its index
}
impl Channel {
@@ -29,7 +30,7 @@ impl Channel {
}
pub const fn count() -> usize {
- Channel::Silence as usize + 1
+ Channel::Discrete as usize + 1
}
pub const fn bitmask(self) -> u32 {
@@ -58,6 +59,7 @@ bitflags! {
const TOP_BACK_CENTER = Channel::TopBackCenter.bitmask();
const TOP_BACK_RIGHT = Channel::TopBackRight.bitmask();
const SILENCE = Channel::Silence.bitmask();
+ const DISCRETE = Channel::Discrete.bitmask();
}
}
diff --git a/third_party/rust/audio-mixer/src/coefficient.rs b/third_party/rust/audio-mixer/src/coefficient.rs
index 799d50289c..c7999ee929 100644
--- a/third_party/rust/audio-mixer/src/coefficient.rs
+++ b/third_party/rust/audio-mixer/src/coefficient.rs
@@ -9,7 +9,7 @@ const CHANNELS: usize = Channel::count();
#[derive(Debug)]
enum Error {
- DuplicateNonSilenceChannel,
+ DuplicateChannel,
AsymmetricChannels,
}
@@ -28,13 +28,15 @@ impl ChannelLayout {
})
}
- // Except Silence channel, the duplicate channels are not allowed.
+ // Except Silence and Discrete channels, duplicate channels aren't allowed.
fn get_channel_map(channels: &[Channel]) -> Result<ChannelMap, Error> {
let mut map = ChannelMap::empty();
for channel in channels {
let bitmask = ChannelMap::from(*channel);
- if channel != &Channel::Silence && map.contains(bitmask) {
- return Err(Error::DuplicateNonSilenceChannel);
+ if (channel != &Channel::Silence && channel != &Channel::Discrete)
+ && map.contains(bitmask)
+ {
+ return Err(Error::DuplicateChannel);
}
map.insert(bitmask);
}
@@ -83,15 +85,41 @@ where
let input_layout = ChannelLayout::new(input_channels).expect("Invalid input layout");
let output_layout = ChannelLayout::new(output_channels).expect("Invalid output layout");
- let mixing_matrix =
- Self::build_mixing_matrix(input_layout.channel_map, output_layout.channel_map)
- .unwrap_or_else(|_| Self::get_basic_matrix());
-
- let coefficient_matrix = Self::pick_coefficients(
- &input_layout.channels,
- &output_layout.channels,
- &mixing_matrix,
- );
+ // Check if this is a professional audio interface rather than a sound card for playback, in
+ // which case it is expected to simply pass all the channel through without change.
+ // Those interfaces only have an explicit mapping for the stereo pair, but have lots of channels.
+ let mut only_stereo_or_discrete = true;
+ for channel in output_channels {
+ if *channel != Channel::Discrete
+ && *channel != Channel::FrontLeft
+ && *channel != Channel::FrontRight
+ {
+ only_stereo_or_discrete = false;
+ break;
+ }
+ }
+ let coefficient_matrix = if only_stereo_or_discrete && output_channels.len() > 2 {
+ let mut matrix = Vec::with_capacity(output_channels.len());
+ // Create a diagonal line of 1.0 for input channels
+ for (output_channel_index, _) in output_channels.iter().enumerate() {
+ let mut coefficients = Vec::with_capacity(input_channels.len());
+ coefficients.resize(input_channels.len(), 0.0);
+ if output_channel_index < coefficients.len() {
+ coefficients[output_channel_index] = 1.0;
+ }
+ matrix.push(coefficients);
+ }
+ matrix
+ } else {
+ let mixing_matrix =
+ Self::build_mixing_matrix(input_layout.channel_map, output_layout.channel_map)
+ .unwrap_or_else(|_| Self::get_basic_matrix());
+ Self::pick_coefficients(
+ &input_layout.channels,
+ &output_layout.channels,
+ &mixing_matrix,
+ )
+ };
let normalized_matrix = Self::normalize(T::max_coefficients_sum(), coefficient_matrix);
@@ -430,7 +458,7 @@ impl MixingCoefficient for f32 {
type Coef = f32;
fn max_coefficients_sum() -> f64 {
- f64::from(std::i32::MAX)
+ f64::from(i32::MAX)
}
fn coefficient_from_f64(value: f64) -> Self::Coef {
@@ -550,12 +578,12 @@ mod test {
#[test]
fn test_create_with_duplicate_silience_channels_f32() {
- test_create_with_duplicate_silience_channels::<f32>()
+ test_create_with_duplicate_channels::<f32>()
}
#[test]
fn test_create_with_duplicate_silience_channels_i16() {
- test_create_with_duplicate_silience_channels::<i16>()
+ test_create_with_duplicate_channels::<i16>()
}
#[test]
@@ -582,7 +610,7 @@ mod test {
test_create_with_duplicate_output_channels::<i16>()
}
- fn test_create_with_duplicate_silience_channels<T>()
+ fn test_create_with_duplicate_channels<T>()
where
T: MixingCoefficient,
T::Coef: Copy,
@@ -649,78 +677,155 @@ mod test {
}
#[test]
- fn test_get_redirect_matrix_f32() {
- test_get_redirect_matrix::<f32>();
+ fn test_get_discrete_mapping() {
+ test_get_discrete_mapping_matrix::<f32>();
+ test_get_discrete_mapping_matrix::<i16>();
}
#[test]
- fn test_get_redirect_matrix_i16() {
- test_get_redirect_matrix::<i16>();
+ fn test_get_discrete_mapping_too_many_channels() {
+ test_get_discrete_mapping_matrix_too_many_channels::<i16>();
+ test_get_discrete_mapping_matrix_too_many_channels::<f32>();
}
- fn test_get_redirect_matrix<T>()
- where
+ #[test]
+ fn test_get_regular_mapping_too_many_channels() {
+ test_get_regular_mapping_matrix_too_many_channels::<i16>();
+ test_get_regular_mapping_matrix_too_many_channels::<f32>();
+ }
+
+ // Check that a matrix is diagonal (1.0 on the diagnoal, 0.0 elsewhere). It's valid to have more input or output channels
+ fn assert_is_diagonal<T>(
+ coefficients: &Coefficient<T>,
+ input_channels: usize,
+ output_channels: usize,
+ ) where
T: MixingCoefficient,
T::Coef: Copy + Debug + PartialEq,
{
- // Create a matrix that only redirect the channels from input side to output side,
- // without mixing input audio data to output audio data.
- fn compute_redirect_matrix<T>(
- input_channels: &[Channel],
- output_channels: &[Channel],
- ) -> Vec<Vec<T::Coef>>
- where
- T: MixingCoefficient,
- {
- let mut matrix = Vec::with_capacity(output_channels.len());
- for output_channel in output_channels {
- let mut row = Vec::with_capacity(input_channels.len());
- for input_channel in input_channels {
- row.push(
- if input_channel != output_channel
- || input_channel == &Channel::Silence
- || output_channel == &Channel::Silence
- {
- 0.0
- } else {
- 1.0
- },
- );
+ for i in 0..input_channels {
+ for j in 0..output_channels {
+ if i == j {
+ assert_eq!(coefficients.get(i, j), T::coefficient_from_f64(1.0));
+ } else {
+ assert_eq!(coefficients.get(i, j), T::coefficient_from_f64(0.0));
}
- matrix.push(row);
}
-
- // Convert the type of the coefficients from f64 to T::Coef.
- matrix
- .into_iter()
- .map(|row| row.into_iter().map(T::coefficient_from_f64).collect())
- .collect()
}
+ println!(
+ "{:?} = {:?} * {:?}",
+ output_channels, coefficients.matrix, input_channels
+ );
+ }
+ fn test_get_discrete_mapping_matrix<T>()
+ where
+ T: MixingCoefficient,
+ T::Coef: Copy + Debug + PartialEq,
+ {
+ // typical 5.1
let input_channels = [
Channel::FrontLeft,
- Channel::Silence,
Channel::FrontRight,
Channel::FrontCenter,
+ Channel::BackLeft,
+ Channel::BackRight,
+ Channel::LowFrequency,
];
+ // going into 8 channels with a tagged stereo pair and discrete channels
let output_channels = [
- Channel::Silence,
Channel::FrontLeft,
- Channel::Silence,
+ Channel::FrontRight,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ ];
+
+ // Get a pass-through matrix in the first 6 channels
+ let coefficients = Coefficient::<T>::create(&input_channels, &output_channels);
+ assert_is_diagonal::<T>(&coefficients, input_channels.len(), output_channels.len());
+ }
+
+ fn test_get_discrete_mapping_matrix_too_many_channels<T>()
+ where
+ T: MixingCoefficient,
+ T::Coef: Copy + Debug + PartialEq,
+ {
+ // 5.1.4
+ let input_channels = [
+ Channel::FrontLeft,
+ Channel::FrontRight,
Channel::FrontCenter,
- Channel::BackCenter,
+ Channel::LowFrequency,
+ Channel::FrontLeftOfCenter,
+ Channel::FrontRightOfCenter,
+ Channel::TopFrontLeft,
+ Channel::TopFrontRight,
+ Channel::BackLeft,
+ Channel::BackRight,
+ ];
+ // going into 8 channels with a tagged stereo pair and discrete channels
+ let output_channels = [
+ Channel::FrontLeft,
+ Channel::FrontRight,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
+ Channel::Discrete,
];
- // Get a redirect matrix since the output layout is asymmetric.
- let coefficient = Coefficient::<T>::create(&input_channels, &output_channels);
+ // First 8 channels are to be played, last two are to be dropped.
+ let coefficients = Coefficient::<T>::create(&input_channels, &output_channels);
+ assert_is_diagonal(&coefficients, input_channels.len(), output_channels.len());
+ }
+
+ fn test_get_regular_mapping_matrix_too_many_channels<T>()
+ where
+ T: MixingCoefficient,
+ T::Coef: Copy + Debug + PartialEq,
+ {
+ // 5.1.4
+ let input_channels = [
+ Channel::FrontLeft,
+ Channel::FrontRight,
+ Channel::FrontCenter,
+ Channel::LowFrequency,
+ Channel::FrontLeftOfCenter,
+ Channel::FrontRightOfCenter,
+ Channel::TopFrontLeft,
+ Channel::TopFrontRight,
+ Channel::BackLeft,
+ Channel::BackRight,
+ ];
+ // going into a regular 5.1 sound card
+ let output_channels = [
+ Channel::FrontLeft,
+ Channel::FrontRight,
+ Channel::FrontCenter,
+ Channel::LowFrequency,
+ Channel::BackLeft,
+ Channel::BackRight,
+ ];
- let expected = compute_redirect_matrix::<T>(&input_channels, &output_channels);
- assert_eq!(coefficient.matrix, expected);
+ let coefficients = Coefficient::<T>::create(&input_channels, &output_channels);
- println!(
- "{:?} = {:?} * {:?}",
- output_channels, coefficient.matrix, input_channels
- );
+ // Non-unity gain non-silence coefficients must be present when down mixing.
+ let mut found_non_unity_non_silence = false;
+ for row in coefficients.matrix.iter() {
+ for coeff in row.iter() {
+ if T::coefficient_from_f64(1.0) != *coeff || T::coefficient_from_f64(0.0) != *coeff
+ {
+ found_non_unity_non_silence = true;
+ break;
+ }
+ }
+ }
+ assert!(found_non_unity_non_silence);
}
#[test]
@@ -732,7 +837,7 @@ mod test {
vec![4.0_f64, 6.0_f64, 10.0_f64],
];
- let mut max_row_sum: f64 = std::f64::MIN;
+ let mut max_row_sum: f64 = f64::MIN;
for row in &m {
max_row_sum = max_row_sum.max(row.iter().sum());
}
@@ -746,7 +851,7 @@ mod test {
let smaller_max = max_row_sum - 0.5_f64;
assert!(smaller_max > 0.0_f64);
let n = Coefficient::<f32>::normalize(smaller_max, m);
- let mut max_row_sum: f64 = std::f64::MIN;
+ let mut max_row_sum: f64 = f64::MIN;
for row in &n {
max_row_sum = max_row_sum.max(row.iter().sum());
assert!(row.iter().sum::<f64>() <= smaller_max);