A (planned) collection of lightweight tools for streaming.

refactor: move mic data to core

* add fonts

+682 -32
Cargo.lock
··· 155 155 ] 156 156 157 157 [[package]] 158 + name = "ashpd" 159 + version = "0.11.0" 160 + source = "registry+https://github.com/rust-lang/crates.io-index" 161 + checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df" 162 + dependencies = [ 163 + "async-fs", 164 + "async-net", 165 + "enumflags2", 166 + "futures-channel", 167 + "futures-util", 168 + "rand 0.9.2", 169 + "raw-window-handle", 170 + "serde", 171 + "serde_repr", 172 + "url", 173 + "wayland-backend", 174 + "wayland-client", 175 + "wayland-protocols", 176 + "zbus 5.12.0", 177 + ] 178 + 179 + [[package]] 158 180 name = "async-broadcast" 159 181 version = "0.7.2" 160 182 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 233 255 ] 234 256 235 257 [[package]] 258 + name = "async-net" 259 + version = "2.0.0" 260 + source = "registry+https://github.com/rust-lang/crates.io-index" 261 + checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" 262 + dependencies = [ 263 + "async-io", 264 + "blocking", 265 + "futures-lite", 266 + ] 267 + 268 + [[package]] 236 269 name = "async-process" 237 270 version = "2.5.0" 238 271 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 363 396 checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" 364 397 dependencies = [ 365 398 "objc2 0.5.2", 399 + ] 400 + 401 + [[package]] 402 + name = "block2" 403 + version = "0.6.2" 404 + source = "registry+https://github.com/rust-lang/crates.io-index" 405 + checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" 406 + dependencies = [ 407 + "objc2 0.6.3", 366 408 ] 367 409 368 410 [[package]] ··· 525 567 checksum = "9b7f4aaa047ba3c3630b080bb9860894732ff23e2aee290a418909aa6d5df38f" 526 568 dependencies = [ 527 569 "objc2 0.5.2", 528 - "objc2-app-kit", 570 + "objc2-app-kit 0.2.2", 529 571 "objc2-foundation 0.2.2", 530 572 ] 531 573 ··· 846 888 "rust-ini", 847 889 "web-sys", 848 890 "winreg", 849 - "zbus", 891 + "zbus 4.4.0", 850 892 ] 851 893 852 894 [[package]] ··· 931 973 checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" 932 974 dependencies = [ 933 975 "bitflags 2.10.0", 976 + "block2 0.6.2", 977 + "libc", 934 978 "objc2 0.6.3", 979 + ] 980 + 981 + [[package]] 982 + name = "displaydoc" 983 + version = "0.2.5" 984 + source = "registry+https://github.com/rust-lang/crates.io-index" 985 + checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" 986 + dependencies = [ 987 + "proc-macro2", 988 + "quote", 989 + "syn 2.0.111", 935 990 ] 936 991 937 992 [[package]] ··· 1148 1203 ] 1149 1204 1150 1205 [[package]] 1206 + name = "float_next_after" 1207 + version = "1.0.0" 1208 + source = "registry+https://github.com/rust-lang/crates.io-index" 1209 + checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" 1210 + 1211 + [[package]] 1151 1212 name = "font-types" 1152 1213 version = "0.7.3" 1153 1214 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1207 1268 checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" 1208 1269 1209 1270 [[package]] 1271 + name = "form_urlencoded" 1272 + version = "1.2.2" 1273 + source = "registry+https://github.com/rust-lang/crates.io-index" 1274 + checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" 1275 + dependencies = [ 1276 + "percent-encoding", 1277 + ] 1278 + 1279 + [[package]] 1210 1280 name = "futures" 1211 1281 version = "0.3.31" 1212 1282 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1609 1679 "image", 1610 1680 "kamadak-exif", 1611 1681 "log", 1682 + "lyon_path", 1612 1683 "once_cell", 1613 1684 "raw-window-handle", 1614 1685 "rustc-hash 2.1.1", ··· 1672 1743 "iced_glyphon", 1673 1744 "iced_graphics", 1674 1745 "log", 1746 + "lyon", 1675 1747 "once_cell", 1676 1748 "rustc-hash 2.1.1", 1677 1749 "thiserror 1.0.69", ··· 1714 1786 ] 1715 1787 1716 1788 [[package]] 1789 + name = "icu_collections" 1790 + version = "2.1.1" 1791 + source = "registry+https://github.com/rust-lang/crates.io-index" 1792 + checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" 1793 + dependencies = [ 1794 + "displaydoc", 1795 + "potential_utf", 1796 + "yoke", 1797 + "zerofrom", 1798 + "zerovec", 1799 + ] 1800 + 1801 + [[package]] 1802 + name = "icu_locale_core" 1803 + version = "2.1.1" 1804 + source = "registry+https://github.com/rust-lang/crates.io-index" 1805 + checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" 1806 + dependencies = [ 1807 + "displaydoc", 1808 + "litemap", 1809 + "tinystr", 1810 + "writeable", 1811 + "zerovec", 1812 + ] 1813 + 1814 + [[package]] 1815 + name = "icu_normalizer" 1816 + version = "2.1.1" 1817 + source = "registry+https://github.com/rust-lang/crates.io-index" 1818 + checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" 1819 + dependencies = [ 1820 + "icu_collections", 1821 + "icu_normalizer_data", 1822 + "icu_properties", 1823 + "icu_provider", 1824 + "smallvec", 1825 + "zerovec", 1826 + ] 1827 + 1828 + [[package]] 1829 + name = "icu_normalizer_data" 1830 + version = "2.1.1" 1831 + source = "registry+https://github.com/rust-lang/crates.io-index" 1832 + checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" 1833 + 1834 + [[package]] 1835 + name = "icu_properties" 1836 + version = "2.1.1" 1837 + source = "registry+https://github.com/rust-lang/crates.io-index" 1838 + checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" 1839 + dependencies = [ 1840 + "icu_collections", 1841 + "icu_locale_core", 1842 + "icu_properties_data", 1843 + "icu_provider", 1844 + "zerotrie", 1845 + "zerovec", 1846 + ] 1847 + 1848 + [[package]] 1849 + name = "icu_properties_data" 1850 + version = "2.1.1" 1851 + source = "registry+https://github.com/rust-lang/crates.io-index" 1852 + checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" 1853 + 1854 + [[package]] 1855 + name = "icu_provider" 1856 + version = "2.1.1" 1857 + source = "registry+https://github.com/rust-lang/crates.io-index" 1858 + checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" 1859 + dependencies = [ 1860 + "displaydoc", 1861 + "icu_locale_core", 1862 + "writeable", 1863 + "yoke", 1864 + "zerofrom", 1865 + "zerotrie", 1866 + "zerovec", 1867 + ] 1868 + 1869 + [[package]] 1870 + name = "idna" 1871 + version = "1.1.0" 1872 + source = "registry+https://github.com/rust-lang/crates.io-index" 1873 + checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" 1874 + dependencies = [ 1875 + "idna_adapter", 1876 + "smallvec", 1877 + "utf8_iter", 1878 + ] 1879 + 1880 + [[package]] 1881 + name = "idna_adapter" 1882 + version = "1.2.1" 1883 + source = "registry+https://github.com/rust-lang/crates.io-index" 1884 + checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" 1885 + dependencies = [ 1886 + "icu_normalizer", 1887 + "icu_properties", 1888 + ] 1889 + 1890 + [[package]] 1717 1891 name = "image" 1718 1892 version = "0.24.9" 1719 1893 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1905 2079 checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" 1906 2080 1907 2081 [[package]] 2082 + name = "litemap" 2083 + version = "0.8.1" 2084 + source = "registry+https://github.com/rust-lang/crates.io-index" 2085 + checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" 2086 + 2087 + [[package]] 1908 2088 name = "lock_api" 1909 2089 version = "0.4.14" 1910 2090 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1926 2106 checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" 1927 2107 1928 2108 [[package]] 2109 + name = "lyon" 2110 + version = "1.0.16" 2111 + source = "registry+https://github.com/rust-lang/crates.io-index" 2112 + checksum = "dbcb7d54d54c8937364c9d41902d066656817dce1e03a44e5533afebd1ef4352" 2113 + dependencies = [ 2114 + "lyon_algorithms", 2115 + "lyon_tessellation", 2116 + ] 2117 + 2118 + [[package]] 2119 + name = "lyon_algorithms" 2120 + version = "1.0.16" 2121 + source = "registry+https://github.com/rust-lang/crates.io-index" 2122 + checksum = "f4c0829e28c4f336396f250d850c3987e16ce6db057ffe047ce0dd54aab6b647" 2123 + dependencies = [ 2124 + "lyon_path", 2125 + "num-traits", 2126 + ] 2127 + 2128 + [[package]] 2129 + name = "lyon_geom" 2130 + version = "1.0.18" 2131 + source = "registry+https://github.com/rust-lang/crates.io-index" 2132 + checksum = "e260b6de923e6e47adfedf6243013a7a874684165a6a277594ee3906021b2343" 2133 + dependencies = [ 2134 + "arrayvec", 2135 + "euclid", 2136 + "num-traits", 2137 + ] 2138 + 2139 + [[package]] 2140 + name = "lyon_path" 2141 + version = "1.0.16" 2142 + source = "registry+https://github.com/rust-lang/crates.io-index" 2143 + checksum = "1aeca86bcfd632a15984ba029b539ffb811e0a70bf55e814ef8b0f54f506fdeb" 2144 + dependencies = [ 2145 + "lyon_geom", 2146 + "num-traits", 2147 + ] 2148 + 2149 + [[package]] 2150 + name = "lyon_tessellation" 2151 + version = "1.0.16" 2152 + source = "registry+https://github.com/rust-lang/crates.io-index" 2153 + checksum = "f3f586142e1280335b1bc89539f7c97dd80f08fc43e9ab1b74ef0a42b04aa353" 2154 + dependencies = [ 2155 + "float_next_after", 2156 + "lyon_path", 2157 + "num-traits", 2158 + ] 2159 + 2160 + [[package]] 1929 2161 name = "mach2" 1930 2162 version = "0.4.3" 1931 2163 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2071 2303 ] 2072 2304 2073 2305 [[package]] 2306 + name = "nix" 2307 + version = "0.30.1" 2308 + source = "registry+https://github.com/rust-lang/crates.io-index" 2309 + checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" 2310 + dependencies = [ 2311 + "bitflags 2.10.0", 2312 + "cfg-if", 2313 + "cfg_aliases 0.2.1", 2314 + "libc", 2315 + "memoffset", 2316 + ] 2317 + 2318 + [[package]] 2074 2319 name = "num-derive" 2075 2320 version = "0.4.2" 2076 2321 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2088 2333 checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 2089 2334 dependencies = [ 2090 2335 "autocfg", 2336 + "libm", 2091 2337 ] 2092 2338 2093 2339 [[package]] ··· 2164 2410 checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" 2165 2411 dependencies = [ 2166 2412 "bitflags 2.10.0", 2167 - "block2", 2413 + "block2 0.5.1", 2168 2414 "libc", 2169 2415 "objc2 0.5.2", 2170 2416 "objc2-core-data", ··· 2174 2420 ] 2175 2421 2176 2422 [[package]] 2423 + name = "objc2-app-kit" 2424 + version = "0.3.2" 2425 + source = "registry+https://github.com/rust-lang/crates.io-index" 2426 + checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" 2427 + dependencies = [ 2428 + "bitflags 2.10.0", 2429 + "block2 0.6.2", 2430 + "objc2 0.6.3", 2431 + "objc2-foundation 0.3.2", 2432 + ] 2433 + 2434 + [[package]] 2177 2435 name = "objc2-audio-toolbox" 2178 2436 version = "0.3.2" 2179 2437 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2195 2453 checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" 2196 2454 dependencies = [ 2197 2455 "bitflags 2.10.0", 2198 - "block2", 2456 + "block2 0.5.1", 2199 2457 "objc2 0.5.2", 2200 2458 "objc2-core-location", 2201 2459 "objc2-foundation 0.2.2", ··· 2207 2465 source = "registry+https://github.com/rust-lang/crates.io-index" 2208 2466 checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" 2209 2467 dependencies = [ 2210 - "block2", 2468 + "block2 0.5.1", 2211 2469 "objc2 0.5.2", 2212 2470 "objc2-foundation 0.2.2", 2213 2471 ] ··· 2241 2499 checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" 2242 2500 dependencies = [ 2243 2501 "bitflags 2.10.0", 2244 - "block2", 2502 + "block2 0.5.1", 2245 2503 "objc2 0.5.2", 2246 2504 "objc2-foundation 0.2.2", 2247 2505 ] ··· 2263 2521 source = "registry+https://github.com/rust-lang/crates.io-index" 2264 2522 checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" 2265 2523 dependencies = [ 2266 - "block2", 2524 + "block2 0.5.1", 2267 2525 "objc2 0.5.2", 2268 2526 "objc2-foundation 0.2.2", 2269 2527 "objc2-metal", ··· 2275 2533 source = "registry+https://github.com/rust-lang/crates.io-index" 2276 2534 checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" 2277 2535 dependencies = [ 2278 - "block2", 2536 + "block2 0.5.1", 2279 2537 "objc2 0.5.2", 2280 2538 "objc2-contacts", 2281 2539 "objc2-foundation 0.2.2", ··· 2294 2552 checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" 2295 2553 dependencies = [ 2296 2554 "bitflags 2.10.0", 2297 - "block2", 2555 + "block2 0.5.1", 2298 2556 "dispatch", 2299 2557 "libc", 2300 2558 "objc2 0.5.2", ··· 2306 2564 source = "registry+https://github.com/rust-lang/crates.io-index" 2307 2565 checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" 2308 2566 dependencies = [ 2567 + "bitflags 2.10.0", 2309 2568 "objc2 0.6.3", 2569 + "objc2-core-foundation", 2310 2570 ] 2311 2571 2312 2572 [[package]] ··· 2315 2575 source = "registry+https://github.com/rust-lang/crates.io-index" 2316 2576 checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" 2317 2577 dependencies = [ 2318 - "block2", 2578 + "block2 0.5.1", 2319 2579 "objc2 0.5.2", 2320 - "objc2-app-kit", 2580 + "objc2-app-kit 0.2.2", 2321 2581 "objc2-foundation 0.2.2", 2322 2582 ] 2323 2583 ··· 2328 2588 checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" 2329 2589 dependencies = [ 2330 2590 "bitflags 2.10.0", 2331 - "block2", 2591 + "block2 0.5.1", 2332 2592 "objc2 0.5.2", 2333 2593 "objc2-foundation 0.2.2", 2334 2594 ] ··· 2340 2600 checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" 2341 2601 dependencies = [ 2342 2602 "bitflags 2.10.0", 2343 - "block2", 2603 + "block2 0.5.1", 2344 2604 "objc2 0.5.2", 2345 2605 "objc2-foundation 0.2.2", 2346 2606 "objc2-metal", ··· 2363 2623 checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" 2364 2624 dependencies = [ 2365 2625 "bitflags 2.10.0", 2366 - "block2", 2626 + "block2 0.5.1", 2367 2627 "objc2 0.5.2", 2368 2628 "objc2-cloud-kit", 2369 2629 "objc2-core-data", ··· 2383 2643 source = "registry+https://github.com/rust-lang/crates.io-index" 2384 2644 checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" 2385 2645 dependencies = [ 2386 - "block2", 2646 + "block2 0.5.1", 2387 2647 "objc2 0.5.2", 2388 2648 "objc2-foundation 0.2.2", 2389 2649 ] ··· 2395 2655 checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" 2396 2656 dependencies = [ 2397 2657 "bitflags 2.10.0", 2398 - "block2", 2658 + "block2 0.5.1", 2399 2659 "objc2 0.5.2", 2400 2660 "objc2-core-location", 2401 2661 "objc2-foundation 0.2.2", ··· 2567 2827 checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" 2568 2828 dependencies = [ 2569 2829 "phf_shared", 2570 - "rand", 2830 + "rand 0.8.5", 2571 2831 ] 2572 2832 2573 2833 [[package]] ··· 2669 2929 ] 2670 2930 2671 2931 [[package]] 2932 + name = "pollster" 2933 + version = "0.4.0" 2934 + source = "registry+https://github.com/rust-lang/crates.io-index" 2935 + checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" 2936 + 2937 + [[package]] 2938 + name = "potential_utf" 2939 + version = "0.1.4" 2940 + source = "registry+https://github.com/rust-lang/crates.io-index" 2941 + checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" 2942 + dependencies = [ 2943 + "zerovec", 2944 + ] 2945 + 2946 + [[package]] 2672 2947 name = "ppv-lite86" 2673 2948 version = "0.2.21" 2674 2949 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2747 3022 checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 2748 3023 dependencies = [ 2749 3024 "libc", 2750 - "rand_chacha", 2751 - "rand_core", 3025 + "rand_chacha 0.3.1", 3026 + "rand_core 0.6.4", 3027 + ] 3028 + 3029 + [[package]] 3030 + name = "rand" 3031 + version = "0.9.2" 3032 + source = "registry+https://github.com/rust-lang/crates.io-index" 3033 + checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" 3034 + dependencies = [ 3035 + "rand_chacha 0.9.0", 3036 + "rand_core 0.9.3", 2752 3037 ] 2753 3038 2754 3039 [[package]] ··· 2758 3043 checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 2759 3044 dependencies = [ 2760 3045 "ppv-lite86", 2761 - "rand_core", 3046 + "rand_core 0.6.4", 3047 + ] 3048 + 3049 + [[package]] 3050 + name = "rand_chacha" 3051 + version = "0.9.0" 3052 + source = "registry+https://github.com/rust-lang/crates.io-index" 3053 + checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" 3054 + dependencies = [ 3055 + "ppv-lite86", 3056 + "rand_core 0.9.3", 2762 3057 ] 2763 3058 2764 3059 [[package]] ··· 2768 3063 checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 2769 3064 dependencies = [ 2770 3065 "getrandom 0.2.16", 3066 + ] 3067 + 3068 + [[package]] 3069 + name = "rand_core" 3070 + version = "0.9.3" 3071 + source = "registry+https://github.com/rust-lang/crates.io-index" 3072 + checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 3073 + dependencies = [ 3074 + "getrandom 0.3.4", 2771 3075 ] 2772 3076 2773 3077 [[package]] ··· 2874 3178 checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" 2875 3179 2876 3180 [[package]] 3181 + name = "rfd" 3182 + version = "0.16.0" 3183 + source = "registry+https://github.com/rust-lang/crates.io-index" 3184 + checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672" 3185 + dependencies = [ 3186 + "ashpd", 3187 + "block2 0.6.2", 3188 + "dispatch2", 3189 + "js-sys", 3190 + "log", 3191 + "objc2 0.6.3", 3192 + "objc2-app-kit 0.3.2", 3193 + "objc2-core-foundation", 3194 + "objc2-foundation 0.3.2", 3195 + "pollster", 3196 + "raw-window-handle", 3197 + "urlencoding", 3198 + "wasm-bindgen", 3199 + "wasm-bindgen-futures", 3200 + "web-sys", 3201 + "windows-sys 0.60.2", 3202 + ] 3203 + 3204 + [[package]] 2877 3205 name = "roxmltree" 2878 3206 version = "0.20.0" 2879 3207 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3214 3542 ] 3215 3543 3216 3544 [[package]] 3545 + name = "stable_deref_trait" 3546 + version = "1.2.1" 3547 + source = "registry+https://github.com/rust-lang/crates.io-index" 3548 + checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" 3549 + 3550 + [[package]] 3217 3551 name = "static_assertions" 3218 3552 version = "1.1.0" 3219 3553 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3227 3561 "cpal", 3228 3562 "dirs 6.0.0", 3229 3563 "iced", 3564 + "rfd", 3230 3565 ] 3231 3566 3232 3567 [[package]] ··· 3279 3614 ] 3280 3615 3281 3616 [[package]] 3617 + name = "synstructure" 3618 + version = "0.13.2" 3619 + source = "registry+https://github.com/rust-lang/crates.io-index" 3620 + checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" 3621 + dependencies = [ 3622 + "proc-macro2", 3623 + "quote", 3624 + "syn 2.0.111", 3625 + ] 3626 + 3627 + [[package]] 3282 3628 name = "sys-locale" 3283 3629 version = "0.3.2" 3284 3630 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3397 3743 "libloading 0.8.9", 3398 3744 "pkg-config", 3399 3745 "tracing", 3746 + ] 3747 + 3748 + [[package]] 3749 + name = "tinystr" 3750 + version = "0.8.2" 3751 + source = "registry+https://github.com/rust-lang/crates.io-index" 3752 + checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" 3753 + dependencies = [ 3754 + "displaydoc", 3755 + "zerovec", 3400 3756 ] 3401 3757 3402 3758 [[package]] ··· 3581 3937 checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" 3582 3938 3583 3939 [[package]] 3940 + name = "url" 3941 + version = "2.5.7" 3942 + source = "registry+https://github.com/rust-lang/crates.io-index" 3943 + checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" 3944 + dependencies = [ 3945 + "form_urlencoded", 3946 + "idna", 3947 + "percent-encoding", 3948 + "serde", 3949 + ] 3950 + 3951 + [[package]] 3952 + name = "urlencoding" 3953 + version = "2.1.3" 3954 + source = "registry+https://github.com/rust-lang/crates.io-index" 3955 + checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" 3956 + 3957 + [[package]] 3958 + name = "utf8_iter" 3959 + version = "1.0.4" 3960 + source = "registry+https://github.com/rust-lang/crates.io-index" 3961 + checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" 3962 + 3963 + [[package]] 3964 + name = "uuid" 3965 + version = "1.19.0" 3966 + source = "registry+https://github.com/rust-lang/crates.io-index" 3967 + checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" 3968 + dependencies = [ 3969 + "js-sys", 3970 + "serde_core", 3971 + "wasm-bindgen", 3972 + ] 3973 + 3974 + [[package]] 3584 3975 name = "version_check" 3585 3976 version = "0.9.5" 3586 3977 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4086 4477 4087 4478 [[package]] 4088 4479 name = "windows-sys" 4480 + version = "0.60.2" 4481 + source = "registry+https://github.com/rust-lang/crates.io-index" 4482 + checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" 4483 + dependencies = [ 4484 + "windows-targets 0.53.5", 4485 + ] 4486 + 4487 + [[package]] 4488 + name = "windows-sys" 4089 4489 version = "0.61.2" 4090 4490 source = "registry+https://github.com/rust-lang/crates.io-index" 4091 4491 checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" ··· 4117 4517 "windows_aarch64_gnullvm 0.52.6", 4118 4518 "windows_aarch64_msvc 0.52.6", 4119 4519 "windows_i686_gnu 0.52.6", 4120 - "windows_i686_gnullvm", 4520 + "windows_i686_gnullvm 0.52.6", 4121 4521 "windows_i686_msvc 0.52.6", 4122 4522 "windows_x86_64_gnu 0.52.6", 4123 4523 "windows_x86_64_gnullvm 0.52.6", ··· 4125 4525 ] 4126 4526 4127 4527 [[package]] 4528 + name = "windows-targets" 4529 + version = "0.53.5" 4530 + source = "registry+https://github.com/rust-lang/crates.io-index" 4531 + checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" 4532 + dependencies = [ 4533 + "windows-link", 4534 + "windows_aarch64_gnullvm 0.53.1", 4535 + "windows_aarch64_msvc 0.53.1", 4536 + "windows_i686_gnu 0.53.1", 4537 + "windows_i686_gnullvm 0.53.1", 4538 + "windows_i686_msvc 0.53.1", 4539 + "windows_x86_64_gnu 0.53.1", 4540 + "windows_x86_64_gnullvm 0.53.1", 4541 + "windows_x86_64_msvc 0.53.1", 4542 + ] 4543 + 4544 + [[package]] 4128 4545 name = "windows_aarch64_gnullvm" 4129 4546 version = "0.42.2" 4130 4547 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4137 4554 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 4138 4555 4139 4556 [[package]] 4557 + name = "windows_aarch64_gnullvm" 4558 + version = "0.53.1" 4559 + source = "registry+https://github.com/rust-lang/crates.io-index" 4560 + checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" 4561 + 4562 + [[package]] 4140 4563 name = "windows_aarch64_msvc" 4141 4564 version = "0.42.2" 4142 4565 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4149 4572 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 4150 4573 4151 4574 [[package]] 4575 + name = "windows_aarch64_msvc" 4576 + version = "0.53.1" 4577 + source = "registry+https://github.com/rust-lang/crates.io-index" 4578 + checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" 4579 + 4580 + [[package]] 4152 4581 name = "windows_i686_gnu" 4153 4582 version = "0.42.2" 4154 4583 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4161 4590 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 4162 4591 4163 4592 [[package]] 4593 + name = "windows_i686_gnu" 4594 + version = "0.53.1" 4595 + source = "registry+https://github.com/rust-lang/crates.io-index" 4596 + checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" 4597 + 4598 + [[package]] 4164 4599 name = "windows_i686_gnullvm" 4165 4600 version = "0.52.6" 4166 4601 source = "registry+https://github.com/rust-lang/crates.io-index" 4167 4602 checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 4168 4603 4169 4604 [[package]] 4605 + name = "windows_i686_gnullvm" 4606 + version = "0.53.1" 4607 + source = "registry+https://github.com/rust-lang/crates.io-index" 4608 + checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" 4609 + 4610 + [[package]] 4170 4611 name = "windows_i686_msvc" 4171 4612 version = "0.42.2" 4172 4613 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4179 4620 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 4180 4621 4181 4622 [[package]] 4623 + name = "windows_i686_msvc" 4624 + version = "0.53.1" 4625 + source = "registry+https://github.com/rust-lang/crates.io-index" 4626 + checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" 4627 + 4628 + [[package]] 4182 4629 name = "windows_x86_64_gnu" 4183 4630 version = "0.42.2" 4184 4631 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4191 4638 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 4192 4639 4193 4640 [[package]] 4641 + name = "windows_x86_64_gnu" 4642 + version = "0.53.1" 4643 + source = "registry+https://github.com/rust-lang/crates.io-index" 4644 + checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" 4645 + 4646 + [[package]] 4194 4647 name = "windows_x86_64_gnullvm" 4195 4648 version = "0.42.2" 4196 4649 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4203 4656 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 4204 4657 4205 4658 [[package]] 4659 + name = "windows_x86_64_gnullvm" 4660 + version = "0.53.1" 4661 + source = "registry+https://github.com/rust-lang/crates.io-index" 4662 + checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" 4663 + 4664 + [[package]] 4206 4665 name = "windows_x86_64_msvc" 4207 4666 version = "0.42.2" 4208 4667 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4215 4674 checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 4216 4675 4217 4676 [[package]] 4677 + name = "windows_x86_64_msvc" 4678 + version = "0.53.1" 4679 + source = "registry+https://github.com/rust-lang/crates.io-index" 4680 + checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" 4681 + 4682 + [[package]] 4218 4683 name = "winit" 4219 4684 version = "0.30.12" 4220 4685 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4224 4689 "android-activity", 4225 4690 "atomic-waker", 4226 4691 "bitflags 2.10.0", 4227 - "block2", 4692 + "block2 0.5.1", 4228 4693 "bytemuck", 4229 4694 "calloop 0.13.0", 4230 4695 "cfg_aliases 0.2.1", ··· 4238 4703 "memmap2", 4239 4704 "ndk", 4240 4705 "objc2 0.5.2", 4241 - "objc2-app-kit", 4706 + "objc2-app-kit 0.2.2", 4242 4707 "objc2-foundation 0.2.2", 4243 4708 "objc2-ui-kit", 4244 4709 "orbclient", ··· 4291 4756 checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" 4292 4757 4293 4758 [[package]] 4759 + name = "writeable" 4760 + version = "0.6.2" 4761 + source = "registry+https://github.com/rust-lang/crates.io-index" 4762 + checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" 4763 + 4764 + [[package]] 4294 4765 name = "x11-dl" 4295 4766 version = "2.21.0" 4296 4767 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4370 4841 checksum = "c94451ac9513335b5e23d7a8a2b61a7102398b8cca5160829d313e84c9d98be1" 4371 4842 4372 4843 [[package]] 4844 + name = "yoke" 4845 + version = "0.8.1" 4846 + source = "registry+https://github.com/rust-lang/crates.io-index" 4847 + checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" 4848 + dependencies = [ 4849 + "stable_deref_trait", 4850 + "yoke-derive", 4851 + "zerofrom", 4852 + ] 4853 + 4854 + [[package]] 4855 + name = "yoke-derive" 4856 + version = "0.8.1" 4857 + source = "registry+https://github.com/rust-lang/crates.io-index" 4858 + checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" 4859 + dependencies = [ 4860 + "proc-macro2", 4861 + "quote", 4862 + "syn 2.0.111", 4863 + "synstructure", 4864 + ] 4865 + 4866 + [[package]] 4373 4867 name = "zbus" 4374 4868 version = "4.4.0" 4375 4869 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4391 4885 "futures-sink", 4392 4886 "futures-util", 4393 4887 "hex", 4394 - "nix", 4888 + "nix 0.29.0", 4395 4889 "ordered-stream", 4396 - "rand", 4890 + "rand 0.8.5", 4397 4891 "serde", 4398 4892 "serde_repr", 4399 4893 "sha1", ··· 4402 4896 "uds_windows", 4403 4897 "windows-sys 0.52.0", 4404 4898 "xdg-home", 4405 - "zbus_macros", 4406 - "zbus_names", 4407 - "zvariant", 4899 + "zbus_macros 4.4.0", 4900 + "zbus_names 3.0.0", 4901 + "zvariant 4.2.0", 4902 + ] 4903 + 4904 + [[package]] 4905 + name = "zbus" 4906 + version = "5.12.0" 4907 + source = "registry+https://github.com/rust-lang/crates.io-index" 4908 + checksum = "b622b18155f7a93d1cd2dc8c01d2d6a44e08fb9ebb7b3f9e6ed101488bad6c91" 4909 + dependencies = [ 4910 + "async-broadcast", 4911 + "async-executor", 4912 + "async-io", 4913 + "async-lock", 4914 + "async-process", 4915 + "async-recursion", 4916 + "async-task", 4917 + "async-trait", 4918 + "blocking", 4919 + "enumflags2", 4920 + "event-listener", 4921 + "futures-core", 4922 + "futures-lite", 4923 + "hex", 4924 + "nix 0.30.1", 4925 + "ordered-stream", 4926 + "serde", 4927 + "serde_repr", 4928 + "tracing", 4929 + "uds_windows", 4930 + "uuid", 4931 + "windows-sys 0.61.2", 4932 + "winnow", 4933 + "zbus_macros 5.12.0", 4934 + "zbus_names 4.2.0", 4935 + "zvariant 5.8.0", 4408 4936 ] 4409 4937 4410 4938 [[package]] ··· 4417 4945 "proc-macro2", 4418 4946 "quote", 4419 4947 "syn 2.0.111", 4420 - "zvariant_utils", 4948 + "zvariant_utils 2.1.0", 4949 + ] 4950 + 4951 + [[package]] 4952 + name = "zbus_macros" 4953 + version = "5.12.0" 4954 + source = "registry+https://github.com/rust-lang/crates.io-index" 4955 + checksum = "1cdb94821ca8a87ca9c298b5d1cbd80e2a8b67115d99f6e4551ac49e42b6a314" 4956 + dependencies = [ 4957 + "proc-macro-crate", 4958 + "proc-macro2", 4959 + "quote", 4960 + "syn 2.0.111", 4961 + "zbus_names 4.2.0", 4962 + "zvariant 5.8.0", 4963 + "zvariant_utils 3.2.1", 4421 4964 ] 4422 4965 4423 4966 [[package]] ··· 4428 4971 dependencies = [ 4429 4972 "serde", 4430 4973 "static_assertions", 4431 - "zvariant", 4974 + "zvariant 4.2.0", 4975 + ] 4976 + 4977 + [[package]] 4978 + name = "zbus_names" 4979 + version = "4.2.0" 4980 + source = "registry+https://github.com/rust-lang/crates.io-index" 4981 + checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" 4982 + dependencies = [ 4983 + "serde", 4984 + "static_assertions", 4985 + "winnow", 4986 + "zvariant 5.8.0", 4432 4987 ] 4433 4988 4434 4989 [[package]] ··· 4458 5013 ] 4459 5014 4460 5015 [[package]] 5016 + name = "zerofrom" 5017 + version = "0.1.6" 5018 + source = "registry+https://github.com/rust-lang/crates.io-index" 5019 + checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" 5020 + dependencies = [ 5021 + "zerofrom-derive", 5022 + ] 5023 + 5024 + [[package]] 5025 + name = "zerofrom-derive" 5026 + version = "0.1.6" 5027 + source = "registry+https://github.com/rust-lang/crates.io-index" 5028 + checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" 5029 + dependencies = [ 5030 + "proc-macro2", 5031 + "quote", 5032 + "syn 2.0.111", 5033 + "synstructure", 5034 + ] 5035 + 5036 + [[package]] 5037 + name = "zerotrie" 5038 + version = "0.2.3" 5039 + source = "registry+https://github.com/rust-lang/crates.io-index" 5040 + checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" 5041 + dependencies = [ 5042 + "displaydoc", 5043 + "yoke", 5044 + "zerofrom", 5045 + ] 5046 + 5047 + [[package]] 5048 + name = "zerovec" 5049 + version = "0.11.5" 5050 + source = "registry+https://github.com/rust-lang/crates.io-index" 5051 + checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" 5052 + dependencies = [ 5053 + "yoke", 5054 + "zerofrom", 5055 + "zerovec-derive", 5056 + ] 5057 + 5058 + [[package]] 5059 + name = "zerovec-derive" 5060 + version = "0.11.2" 5061 + source = "registry+https://github.com/rust-lang/crates.io-index" 5062 + checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" 5063 + dependencies = [ 5064 + "proc-macro2", 5065 + "quote", 5066 + "syn 2.0.111", 5067 + ] 5068 + 5069 + [[package]] 4461 5070 name = "zune-inflate" 4462 5071 version = "0.2.54" 4463 5072 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4476 5085 "enumflags2", 4477 5086 "serde", 4478 5087 "static_assertions", 4479 - "zvariant_derive", 5088 + "zvariant_derive 4.2.0", 5089 + ] 5090 + 5091 + [[package]] 5092 + name = "zvariant" 5093 + version = "5.8.0" 5094 + source = "registry+https://github.com/rust-lang/crates.io-index" 5095 + checksum = "2be61892e4f2b1772727be11630a62664a1826b62efa43a6fe7449521cb8744c" 5096 + dependencies = [ 5097 + "endi", 5098 + "enumflags2", 5099 + "serde", 5100 + "url", 5101 + "winnow", 5102 + "zvariant_derive 5.8.0", 5103 + "zvariant_utils 3.2.1", 4480 5104 ] 4481 5105 4482 5106 [[package]] ··· 4489 5113 "proc-macro2", 4490 5114 "quote", 4491 5115 "syn 2.0.111", 4492 - "zvariant_utils", 5116 + "zvariant_utils 2.1.0", 5117 + ] 5118 + 5119 + [[package]] 5120 + name = "zvariant_derive" 5121 + version = "5.8.0" 5122 + source = "registry+https://github.com/rust-lang/crates.io-index" 5123 + checksum = "da58575a1b2b20766513b1ec59d8e2e68db2745379f961f86650655e862d2006" 5124 + dependencies = [ 5125 + "proc-macro-crate", 5126 + "proc-macro2", 5127 + "quote", 5128 + "syn 2.0.111", 5129 + "zvariant_utils 3.2.1", 4493 5130 ] 4494 5131 4495 5132 [[package]] ··· 4502 5139 "quote", 4503 5140 "syn 2.0.111", 4504 5141 ] 5142 + 5143 + [[package]] 5144 + name = "zvariant_utils" 5145 + version = "3.2.1" 5146 + source = "registry+https://github.com/rust-lang/crates.io-index" 5147 + checksum = "c6949d142f89f6916deca2232cf26a8afacf2b9fdc35ce766105e104478be599" 5148 + dependencies = [ 5149 + "proc-macro2", 5150 + "quote", 5151 + "serde", 5152 + "syn 2.0.111", 5153 + "winnow", 5154 + ]
+2 -1
app/Cargo.toml
··· 4 4 edition = "2024" 5 5 6 6 [dependencies] 7 - iced = { version = "0.13.1", features = ["image", "tokio"] } 7 + iced = { version = "0.13.1", features = ["image", "tokio", "canvas"] } 8 8 cpal = "0.16" 9 9 anyhow = "1" 10 10 dirs = "6.0.0" 11 + rfd = "0.16.0"
+2
core/Cargo.toml
··· 4 4 edition = "2024" 5 5 6 6 [dependencies] 7 + anyhow = "1.0.100" 8 + cpal = "0.16"
+164 -9
core/src/lib.rs
··· 1 - pub fn add(left: u64, right: u64) -> u64 { 2 - left + right 1 + use anyhow::{Result, anyhow}; 2 + use cpal::{ 3 + SampleFormat, StreamConfig, 4 + traits::{DeviceTrait, HostTrait, StreamTrait}, 5 + }; 6 + use std::{ 7 + collections::VecDeque, 8 + sync::{Arc, Mutex, atomic::AtomicBool}, 9 + time, 10 + }; 11 + 12 + #[derive(Debug, Clone)] 13 + pub struct MicInfo { 14 + pub name: String, 15 + pub sample_rate: u32, 16 + pub channels: u16, 17 + } 18 + 19 + impl Default for MicInfo { 20 + fn default() -> Self { 21 + Self::new() 22 + } 23 + } 24 + 25 + impl MicInfo { 26 + pub fn new() -> Self { 27 + let host = cpal::default_host(); 28 + let device = host.default_input_device().expect("no default input device"); 29 + let supported_config = device.default_input_config().unwrap(); 30 + let config: cpal::StreamConfig = supported_config.clone().into(); 31 + 32 + Self { 33 + name: device.name().unwrap_or_else(|_| "Unknown device".into()), 34 + sample_rate: config.sample_rate.0, 35 + channels: config.channels, 36 + } 37 + } 38 + } 39 + 40 + pub type SharedLevels = Arc<Mutex<VecDeque<f32>>>; 41 + 42 + fn process_input_f32(data: &[f32], active: &AtomicBool, levels: &SharedLevels) { 43 + if data.is_empty() { 44 + return; 45 + } 46 + 47 + let mut sum = 0.0; 48 + for &s in data { 49 + sum += s * s; 50 + } 51 + let rms = (sum / data.len() as f32).sqrt(); 52 + 53 + let threshold = 0.02; 54 + active.store(rms > threshold, std::sync::atomic::Ordering::Relaxed); 55 + push_level(levels, rms); 56 + } 57 + 58 + fn process_input_i16(data: &[i16], active: &AtomicBool, levels: &SharedLevels) { 59 + if data.is_empty() { 60 + return; 61 + } 62 + let norm = i16::MAX as f32; 63 + let mut sum = 0.0; 64 + for &s in data { 65 + let v = s as f32 / norm; 66 + sum += v * v; 67 + } 68 + let rms = (sum / data.len() as f32).sqrt(); 69 + let threshold = 0.02; 70 + active.store(rms > threshold, std::sync::atomic::Ordering::Relaxed); 71 + push_level(levels, rms); 72 + } 73 + 74 + fn process_input_u16(data: &[u16], active: &AtomicBool, levels: &SharedLevels) { 75 + if data.is_empty() { 76 + return; 77 + } 78 + let max = u16::MAX as f32; 79 + let mid = max / 2.0; 80 + let mut sum = 0.0; 81 + for &s in data { 82 + let v = (s as f32 - mid) / mid; 83 + sum += v * v; 84 + } 85 + let rms = (sum / data.len() as f32).sqrt(); 86 + let threshold = 0.02; 87 + active.store(rms > threshold, std::sync::atomic::Ordering::Relaxed); 88 + push_level(levels, rms); 89 + } 90 + 91 + fn push_level(levels: &SharedLevels, rms: f32) { 92 + const MAX_SAMPLES: usize = 64; 93 + 94 + if let Ok(mut buf) = levels.lock() { 95 + buf.push_back(rms); 96 + if buf.len() > MAX_SAMPLES { 97 + buf.pop_front(); 98 + } 99 + } 100 + } 101 + 102 + pub fn spawn_mic_listener(active: Arc<AtomicBool>, levels: SharedLevels) -> Result<()> { 103 + std::thread::spawn(move || { 104 + if let Err(e) = mic_loop(active, levels) { 105 + eprintln!("mic loop error: {e:?}"); 106 + } 107 + }); 108 + Ok(()) 3 109 } 4 110 5 - #[cfg(test)] 6 - mod tests { 7 - use super::*; 111 + pub fn mic_loop(active: Arc<AtomicBool>, levels: SharedLevels) -> Result<()> { 112 + let host = cpal::default_host(); 113 + let device = host 114 + .default_input_device() 115 + .ok_or_else(|| anyhow::anyhow!("no default input device"))?; 116 + println!("Using input device: {}", device.name()?); 117 + 118 + let supported_config = device 119 + .default_input_config() 120 + .map_err(|e| anyhow::anyhow!("failed to get default input config: {e}"))?; 121 + let sample_format = supported_config.sample_format(); 122 + let config: StreamConfig = supported_config.into(); 8 123 9 - #[test] 10 - fn it_works() { 11 - let result = add(2, 2); 12 - assert_eq!(result, 4); 124 + let stream = match sample_format { 125 + SampleFormat::F32 => { 126 + let active = active.clone(); 127 + let levels = levels.clone(); 128 + let err_fn = |err| eprintln!("cpal input stream error: {err}"); 129 + device.build_input_stream( 130 + &config, 131 + move |data: &[f32], _| process_input_f32(data, &active, &levels), 132 + err_fn, 133 + None, 134 + )? 135 + } 136 + SampleFormat::I16 => { 137 + let active = active.clone(); 138 + let levels = levels.clone(); 139 + let err_fn = |err| eprintln!("cpal input stream error: {err}"); 140 + device.build_input_stream( 141 + &config, 142 + move |data: &[i16], _| process_input_i16(data, &active, &levels), 143 + err_fn, 144 + None, 145 + )? 146 + } 147 + SampleFormat::U16 => { 148 + let active = active.clone(); 149 + let levels = levels.clone(); 150 + let err_fn = |err| eprintln!("cpal input stream error: {err}"); 151 + device.build_input_stream( 152 + &config, 153 + move |data: &[u16], _| process_input_u16(data, &active, &levels), 154 + err_fn, 155 + None, 156 + )? 157 + } 158 + 159 + other => { 160 + return Err(anyhow!("Unsupported sample format: {other:?}")); 161 + } 162 + }; 163 + 164 + stream.play()?; 165 + 166 + loop { 167 + std::thread::sleep(time::Duration::from_secs(1)); 13 168 } 14 169 }
fonts/JetBrainsMono-Italic-VariableFont_wght.ttf

This is a binary file and will not be displayed.

fonts/JetBrainsMono-VariableFont_wght.ttf

This is a binary file and will not be displayed.