diff --git a/Cargo.lock b/Cargo.lock index 02699a2..848588e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,6 +44,28 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alsa" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43" +dependencies = [ + "alsa-sys", + "bitflags 2.5.0", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -65,6 +87,12 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "async-trait" version = "0.1.80" @@ -132,6 +160,24 @@ dependencies = [ "which", ] +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.66", +] + [[package]] name = "bit_field" version = "0.10.2" @@ -223,7 +269,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771aa57f3b17da6c8bcacb187bb9ec9bc81c8160e72342e67c329e0e1651a669" dependencies = [ - "darling", + "darling 0.20.9", "proc-macro2", "quote", "syn 2.0.66", @@ -240,6 +286,11 @@ name = "cc" version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] [[package]] name = "cesu8" @@ -297,6 +348,12 @@ dependencies = [ "libloading", ] +[[package]] +name = "claxon" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688" + [[package]] name = "cocoa-foundation" version = "0.1.2" @@ -414,6 +471,49 @@ dependencies = [ "libc", ] +[[package]] +name = "coreaudio-rs" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace" +dependencies = [ + "bitflags 1.3.2", + "core-foundation-sys", + "coreaudio-sys", +] + +[[package]] +name = "coreaudio-sys" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ce857aa0b77d77287acc1ac3e37a05a8c95a2af3647d23b15f263bdaeb7562b" +dependencies = [ + "bindgen 0.70.1", +] + +[[package]] +name = "cpal" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "873dab07c8f743075e57f524c583985fbaf745602acbe916a01539364369a779" +dependencies = [ + "alsa", + "core-foundation-sys", + "coreaudio-rs", + "dasp_sample", + "jni 0.21.1", + "js-sys", + "libc", + "mach2", + "ndk 0.8.0", + "ndk-context", + "oboe", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.54.0", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -463,14 +563,38 @@ dependencies = [ "libc", ] +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + [[package]] name = "darling" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.9", + "darling_macro 0.20.9", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] @@ -483,21 +607,38 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.11.1", "syn 2.0.66", ] +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core 0.13.4", + "quote", + "syn 1.0.109", +] + [[package]] name = "darling_macro" version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ - "darling_core", + "darling_core 0.20.9", "quote", "syn 2.0.66", ] +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + [[package]] name = "dbus" version = "0.9.7" @@ -545,6 +686,17 @@ dependencies = [ "xcb", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "dlib" version = "0.5.2" @@ -919,6 +1071,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + [[package]] name = "http" version = "1.1.0" @@ -1150,6 +1308,7 @@ dependencies = [ "rand", "regex", "reqwest", + "rodio", "screenshots", "serde", "time", @@ -1161,6 +1320,20 @@ dependencies = [ "winresource", ] +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + [[package]] name = "jni" version = "0.21.1" @@ -1183,6 +1356,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.3.1" @@ -1234,6 +1416,17 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" +[[package]] +name = "lewton" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" +dependencies = [ + "byteorder", + "ogg", + "tinyvec", +] + [[package]] name = "libc" version = "0.2.155" @@ -1298,6 +1491,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -1390,12 +1592,85 @@ dependencies = [ "tempfile", ] +[[package]] +name = "ndk" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys 0.3.0", + "num_enum 0.5.11", + "thiserror", +] + +[[package]] +name = "ndk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +dependencies = [ + "bitflags 2.5.0", + "jni-sys", + "log", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.3", + "thiserror", +] + [[package]] name = "ndk-context" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +[[package]] +name = "ndk-glue" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0c4a7b83860226e6b4183edac21851f05d5a51756e97a1144b7f5a6b63e65f" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk 0.6.0", + "ndk-context", + "ndk-macro", + "ndk-sys 0.3.0", +] + +[[package]] +name = "ndk-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" +dependencies = [ + "darling 0.13.4", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ndk-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys", +] + [[package]] name = "nix" version = "0.26.4" @@ -1425,6 +1700,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -1444,6 +1730,48 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive 0.7.3", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "objc" version = "0.2.7" @@ -1494,6 +1822,38 @@ dependencies = [ "memchr", ] +[[package]] +name = "oboe" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8b61bebd49e5d43f5f8cc7ee2891c16e0f41ec7954d36bcb6c14c5e0de867fb" +dependencies = [ + "jni 0.21.1", + "ndk 0.8.0", + "ndk-context", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bb09a4a2b1d668170cfe0a7d5bc103f8999fb316c98099b6a9939c9f2e79d" +dependencies = [ + "cc", +] + +[[package]] +name = "ogg" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6951b4e8bf21c8193da321bcce9c9dd2e13c858fe078bf9054a288b419ae5d6e" +dependencies = [ + "byteorder", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -1544,15 +1904,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "oxilangtag" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f3f87617a86af77fa3691e6350483e7154c2ead9f1261b75130e21ca0f8acb" -dependencies = [ - "serde", -] - [[package]] name = "parking_lot" version = "0.12.3" @@ -1666,6 +2017,25 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + [[package]] name = "proc-macro2" version = "1.0.84" @@ -1842,6 +2212,20 @@ dependencies = [ "winreg", ] +[[package]] +name = "rodio" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6006a627c1a38d37f3d3a85c6575418cfe34a5392d60a686d0071e1c8d427acb" +dependencies = [ + "claxon", + "cpal", + "hound", + "lewton", + "symphonia", + "thiserror", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2077,12 +2461,11 @@ dependencies = [ [[package]] name = "speech-dispatcher" -version = "0.16.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5727d53c474ba5ada07784ad7d203cf896a74854cfee0eb32376b00759eb2972" +checksum = "6666f544c544d04049f40dfaebd4e3246ce9add2b7ad69c5cf89459492f01346" dependencies = [ "lazy_static", - "libc", "speech-dispatcher-sys", ] @@ -2092,7 +2475,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c3e8acdf2b1f4bb13f1813b40b52f3edf4cc94d8a55fe713a584f672a10388d" dependencies = [ - "bindgen", + "bindgen 0.69.4", ] [[package]] @@ -2104,12 +2487,67 @@ dependencies = [ "lock_api", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "symphonia" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "815c942ae7ee74737bb00f965fa5b5a2ac2ce7b6c01c0cc169bbeaf7abd5f5a9" +dependencies = [ + "lazy_static", + "symphonia-bundle-mp3", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c01c2aae70f0f1fb096b6f0ff112a930b1fb3626178fba3ae68b09dce71706d4" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-core" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "798306779e3dc7d5231bd5691f5a813496dc79d3f56bf82e25789f2094e022c3" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc622b9841a10089c5b18e99eb904f4341615d5aa55bbf4eedde1be721a4023c" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + [[package]] name = "syn" version = "1.0.109" @@ -2221,6 +2659,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2335,6 +2782,17 @@ dependencies = [ "winnow 0.5.40", ] +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow 0.5.40", +] + [[package]] name = "toml_edit" version = "0.22.13" @@ -2414,25 +2872,42 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tts" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801b18dbbef73ee5d5730e6b73771db1ae3b4d0f4376f6b001520b44127ca3c0" +version = "0.23.0" +source = "git+https://github.com/Bear-03/tts-rs?branch=synthesize#4f4ab5325255f73c54306328da82be51455fc6c8" dependencies = [ "cocoa-foundation", "core-foundation", "dyn-clonable", - "jni", + "jni 0.19.0", "lazy_static", "libc", "log", - "ndk-context", + "ndk-glue", "objc", - "oxilangtag", "speech-dispatcher", "thiserror", + "unic-langid", "wasm-bindgen", "web-sys", - "windows 0.56.0", + "windows 0.39.0", +] + +[[package]] +name = "unic-langid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dd9d1e72a73b25e07123a80776aae3e7b0ec461ef94f9151eed6ec88005a44" +dependencies = [ + "unic-langid-impl", +] + +[[package]] +name = "unic-langid-impl" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a5422c1f65949306c99240b81de9f3f15929f5a8bfe05bb44b034cc8bf593e5" +dependencies = [ + "tinystr", ] [[package]] @@ -2721,6 +3196,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" +dependencies = [ + "windows_aarch64_msvc 0.39.0", + "windows_i686_gnu 0.39.0", + "windows_i686_msvc 0.39.0", + "windows_x86_64_gnu 0.39.0", + "windows_x86_64_msvc 0.39.0", +] + [[package]] name = "windows" version = "0.51.1" @@ -2741,6 +3229,16 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-targets 0.52.5", +] + [[package]] name = "windows" version = "0.56.0" @@ -2769,6 +3267,16 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets 0.52.5", +] + [[package]] name = "windows-core" version = "0.56.0" @@ -2903,6 +3411,12 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +[[package]] +name = "windows_aarch64_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -2921,6 +3435,12 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +[[package]] +name = "windows_i686_gnu" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -2945,6 +3465,12 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +[[package]] +name = "windows_i686_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -2963,6 +3489,12 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +[[package]] +name = "windows_x86_64_gnu" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -2999,6 +3531,12 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +[[package]] +name = "windows_x86_64_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" diff --git a/Cargo.toml b/Cargo.toml index aa9ad65..9aa94a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,8 @@ OriginalFilename = "stupid robot nuisance" [dependencies] enigo = {version = "0.2.1", features = ["x11rb"]} screenshots = "0.8.6" -tts = { version = "0.26.0", features = ["speech_dispatcher_0_11"], default-features = false } +tts = { git = "https://github.com/Bear-03/tts-rs", branch = "synthesize" } +rodio = { version = "0.19.0", optional = true } rand = "0.8.4" tokio = { version = "1.35.1", features = ["full"] } serde = { version = "1.0.195", features = ["derive"] } @@ -56,4 +57,4 @@ winresource = "0.1" [features] invisibility = ["dep:daemonize"] advanced = ["dep:windows"] -#microphone = [] +microphone = ["dep:rodio"] diff --git a/README.md b/README.md index c869c87..52bca03 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,12 @@ currently, there are 3 versions (not including crosses of any): - default (basic movement and window) - invisibility (no console window) - advanced (advanced movement feature) +- microphone (pipe jerry into microphone) **the `advanced` feature requires administrator privileges. this is why it is seperate from `default`. it also depends on the `windows` crate, so it does not support linux/macos.** +**the `microphone` feature requires [virtual audio cable.](https://vac.muzychenko.net/en/) it only supports windows currently.** + **the `invisibility` feature has no console window, so it cannot be regularly exited out of. you'll need to kill its process.** i will also not be publishing any invisible or advanced builds for jerry beyond [v0.3.4](https://github.com/callmeclover/jerry/releases/tag/v0.3.4) and [v1.0.0](https://github.com/callmeclover/jerry/releases/tag/v1.0.0) respectively. build them yourself with `cargo build --features invisible` or `cargo build --features advanced`. diff --git a/src/config.rs b/src/config.rs index d176713..935b894 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,9 +1,9 @@ use cached::proc_macro::cached; +#[cfg(not(feature = "invisibility"))] +use dialoguer::{theme::ColorfulTheme, Confirm}; use serde::{Deserialize, Serialize}; use std::{fs, path::Path}; use toml::{de::Error, from_str, to_string_pretty}; -#[cfg(not(feature = "invisibility"))] -use dialoguer::{theme::ColorfulTheme, Confirm}; #[derive(Debug, Serialize, Deserialize, Default, Clone, Eq, Hash, PartialEq)] /// Jerry's config struct. diff --git a/src/func.rs b/src/func.rs index ef6db45..5a489d2 100644 --- a/src/func.rs +++ b/src/func.rs @@ -7,7 +7,6 @@ use cocoa_foundation::foundation::NSRunLoop; #[cfg(target_os = "macos")] use objc::{class, msg_send, sel, sel_impl}; -#[allow(clippy::wildcard_imports)] use crate::{ get_config, lists::*, Speed, SPEED_WEIGHTED_LISTS_FAST, SPEED_WEIGHTED_LISTS_NORMAL, SPEED_WEIGHTED_LISTS_SLOW, @@ -28,6 +27,24 @@ use std::{fs::File, str::FromStr, sync::Mutex, thread}; use tokio::time::{sleep, Duration}; use tts::Tts; +#[cfg(all(feature = "microphone", target_os = "windows"))] +use rodio::{ + cpal::{self, traits::HostTrait}, + Decoder, Device, DeviceTrait, OutputStream, Sink, +}; +#[cfg(all(feature = "microphone", target_os = "windows"))] +use std::{io::Cursor, sync::Arc}; + +#[cfg(all(feature = "microphone", target_os = "windows"))] +struct AsRefArcVec(Arc>); + +#[cfg(all(feature = "microphone", target_os = "windows"))] +impl AsRef<[u8]> for AsRefArcVec { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + lazy_static! { static ref IS_SHIFT_PRESSED: Mutex = Mutex::new(false); static ref IS_CTRL_PRESSED: Mutex = Mutex::new(false); @@ -322,6 +339,25 @@ fn quote(tts: &mut Tts, rng: &mut rand::rngs::ThreadRng) { let index2: WeightedIndex = WeightedIndex::new(list.iter().map(|item| item.1)).unwrap(); let quote: &str = list[index2.sample(rng)].0; println!("{quote}"); + #[cfg(all(feature = "microphone", target_os = "windows"))] + { + let host: cpal::Host = cpal::default_host(); + let device: &Device = &host + .output_devices() + .unwrap() + .filter(|d: &Device| d.name().unwrap() == "Line 1 (Virtual Audio Cable)") + .collect::>()[0]; + + let (_stream, stream_handle) = OutputStream::try_from_device(device).unwrap(); + let sink = Sink::try_new(&stream_handle).unwrap(); + let speech: Arc> = Arc::new(tts.synthesize(quote).unwrap()); + let source: Decoder> = + Decoder::new(Cursor::new(AsRefArcVec(speech))).unwrap(); + sink.append(source); + sink.play(); + sink.detach(); + return; + } let _ = tts.speak(quote, true); #[cfg(target_os = "macos")] { @@ -338,8 +374,28 @@ fn quote_gen(tts: &mut Tts) { if get_config().extra.do_debugging { tracing::info!("quote_gen: generating sentence") } + let quote: &str = &gen_sentence(SentenceConfigBuilder::random().build()); println!("{quote}"); + #[cfg(all(feature = "microphone", target_os = "windows"))] + { + let host: cpal::Host = cpal::default_host(); + let device: &Device = &host + .output_devices() + .unwrap() + .filter(|d: &Device| d.name().unwrap() == "Line 1 (Virtual Audio Cable)") + .collect::>()[0]; + + let (_stream, stream_handle) = OutputStream::try_from_device(device).unwrap(); + let sink = Sink::try_new(&stream_handle).unwrap(); + let speech: Arc> = Arc::new(tts.synthesize(quote).unwrap()); + let source: Decoder> = + Decoder::new(Cursor::new(AsRefArcVec(speech))).unwrap(); + sink.append(source); + sink.play(); + sink.detach(); + return; + } let _ = tts.speak(quote, true); #[cfg(target_os = "macos")] { @@ -373,6 +429,25 @@ async fn quote_gen_ext(tts: &mut Tts) { .await .unwrap(); println!("{quote}"); + #[cfg(all(feature = "microphone", target_os = "windows"))] + { + let host: cpal::Host = cpal::default_host(); + let device: &Device = &host + .output_devices() + .unwrap() + .filter(|d: &Device| d.name().unwrap() == "Line 1 (Virtual Audio Cable)") + .collect::>()[0]; + + let (_stream, stream_handle) = OutputStream::try_from_device(device).unwrap(); + let sink = Sink::try_new(&stream_handle).unwrap(); + let speech: Arc> = Arc::new(tts.synthesize(quote).unwrap()); + let source: Decoder> = + Decoder::new(Cursor::new(AsRefArcVec(speech))).unwrap(); + sink.append(source); + sink.play(); + sink.detach(); + return; + } let _ = tts.speak(quote, true); #[cfg(target_os = "macos")] { @@ -581,7 +656,7 @@ fn pen(pen: &mut PenInjector, rng: &mut rand::rngs::ThreadRng) { } #[cfg(feature = "advanced")] -/// Advanced main_logic function. Used only for things like gamepad and pen support. +/// Advanced main_logic function. Used only for things like gamepad and pen support. pub async fn main_logic_adv( options: &[(&str, usize)], tts: &mut Tts, diff --git a/src/main.rs b/src/main.rs index fb69dd3..fdb363c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,14 +3,6 @@ windows_subsystem = "windows" )] -// Begin allow clippy warnings - -#![allow(clippy::cast_possible_truncation)] -#![allow(clippy::cast_precision_loss)] -#![allow(clippy::cast_sign_loss)] - -// End allow clippy warnings - mod config; mod func; mod lists; @@ -18,9 +10,7 @@ mod model; use config::{get_config, get_options, Config}; use enigo::{Enigo, Settings}; -#[allow(clippy::wildcard_imports)] use func::*; -#[allow(clippy::wildcard_imports)] use model::*; use std::fs::{create_dir, metadata}; use tts::Tts;