diff --git a/Cargo.lock b/Cargo.lock index d3f4b07..0c9b1d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,22 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ab_glyph" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" - [[package]] name = "accesskit" version = "0.12.1" @@ -114,28 +98,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" -[[package]] -name = "alsa" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2562ad8dcf0f789f65c6fdaad8a8a9708ed6b488e649da28c01656ad66b8b47" -dependencies = [ - "alsa-sys", - "bitflags 1.3.2", - "libc", - "nix 0.24.3", -] - -[[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-activity" version = "0.4.3" @@ -483,12 +445,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.5" @@ -516,25 +472,6 @@ dependencies = [ "bevy_ecs", ] -[[package]] -name = "bevy_animation" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aa37683b1281e1ba8cf285644e6e3f0704f14b3901c5ee282067ff7ff6f4a56" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_ecs", - "bevy_hierarchy", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_time", - "bevy_transform", - "bevy_utils", -] - [[package]] name = "bevy_app" version = "0.12.1" @@ -595,24 +532,6 @@ dependencies = [ "syn 2.0.41", ] -[[package]] -name = "bevy_audio" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a69889e1bfa4dbac4e641536b94f91c441da55796ad9832e77836b8264688b" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_derive", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_transform", - "bevy_utils", - "oboe", - "rodio", -] - [[package]] name = "bevy_core" version = "0.12.1" @@ -719,72 +638,6 @@ dependencies = [ "encase_derive_impl", ] -[[package]] -name = "bevy_gilrs" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b81ca2ebf66cbc7f998f1f142b15038ffe3c4ae1d51f70adda26dcf51b0c4ca" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_input", - "bevy_log", - "bevy_time", - "bevy_utils", - "gilrs", - "thiserror", -] - -[[package]] -name = "bevy_gizmos" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db232274ddca2ae452eb2731b98267b795d133ddd14013121bc7daddde1c7491" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_transform", - "bevy_utils", -] - -[[package]] -name = "bevy_gltf" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85adc6b1fc86687bf67149e0bafaa4d6da432232fa956472d1b37f19121d3ace" -dependencies = [ - "base64 0.13.1", - "bevy_animation", - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_hierarchy", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_scene", - "bevy_tasks", - "bevy_transform", - "bevy_utils", - "gltf", - "percent-encoding", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "bevy_hierarchy" version = "0.12.1" @@ -821,33 +674,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f124bece9831afd80897815231072d51bfe3ac58c6bb58eca8880963b6d0487c" dependencies = [ "bevy_a11y", - "bevy_animation", "bevy_app", "bevy_asset", - "bevy_audio", "bevy_core", "bevy_core_pipeline", "bevy_derive", "bevy_diagnostic", "bevy_ecs", - "bevy_gilrs", - "bevy_gizmos", - "bevy_gltf", "bevy_hierarchy", "bevy_input", "bevy_log", "bevy_math", - "bevy_pbr", "bevy_ptr", "bevy_reflect", "bevy_render", - "bevy_scene", - "bevy_sprite", "bevy_tasks", - "bevy_text", "bevy_time", "bevy_transform", - "bevy_ui", "bevy_utils", "bevy_window", "bevy_winit", @@ -902,32 +745,6 @@ dependencies = [ "glam", ] -[[package]] -name = "bevy_pbr" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520bfd2a898c74f84ea52cfb8eb061f37373ad15e623489d5f75d27ebd6138fe" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core_pipeline", - "bevy_derive", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "bevy_window", - "bitflags 2.4.1", - "bytemuck", - "fixedbitset", - "naga_oil", - "radsort", - "smallvec", - "thread_local", -] - [[package]] name = "bevy_ptr" version = "0.12.1" @@ -999,11 +816,9 @@ dependencies = [ "hexasphere", "image", "js-sys", - "ktx2", "naga", "naga_oil", "profiling", - "ruzstd", "serde", "smallvec", "thiserror", @@ -1025,53 +840,6 @@ dependencies = [ "syn 2.0.41", ] -[[package]] -name = "bevy_scene" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7df078b5e406e37c8a1c6ba0d652bf105fde713ce3c3efda7263fe27467eee5" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_derive", - "bevy_ecs", - "bevy_hierarchy", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "ron", - "serde", - "thiserror", - "uuid", -] - -[[package]] -name = "bevy_sprite" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cc0c9d946e17e3e0aaa202f182837bc796c4f862b2e5a805134f873f21cf7f" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core_pipeline", - "bevy_derive", - "bevy_ecs", - "bevy_log", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "bitflags 2.4.1", - "bytemuck", - "fixedbitset", - "guillotiere", - "radsort", - "rectangle-pack", - "thiserror", -] - [[package]] name = "bevy_tasks" version = "0.12.1" @@ -1086,28 +854,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "bevy_text" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9a79d49ca06170d69149949b134c14e8b99ace1444c1ca2cd4743b19d5b055" -dependencies = [ - "ab_glyph", - "bevy_app", - "bevy_asset", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_transform", - "bevy_utils", - "bevy_window", - "glyph_brush_layout", - "serde", - "thiserror", -] - [[package]] name = "bevy_time" version = "0.12.1" @@ -1136,36 +882,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "bevy_ui" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d785e3b75dabcb2a8ad0d50933f8f3446d59e512cabc2d2a145e28c2bb8792ba" -dependencies = [ - "bevy_a11y", - "bevy_app", - "bevy_asset", - "bevy_core_pipeline", - "bevy_derive", - "bevy_ecs", - "bevy_hierarchy", - "bevy_input", - "bevy_log", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_text", - "bevy_transform", - "bevy_utils", - "bevy_window", - "bytemuck", - "serde", - "smallvec", - "taffy", - "thiserror", -] - [[package]] name = "bevy_utils" version = "0.12.1" @@ -1236,26 +952,6 @@ dependencies = [ "winit", ] -[[package]] -name = "bindgen" -version = "0.69.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" -dependencies = [ - "bitflags 2.4.1", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.41", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -1388,21 +1084,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -1415,17 +1096,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" -[[package]] -name = "clang-sys" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" -dependencies = [ - "glob", - "libc", - "libloading 0.7.4", -] - [[package]] name = "clap" version = "4.4.11" @@ -1503,16 +1173,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-queue" version = "2.4.0" @@ -1599,60 +1259,6 @@ 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.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3120ebb80a9de008e638ad833d4127d50ea3d3a960ea23ea69bc66d9358a028" -dependencies = [ - "bindgen", -] - -[[package]] -name = "cpal" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d959d90e938c5493000514b446987c07aed46c668faaa7d34d6c7a67b1a578c" -dependencies = [ - "alsa", - "core-foundation-sys", - "coreaudio-rs", - "dasp_sample", - "jni 0.19.0", - "js-sys", - "libc", - "mach2", - "ndk", - "ndk-context", - "oboe", - "once_cell", - "parking_lot", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "windows 0.46.0", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - [[package]] name = "crossbeam-channel" version = "0.5.9" @@ -1718,12 +1324,125 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "dasp" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7381b67da416b639690ac77c73b86a7b5e64a29e31d1f75fb3b1102301ef355a" +dependencies = [ + "dasp_envelope", + "dasp_frame", + "dasp_interpolate", + "dasp_peak", + "dasp_ring_buffer", + "dasp_rms", + "dasp_sample", + "dasp_signal", + "dasp_slice", + "dasp_window", +] + +[[package]] +name = "dasp_envelope" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec617ce7016f101a87fe85ed44180839744265fae73bb4aa43e7ece1b7668b6" +dependencies = [ + "dasp_frame", + "dasp_peak", + "dasp_ring_buffer", + "dasp_rms", + "dasp_sample", +] + +[[package]] +name = "dasp_frame" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a3937f5fe2135702897535c8d4a5553f8b116f76c1529088797f2eee7c5cd6" +dependencies = [ + "dasp_sample", +] + +[[package]] +name = "dasp_interpolate" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc975a6563bb7ca7ec0a6c784ead49983a21c24835b0bc96eea11ee407c7486" +dependencies = [ + "dasp_frame", + "dasp_ring_buffer", + "dasp_sample", +] + +[[package]] +name = "dasp_peak" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf88559d79c21f3d8523d91250c397f9a15b5fc72fbb3f87fdb0a37b79915bf" +dependencies = [ + "dasp_frame", + "dasp_sample", +] + +[[package]] +name = "dasp_ring_buffer" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07d79e19b89618a543c4adec9c5a347fe378a19041699b3278e616e387511ea1" + +[[package]] +name = "dasp_rms" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6c5dcb30b7e5014486e2822537ea2beae50b19722ffe2ed7549ab03774575aa" +dependencies = [ + "dasp_frame", + "dasp_ring_buffer", + "dasp_sample", +] + [[package]] name = "dasp_sample" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" +[[package]] +name = "dasp_signal" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa1ab7d01689c6ed4eae3d38fe1cea08cba761573fbd2d592528d55b421077e7" +dependencies = [ + "dasp_envelope", + "dasp_frame", + "dasp_interpolate", + "dasp_peak", + "dasp_ring_buffer", + "dasp_rms", + "dasp_sample", + "dasp_window", +] + +[[package]] +name = "dasp_slice" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e1c7335d58e7baedafa516cb361360ff38d6f4d3f9d9d5ee2a2fc8e27178fa1" +dependencies = [ + "dasp_frame", + "dasp_sample", +] + +[[package]] +name = "dasp_window" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99ded7b88821d2ce4e8b842c9f1c86ac911891ab89443cc1de750cae764c5076" +dependencies = [ + "dasp_sample", +] + [[package]] name = "data-encoding" version = "2.5.0" @@ -1859,15 +1578,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "euclid" -version = "0.22.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f253bc5c813ca05792837a0ff4b3a580336b224512d48f7eda1d7dd9210787" -dependencies = [ - "num-traits", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -1910,31 +1620,12 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" -[[package]] -name = "fdeflate" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" -dependencies = [ - "simd-adler32", -] - [[package]] name = "fixedbitset" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -2094,40 +1785,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gilrs" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b2e57a9cb946b5d04ae8638c5f554abb5a9f82c4c950fd5b1fee6d119592fb" -dependencies = [ - "fnv", - "gilrs-core", - "log", - "uuid", - "vec_map", -] - -[[package]] -name = "gilrs-core" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0af1827b7dd2f36d740ae804c1b3ea0d64c12533fb61ff91883005143a0e8c5a" -dependencies = [ - "core-foundation", - "inotify", - "io-kit-sys", - "js-sys", - "libc", - "libudev-sys", - "log", - "nix 0.27.1", - "uuid", - "vec_map", - "wasm-bindgen", - "web-sys", - "windows 0.52.0", -] - [[package]] name = "gimli" version = "0.28.1" @@ -2144,12 +1801,6 @@ dependencies = [ "serde", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "glow" version = "0.12.3" @@ -2162,53 +1813,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "gltf" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b78f069cf941075835822953c345b9e1edd67ae347b81ace3aea9de38c2ef33" -dependencies = [ - "byteorder", - "gltf-json", - "lazy_static", - "serde_json", -] - -[[package]] -name = "gltf-derive" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "438ffe1a5540d75403feaf23636b164e816e93f6f03131674722b3886ce32a57" -dependencies = [ - "inflections", - "proc-macro2", - "quote", - "syn 2.0.41", -] - -[[package]] -name = "gltf-json" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655951ba557f2bc69ea4b0799446bae281fa78efae6319968bdd2c3e9a06d8e1" -dependencies = [ - "gltf-derive", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "glyph_brush_layout" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc32c2334f00ca5ac3695c5009ae35da21da8c62d255b5b96d56e2597a637a38" -dependencies = [ - "ab_glyph", - "approx", - "xi-unicode", -] - [[package]] name = "gpu-alloc" version = "0.6.0" @@ -2261,12 +1865,6 @@ dependencies = [ "bitflags 2.4.1", ] -[[package]] -name = "grid" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eec1c01eb1de97451ee0d60de7d81cf1e72aabefb021616027f3d1c3ec1c723c" - [[package]] name = "guardian" version = "0.1.0" @@ -2298,16 +1896,19 @@ version = "0.1.0" dependencies = [ "async-compat", "audiopus", - "base64 0.21.5", + "base64", "bevy", "byteorder", "bytes", "crossbeam-channel", + "dasp", "dcs-grpc", "futures-core", "futures-util", "guardian_commands", + "hound", "reqwest", + "samplerate", "serde", "serde_json", "serde_repr", @@ -2320,18 +1921,8 @@ dependencies = [ "tokio-util", "tonic", "tracing", + "urlencoding", "uuid", - "windows 0.52.0", -] - -[[package]] -name = "guillotiere" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62d5865c036cb1393e23c50693df631d3f5d7bcca4c04fe4cc0fd592e74a782" -dependencies = [ - "euclid", - "svg_fmt", ] [[package]] @@ -2422,6 +2013,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 = "0.2.11" @@ -2532,7 +2129,6 @@ dependencies = [ "color_quant", "num-rational", "num-traits", - "png", ] [[package]] @@ -2555,32 +2151,6 @@ dependencies = [ "hashbrown 0.14.3", ] -[[package]] -name = "inflections" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" - -[[package]] -name = "inotify" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "instant" version = "0.1.12" @@ -2593,16 +2163,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "io-kit-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4769cb30e5dcf1710fc6730d3e94f78c47723a014a567de385e113c737394640" -dependencies = [ - "core-foundation-sys", - "mach2", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -2624,34 +2184,6 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" -[[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.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - [[package]] name = "jni-sys" version = "0.3.0" @@ -2687,38 +2219,12 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "ktx2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d65e08a9ec02e409d27a0139eaa6b9756b4d81fe7cde71f6941a83730ce838" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[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.151" @@ -2757,13 +2263,12 @@ dependencies = [ ] [[package]] -name = "libudev-sys" -version = "0.1.4" +name = "libsamplerate-sys" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +checksum = "28853b399f78f8281cd88d333b54a63170c4275f6faea66726a2bea5cca72e0d" dependencies = [ - "libc", - "pkg-config", + "cmake", ] [[package]] @@ -2788,15 +2293,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "mach2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" -dependencies = [ - "libc", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -2871,7 +2367,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", - "simd-adler32", ] [[package]] @@ -2881,7 +2376,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", - "log", "wasi", "windows-sys 0.48.0", ] @@ -2980,28 +2474,6 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", -] - -[[package]] -name = "nix" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" -dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -3037,17 +2509,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "num-integer" version = "0.1.45" @@ -3184,38 +2645,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "oboe" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" -dependencies = [ - "jni 0.20.0", - "ndk", - "ndk-context", - "num-derive", - "num-traits", - "oboe-sys", -] - -[[package]] -name = "oboe-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" -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" @@ -3281,15 +2710,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "owned_ttf_parser" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" -dependencies = [ - "ttf-parser", -] - [[package]] name = "parking" version = "2.2.0" @@ -3325,12 +2745,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -3396,19 +2810,6 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "png" -version = "0.17.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - [[package]] name = "pp-rs" version = "0.2.1" @@ -3589,12 +2990,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" -[[package]] -name = "rectangle-pack" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d463f2884048e7153449a55166f91028d5b0ea53c79377099ce4e8cf0cf9bb" - [[package]] name = "redox_syscall" version = "0.3.5" @@ -3675,7 +3070,7 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.5", + "base64", "bytes", "encoding_rs", "futures-core", @@ -3708,23 +3103,13 @@ dependencies = [ "winreg", ] -[[package]] -name = "rodio" -version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b1bb7b48ee48471f55da122c0044fcc7600cfcc85db88240b89cb832935e611" -dependencies = [ - "cpal", - "lewton", -] - [[package]] name = "ron" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ - "base64 0.21.5", + "base64", "bitflags 2.4.1", "serde", "serde_derive", @@ -3761,17 +3146,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" -[[package]] -name = "ruzstd" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" -dependencies = [ - "byteorder", - "thiserror-core", - "twox-hash", -] - [[package]] name = "ryu" version = "1.0.16" @@ -3779,12 +3153,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] -name = "same-file" -version = "1.0.6" +name = "samplerate" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +checksum = "e032b2b24715c4f982f483ea3abdb3c9ba444d9f63e87b2843d6f998f5ba2698" dependencies = [ - "winapi-util", + "libsamplerate-sys", ] [[package]] @@ -3912,12 +3286,6 @@ dependencies = [ "libc", ] -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - [[package]] name = "simsearch" version = "0.2.4" @@ -3996,12 +3364,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "svg_fmt" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2" - [[package]] name = "symspell" version = "0.4.3" @@ -4079,18 +3441,6 @@ dependencies = [ "libc", ] -[[package]] -name = "taffy" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2287b6d7f721ada4cddf61ade5e760b2c6207df041cac9bfaa192897362fd3" -dependencies = [ - "arrayvec", - "grid", - "num-traits", - "slotmap", -] - [[package]] name = "tempfile" version = "3.8.1" @@ -4122,26 +3472,6 @@ dependencies = [ "thiserror-impl", ] -[[package]] -name = "thiserror-core" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c001ee18b7e5e3f62cbf58c7fe220119e68d902bb7443179c0c8aef30090e999" -dependencies = [ - "thiserror-core-impl", -] - -[[package]] -name = "thiserror-core-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", -] - [[package]] name = "thiserror-impl" version = "1.0.51" @@ -4318,7 +3648,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.5", + "base64", "bytes", "h2", "http", @@ -4486,22 +3816,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "ttf-parser" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - [[package]] name = "unicase" version = "2.7.0" @@ -4561,6 +3875,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.1" @@ -4589,12 +3909,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -4607,16 +3921,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "want" version = "0.3.1" @@ -4878,15 +4182,6 @@ dependencies = [ "windows-targets 0.42.2", ] -[[package]] -name = "windows" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows" version = "0.48.0" @@ -4898,25 +4193,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core", - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.0", -] - [[package]] name = "windows-implement" version = "0.48.0" @@ -5152,19 +4428,16 @@ dependencies = [ "instant", "libc", "log", - "mio", "ndk", "objc2", "once_cell", "orbclient", - "percent-encoding", "raw-window-handle", "redox_syscall 0.3.5", "wasm-bindgen", "wayland-scanner", "web-sys", "windows-sys 0.45.0", - "x11-dl", ] [[package]] @@ -5186,23 +4459,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "xi-unicode" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" - [[package]] name = "xml-rs" version = "0.8.19" diff --git a/Cargo.toml b/Cargo.toml index 2776397..ae556fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ opt-level = 1 opt-level = 3 [workspace.dependencies] -bevy = { version = "0.12", features = [ +bevy = { version = "0.12", default-features = false, features = [ # "dynamic_linking", "multi-threaded", "trace", @@ -46,7 +46,7 @@ tracing = "0.1.40" [dependencies] bevy.workspace = true -clap.workspace = true +clap = { workspace = true, features = ["derive"] } tokio.workspace = true serde.workspace = true guardian_commands.workspace = true diff --git a/config.toml b/config.toml index b9fac2a..82c6a3a 100644 --- a/config.toml +++ b/config.toml @@ -1,14 +1,13 @@ [srs] -server = "127.0.0.1:5002" +server = "192.168.0.100:5003" [grpc] -url = "http://127.0.0.1:50051/" +url = "http://192.168.0.100:50053/" poll_rate = 10 [stt] url = "http://192.168.0.2:3000/" -[channels.Overlord1-1] -frequency = 251250000 +[channels.Magic1-1] +frequency = 266250000 modulation = "Am" -voice = "David" diff --git a/crates/guardian_commands/src/call.rs b/crates/guardian_commands/src/call.rs index 4742c33..c2c31d1 100644 --- a/crates/guardian_commands/src/call.rs +++ b/crates/guardian_commands/src/call.rs @@ -83,6 +83,35 @@ pub enum Squadron { Wild, Ninja, Jedi, + Hawg, + Boar, + Pig, + Tusk, + ArmyAir, + Apache, + Crow, + Chaos, + Sioux, + Gatling, + Gunslinger, + Hammerhead, + Bootleg, + Palehorse, + Carnivore, + Saber, + Hornet, + Squid, + Ragin, + Roman, + Sting, + Jury, + Joker, + Ram, + Hawk, + Devil, + Check, + Snake, + Custom(String), } impl ToString for Squadron { @@ -95,6 +124,7 @@ impl ToString for Squadron { Squadron::Dodge => "Dodge".to_string(), Squadron::Ford => "Ford".to_string(), Squadron::Chevy => "Chevy".to_string(), + Squadron::Hornet => "Hornet".to_string(), Squadron::Pontiac => "Pontiac".to_string(), Squadron::Viper => "Viper".to_string(), Squadron::Venom => "Venom".to_string(), @@ -108,6 +138,34 @@ impl ToString for Squadron { Squadron::Wild => "Wild".to_string(), Squadron::Ninja => "Ninja".to_string(), Squadron::Jedi => "Jedi".to_string(), + Squadron::Hawg => "Hawg".to_string(), + Squadron::Boar => "Boar".to_string(), + Squadron::Pig => "Pig".to_string(), + Squadron::Tusk => "Tusk".to_string(), + Squadron::ArmyAir => "ArmyAir".to_string(), + Squadron::Apache => "Apache".to_string(), + Squadron::Crow => "Crow".to_string(), + Squadron::Chaos => "Chaos".to_string(), + Squadron::Sioux => "Sioux".to_string(), + Squadron::Gatling => "Gatling".to_string(), + Squadron::Gunslinger => "Gunslinger".to_string(), + Squadron::Hammerhead => "Hammerhead".to_string(), + Squadron::Bootleg => "Bootleg".to_string(), + Squadron::Palehorse => "Palehorse".to_string(), + Squadron::Carnivore => "Carnivore".to_string(), + Squadron::Saber => "Saber".to_string(), + Squadron::Squid => "Squid".to_string(), + Squadron::Ragin => "Ragin".to_string(), + Squadron::Roman => "Roman".to_string(), + Squadron::Sting => "Sting".to_string(), + Squadron::Jury => "Jury".to_string(), + Squadron::Joker => "Joker".to_string(), + Squadron::Ram => "Ram".to_string(), + Squadron::Hawk => "Hawk".to_string(), + Squadron::Devil => "Devil".to_string(), + Squadron::Check => "Check".to_string(), + Squadron::Snake => "Snake".to_string(), + Squadron::Custom(c) => c.to_string(), } } } @@ -124,6 +182,7 @@ impl std::str::FromStr for Squadron { "Dodge" => Ok(Squadron::Dodge), "Ford" => Ok(Squadron::Ford), "Chevy" => Ok(Squadron::Chevy), + "Hornet" => Ok(Squadron::Hornet), "Pontiac" => Ok(Squadron::Pontiac), "Viper" => Ok(Squadron::Viper), "Venom" => Ok(Squadron::Venom), @@ -137,7 +196,34 @@ impl std::str::FromStr for Squadron { "Wild" => Ok(Squadron::Wild), "Ninja" => Ok(Squadron::Ninja), "Jedi" => Ok(Squadron::Jedi), - _ => Err("Invalid squadron".into()), + "Hawg" => Ok(Squadron::Hawg), + "Boar" => Ok(Squadron::Boar), + "Pig" => Ok(Squadron::Pig), + "Tusk" => Ok(Squadron::Tusk), + "ArmyAir" => Ok(Squadron::ArmyAir), + "Apache" => Ok(Squadron::Apache), + "Crow" => Ok(Squadron::Crow), + "Chaos" => Ok(Squadron::Chaos), + "Sioux" => Ok(Squadron::Sioux), + "Gatling" => Ok(Squadron::Gatling), + "Gunslinger" => Ok(Squadron::Gunslinger), + "Hammerhead" => Ok(Squadron::Hammerhead), + "Bootleg" => Ok(Squadron::Bootleg), + "Palehorse" => Ok(Squadron::Palehorse), + "Carnivore" => Ok(Squadron::Carnivore), + "Saber" => Ok(Squadron::Saber), + "Squid" => Ok(Squadron::Squid), + "Ragin" => Ok(Squadron::Ragin), + "Roman" => Ok(Squadron::Roman), + "Sting" => Ok(Squadron::Sting), + "Jury" => Ok(Squadron::Jury), + "Joker" => Ok(Squadron::Joker), + "Ram" => Ok(Squadron::Ram), + "Hawk" => Ok(Squadron::Hawk), + "Devil" => Ok(Squadron::Devil), + "Check" => Ok(Squadron::Check), + "Snake" => Ok(Squadron::Snake), + c => Ok(Squadron::Custom(c.to_string())), } } } @@ -225,6 +311,7 @@ fn parse_element(input: &str) -> IResult<&str, Element> { "dodge" => Squadron::Dodge, "ford" => Squadron::Ford, "chevy" => Squadron::Chevy, + "hornet" => Squadron::Hornet, "pontiac" => Squadron::Pontiac, "viper" => Squadron::Viper, "venom" => Squadron::Venom, @@ -238,13 +325,41 @@ fn parse_element(input: &str) -> IResult<&str, Element> { "wild" => Squadron::Wild, "ninja" => Squadron::Ninja, "jedi" => Squadron::Jedi, - _ => { - return Err(NomError::Error(nom::error::Error { - input: squadron_str, - code: ErrorKind::Alpha, - })) - } + "hawg" => Squadron::Hawg, + "boar" => Squadron::Boar, + "pig" => Squadron::Pig, + "tusk" => Squadron::Tusk, + "armyair" => Squadron::ArmyAir, + "apache" => Squadron::Apache, + "crow" => Squadron::Crow, + "chaos" => Squadron::Chaos, + "sioux" => Squadron::Sioux, + "gatling" => Squadron::Gatling, + "gunslinger" => Squadron::Gunslinger, + "hammerhead" => Squadron::Hammerhead, + "bootleg" => Squadron::Bootleg, + "palehorse" => Squadron::Palehorse, + "carnivore" => Squadron::Carnivore, + "saber" => Squadron::Saber, + "squid" => Squadron::Squid, + "ragin" => Squadron::Ragin, + "roman" => Squadron::Roman, + "sting" => Squadron::Sting, + "jury" => Squadron::Jury, + "joker" => Squadron::Joker, + "ram" => Squadron::Ram, + "hawk" => Squadron::Hawk, + "devil" => Squadron::Devil, + "check" => Squadron::Check, + "snake" => Squadron::Snake, + c => Squadron::Custom(c.to_string()), }; + // _ => { + // return Err(NomError::Error(nom::error::Error { + // input: squadron_str, + // code: ErrorKind::Alpha, + // })) + // } let group = group_str.unwrap_or((None, 0, None)).1; let unit = unit_str.unwrap_or((None, 0, None)).1; diff --git a/crates/guardian_commands/src/console.rs b/crates/guardian_commands/src/console.rs index 80b5ce5..8670314 100644 --- a/crates/guardian_commands/src/console.rs +++ b/crates/guardian_commands/src/console.rs @@ -8,7 +8,7 @@ use bevy::{ system::{ResMut, Resource, SystemMeta, SystemParam}, world::{unsafe_world_cell::UnsafeWorldCell, World}, }, - log::{debug, warn}, + log::warn, }; // use bevy::{input::keyboard::KeyboardInput, prelude::*}; // use bevy_egui::egui::{self, Align, ScrollArea, TextEdit}; @@ -118,8 +118,6 @@ unsafe impl SystemParam for ConsoleCommand { let clap_command = T::command().no_binary_name(true); let arg_matches = clap_command.try_get_matches_from(command.args.iter()); - debug!("Trying to parse as `{}`.", command.command_name); - match arg_matches { Ok(matches) => match T::from_arg_matches(&matches) { Ok(from_arg_matches) => { diff --git a/crates/guardian_core/Cargo.toml b/crates/guardian_core/Cargo.toml index 2f9f234..0b82bfe 100644 --- a/crates/guardian_core/Cargo.toml +++ b/crates/guardian_core/Cargo.toml @@ -35,11 +35,7 @@ thiserror = "1.0" symspell = "0.4.3" simsearch = "0.2" -[target.'cfg(target_os = "windows")'.dependencies.windows] -version = "0.52" -features = [ - "Foundation", - "Foundation_Collections", - "Storage_Streams", - "Media_SpeechSynthesis", -] +hound = "3.5.1" +dasp = { version = "0.11.0", features = ["all"] } +urlencoding = "2.1.3" +samplerate = "0.2.4" diff --git a/crates/guardian_core/src/dcs/mission.rs b/crates/guardian_core/src/dcs/mission.rs index 36fed43..954318f 100644 --- a/crates/guardian_core/src/dcs/mission.rs +++ b/crates/guardian_core/src/dcs/mission.rs @@ -14,13 +14,13 @@ use bevy::{ }; use crossbeam_channel::{unbounded, Receiver}; use dcs_grpc::dcs::{ - common::v0::{Coalition, GroupCategory::Airplane, Unit}, + common::v0::{Coalition, GroupCategory, Unit}, mission::v0::{ mission_service_client::MissionServiceClient, stream_units_response::Update, StreamUnitsRequest, }, }; -use tracing::{debug, info, warn}; +use tracing::{error, info, warn}; #[derive(Clone)] enum Response { @@ -65,7 +65,7 @@ fn connect_to_grpc(mut commands: Commands, tokio: Res, url: Res, url: Res { - debug!("Error from gRPC: {:?}", e); // verbose or debug log + error!("Error from gRPC: {:?}", e); // verbose or debug log break; } } @@ -91,6 +91,7 @@ fn connect_to_grpc(mut commands: Commands, tokio: Res, url: Res>, + query: Query<(Entity, &Id, &TextMessage), Added>, url: Res, tokio: Res, ) { - let url = url.to_string(); + for (ent, id, msg) in query.iter() { + let url = url.to_string(); - for (ent, msg) in query.iter() { if msg.as_str().is_empty() { - commands.entity(ent).remove::().despawn(); + commands.entity(ent).remove::(); continue; } let message = msg.clone(); let url = url.clone(); + let id: u32 = id.into(); tokio.0.spawn(async move { - let Ok(mut client) = NetServiceClient::connect(url.to_string()).await else { + let Ok(mut client) = TriggerServiceClient::connect(url.to_string()).await else { return; }; - let request = SendChatRequest { - message: message.to_string(), - coalition: Coalition::All as i32, - // target_player_id: player_id, + let request = OutTextForUnitRequest { + text: message.to_string(), + display_time: 15, + clear_view: false, + unit_id: id, }; info!("> {}", message); - client.send_chat(request).await.ok(); + client.out_text_for_unit(request).await.ok(); }); - commands.entity(ent).remove::().despawn(); + commands.entity(ent).remove::(); } } diff --git a/crates/guardian_core/src/srs.rs b/crates/guardian_core/src/srs.rs index e7671e5..1cbb314 100644 --- a/crates/guardian_core/src/srs.rs +++ b/crates/guardian_core/src/srs.rs @@ -6,9 +6,8 @@ mod voice_codec; mod voice_command; use guardian_commands::{call::parse_call, ConsoleCommandEntered, ConsoleConfiguration}; -use serde::{Deserialize, Serialize}; use simsearch::SimSearch; -use tracing::{error, info, warn}; +use tracing::{debug, error, info, warn}; pub use voice_command::VoiceCommand; use crossbeam_channel::Receiver; @@ -161,8 +160,8 @@ fn listen_srs( commands.entity(ent).insert(ClientHandler(client_handle)); let frequency = radio.frequency; + let modulation = radio.modulation; let id = *id; - let voice = radio.voice.clone(); let stt_url = stt_url.as_str().to_string(); radio.handle = Some(tokio.0.spawn(async move { loop { @@ -212,11 +211,7 @@ fn listen_srs( wav_audio_part: None, frequencies: vec![Frequency { freq: frequency as f64, - modulation: if frequency <= 87_995_000 { - voice_codec::Modulation::Fm - } else { - voice_codec::Modulation::Am - }, + modulation: modulation.into(), encryption: Encryption::None, }], unit_id: id.into(), @@ -266,7 +261,7 @@ fn listen_srs( } } Some(data) = voice_handle.recv() => { - frames.push(synthesize(data.as_str(), &voice).await?).await; + frames.push(synthesize("192.168.0.238:10200", data.as_str()).await?).await; } Some(data) = voice_stream.next() => { match data { @@ -501,9 +496,12 @@ fn handle_voice_command( info!("Received: {}", raw); info!("Interpreted as: {}", cmd); - let Ok((_, call)) = parse_call(cmd) else { - // no command, casual conversations? - return; + let call = match parse_call(cmd) { + Ok((_, call)) => call, + Err(e) => { + debug!("Error parsing call: {:?}", e); + return; + } }; let cmd = call.command; @@ -520,21 +518,6 @@ fn handle_voice_command( } } -#[derive(Default, Clone, Debug, Deserialize, Serialize)] -pub struct Voice(String); - -impl Voice { - pub fn new(voice: impl Into) -> Self { - Self(voice.into()) - } -} - -impl std::fmt::Display for Voice { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) - } -} - #[derive(Component)] pub struct ClientHandler(Receiver); @@ -542,7 +525,6 @@ pub struct ClientHandler(Receiver); pub struct Radio { pub frequency: u64, // the way srs wants it pub modulation: Modulation, - pub voice: Voice, sguid: String, voice_sink: Option>, message_sink: Option>, @@ -550,12 +532,11 @@ pub struct Radio { } impl Radio { - pub fn new(frequency: u64, modulation: impl Into, voice: Voice) -> Self { + pub fn new(frequency: u64, modulation: impl Into) -> Self { let modulation = modulation.into(); Self { frequency, modulation, - voice, sguid: create_sguid(), voice_sink: None, message_sink: None, diff --git a/crates/guardian_core/src/srs/voice_codec.rs b/crates/guardian_core/src/srs/voice_codec.rs index 209591a..3cad737 100644 --- a/crates/guardian_core/src/srs/voice_codec.rs +++ b/crates/guardian_core/src/srs/voice_codec.rs @@ -7,6 +7,8 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use bytes::{BufMut, BytesMut}; use tokio_util::codec::{Decoder, Encoder, LengthDelimitedCodec}; +use super::message; + pub const GUID_LENGTH: usize = 22; pub const PACKET_HEADER_LENGTH: usize = size_of::() // UInt16 Packet Length - 2 bytes @@ -53,6 +55,20 @@ pub enum Modulation { Disabled, } +impl From for Modulation { + fn from(value: message::Modulation) -> Self { + match value { + super::Modulation::Am => Modulation::Am, + super::Modulation::Fm => Modulation::Fm, + super::Modulation::Intercom => Modulation::Intercom, + super::Modulation::Disabled => Modulation::Disabled, + super::Modulation::HaveQuick => Modulation::Disabled, + super::Modulation::Satcom => Modulation::Disabled, + super::Modulation::Mids => Modulation::Disabled, + } + } +} + #[derive(Debug, Clone)] pub enum Encryption { None, diff --git a/crates/guardian_core/src/tts.rs b/crates/guardian_core/src/tts.rs index c8c22e9..bbca70e 100644 --- a/crates/guardian_core/src/tts.rs +++ b/crates/guardian_core/src/tts.rs @@ -1,135 +1,155 @@ -// TODO: Look into SpeakNG to avoid the windows dependency https://crates.io/crates/espeakng +use std::io::Cursor; -use std::borrow::Cow; +use bevy::log; +use dasp::interpolate::sinc::Sinc; +use dasp::ring_buffer; +use dasp::signal; +use dasp::Sample; +use dasp::Signal; -use tokio::sync::Mutex; -use tracing::{debug, error, warn}; -use windows::core::HSTRING; -use windows::Media::SpeechSynthesis::SpeechSynthesizer; -use windows::Storage::Streams::DataReader; +use hound::WavSpec; +use hound::WavWriter; +use tokio::io::AsyncReadExt; +use tokio::io::AsyncWriteExt; +use tokio::net::TcpStream; +use tokio::net::ToSocketAddrs; -use crate::srs::Voice; +use serde::Deserialize; +use serde::Serialize; -#[derive(Debug)] -pub struct WinConfig { - pub voice: Option, +#[derive(Debug, Deserialize)] +pub struct Packet { + #[serde(rename = "type")] + pub r#type: String, + pub version: String, + pub data_length: Option, + pub payload_length: Option, } -impl WinConfig { - pub fn new(voice: &str) -> Self { - Self { - voice: Some(voice.to_string()), - } - } +#[derive(Serialize)] +struct RequestData { + text: String, } -static MUTEX: Mutex<()> = Mutex::const_new(()); +#[derive(Serialize)] +struct Request { + r#type: String, + data: RequestData, +} -pub async fn synthesize(text: &str, voice: &Voice) -> Result>, WinError> { - let config = WinConfig::new(&voice.to_string()); - // Note, there does not seem to be a way to explicitly set 16000kHz, 16 audio bits per - // sample and mono channel. +pub async fn synthesize( + addr: A, + text: &str, +) -> Result>, Box> { + let stream = TcpStream::connect(addr).await?; - // Prevent concurrent Windows TTS synthesis, as this might cause a crash. - let lock = MUTEX.lock().await; + let (mut read, mut write) = tokio::io::split(stream); - let mut voice_info = None; - if let Some(voice) = &config.voice { - let all_voices = SpeechSynthesizer::AllVoices()?; - let len = all_voices.Size()? as usize; - for i in 0..len { - let v = all_voices.GetAt(i as u32)?; - let lang = v.Language()?.to_string(); - if !lang.starts_with("en-") { - continue; - } - - let name = v.DisplayName()?.to_string(); - if name.ends_with(voice) { - voice_info = Some(v); - break; - } - } - } else { - // default to the first english voice in the list - let all_voices = SpeechSynthesizer::AllVoices()?; - let len = all_voices.Size()? as usize; - for i in 0..len { - let v = all_voices.GetAt(i as u32)?; - let lang = v.Language()?.to_string(); - if lang.starts_with("en-") { - let name = v.DisplayName()?.to_string(); - debug!("Using WIN voice: {}", name); - voice_info = Some(v); - break; - } - } - - if voice_info.is_none() { - error!("Could not find any english Windows TTS voice"); - } - } - - if voice_info.is_none() { - let all_voices = SpeechSynthesizer::AllVoices()?; - let len = all_voices.Size()? as usize; - warn!( - "Available WIN voices are (you don't have to include the `Microsoft` prefix in \ - the name):" - ); - for i in 0..len { - let v = all_voices.GetAt(i as u32)?; - let lang = v.Language()?.to_string(); - if !lang.starts_with("en-") { - continue; - } - - let name = v.DisplayName()?.to_string(); - warn!("- {} ({})", name, lang); - } - } - - let synth = SpeechSynthesizer::new()?; - let lang = if let Some(info) = voice_info { - synth.SetVoice(&info)?; - info.Language()?.to_string().into() - } else { - Cow::Borrowed("en") + let request = Request { + r#type: "synthesize".to_string(), + data: RequestData { + text: text.to_string(), + }, }; - // the DataReader is !Send, which is why we have to process it in a local set - let stream = synth - .SynthesizeSsmlToStreamAsync(&HSTRING::from(&format!( - r#"{text}"# - )))? - .await?; - let size = stream.Size()?; + let mut request = serde_json::to_string(&request)?; + request.push('\n'); - let rd = DataReader::CreateDataReader(&stream.GetInputStreamAt(0)?)?; - rd.LoadAsync(size as u32)?.await?; + write.write_all(request.as_bytes()).await?; - let mut wav = vec![0u8; size as usize]; - rd.ReadBytes(wav.as_mut_slice())?; + let mut str = String::new(); + let mut pcm_buffer: Vec = Vec::new(); + loop { + let Ok(c) = read.read_u8().await else { + log::error!("Unable to read byte"); + break; + }; - drop(lock); + if c == b'\n' { + let Ok(packet) = serde_json::from_str::(&str) else { + log::error!("Unable to read packet from: {}", str); + break; + }; + str = String::new(); - Ok(wav_to_opus(wav.into()).await?) -} + if let Some(length) = packet.data_length { + let mut buf = (0..length).map(|_| 0u8).collect::>(); -#[derive(Debug, thiserror::Error)] -pub enum WinError { - #[error("Calling WinRT API failed with error code {0}: {1}")] - Win(i32, String), - #[error("Runtime error")] - Io(#[from] std::io::Error), - #[error("failed to encode audio data as opus")] - Opus(#[from] audiopus::Error), -} + if let Err(e) = read.read_exact(&mut buf).await { + log::error!("Unable to read data: {:?}", e); + break; + } + }; -impl From for WinError { - fn from(err: windows::core::Error) -> Self { - WinError::Win(err.code().0, err.message().to_string()) + if let Some(length) = packet.payload_length { + let mut buf = (0..length).map(|_| 0u8).collect::>(); + + if let Err(e) = read.read_exact(&mut buf).await { + log::error!("Unable to read data: {:?}", e); + break; + } + + pcm_buffer.append(&mut buf); + } + + match packet.r#type.as_str() { + "audio-start" => { + pcm_buffer.clear(); + } + "audio-stop" => { + log::info!("Audio received, start post-processing"); + break; + } + _ => {} + } + } + str.push(c.into()); } + + let wav = to_wav(&pcm_buffer)?; + + let Ok(reader) = hound::WavReader::new(&*wav) else { + log::error!("Error opening reader"); + return Err("Error opening reader".into()); + }; + + // pcm_buffer is 22050Hz, need to convert this to 16000Hz + let samples = reader + .into_samples() + .filter_map(Result::ok) + .map(i16::to_sample::); + + let signal = signal::from_interleaved_samples_iter(samples); + + let ring_buffer = ring_buffer::Fixed::from([[0.0]; 100]); + let sinc = Sinc::new(ring_buffer); + + let new_signal = signal.from_hz_to_hz(sinc, 22050.0, 16000.0); + + let spec = WavSpec { + channels: 1, + sample_rate: 16000, + bits_per_sample: 16, + sample_format: hound::SampleFormat::Int, + }; + + let new_wav: Vec = Vec::new(); + let mut new_wav_cursor = Cursor::new(new_wav); + + let mut writer = WavWriter::new(&mut new_wav_cursor, spec).unwrap(); + + for frame in new_signal.until_exhausted() { + writer.write_sample(frame[0].to_sample::()).unwrap(); + } + + writer.flush().unwrap(); + + drop(writer); + + let wav = new_wav_cursor.into_inner(); + let wav = bytes::Bytes::copy_from_slice(&wav); + + Ok(wav_to_opus(wav).await?) } async fn wav_to_opus(wav: bytes::Bytes) -> Result>, audiopus::Error> { @@ -160,3 +180,30 @@ async fn wav_to_opus(wav: bytes::Bytes) -> Result>, audiopus::Error> .await .unwrap() } + +fn to_wav(data: &[u8]) -> Result, Box> { + let input_buffer: Vec = Vec::new(); + let mut input_buffer_cursor = Cursor::new(input_buffer); + + let input_spec = WavSpec { + channels: 1, + sample_rate: 22050, + bits_per_sample: 16, + sample_format: hound::SampleFormat::Int, + }; + + let mut input = hound::WavWriter::new(&mut input_buffer_cursor, input_spec)?; + + let audio_stream = data + .chunks(2) + .map(|bytes| i16::from_le_bytes(bytes.try_into().unwrap())) + .collect::>(); + + for frame in audio_stream { + input.write_sample(frame.to_sample::()).unwrap(); + } + + drop(input); + + Ok(input_buffer_cursor.into_inner()) +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5d56faf..292fe49 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly" +channel = "stable" diff --git a/src/braa.rs b/src/braa.rs index fca33e4..98fb384 100644 --- a/src/braa.rs +++ b/src/braa.rs @@ -74,7 +74,7 @@ impl Braa { let bearing = split(&self.bearing.to_string(), 1); let range = split(&self.range.to_string(), 1); format!( - "BRA {} {} {} thousand {}", + "BRA . . . {} . . . {} . . . {} thousand . . . {}", bearing, range, self.angels, self.aspect ) } diff --git a/src/commands/bogeydope.rs b/src/commands/bogeydope.rs index 96aee84..aefda18 100644 --- a/src/commands/bogeydope.rs +++ b/src/commands/bogeydope.rs @@ -64,13 +64,13 @@ pub fn bogey_dope( let (Some(n_position), Some(n_heading)) = n else { let message = format!("{}, {}, {}", p_callsign, a_callsign, "Skies are clear"); let voice_message = format!( - "{}, {}, {}", + "{} . . . {} . . . {}", p_callsign.to_voice(), a_callsign.to_voice(), "Skies are clear" ); - commands.spawn(TextMessage::new(message)); + commands.entity(*pilot).insert(TextMessage::new(message)); commands .entity(*operator) .insert(VoiceMessage::new(voice_message)); @@ -80,13 +80,13 @@ pub fn bogey_dope( let bra = Braa::new(p_pos, n_position, n_heading); let message = format!("{}, {}, {}", p_callsign, a_callsign, bra); let voice_message = format!( - "{}, {}, {}", + "{} . . . {} . . . {}", p_callsign.to_voice(), a_callsign.to_voice(), bra.to_voice() ); - commands.spawn(TextMessage::new(message)); + commands.entity(*pilot).insert(TextMessage::new(message)); commands .entity(*operator) .insert(VoiceMessage::new(voice_message)); diff --git a/src/commands/cleartripwire.rs b/src/commands/cleartripwire.rs index c02af51..4ad595f 100644 --- a/src/commands/cleartripwire.rs +++ b/src/commands/cleartripwire.rs @@ -53,7 +53,7 @@ pub fn clear_tripwire( a_callsign.to_voice(), ); - commands.spawn(TextMessage::new(message)); + commands.entity(*pilot).insert(TextMessage::new(message)); commands .entity(*operator) .insert(VoiceMessage::new(message_voice)); diff --git a/src/commands/radiocheck.rs b/src/commands/radiocheck.rs index bc6ca66..49799ce 100644 --- a/src/commands/radiocheck.rs +++ b/src/commands/radiocheck.rs @@ -44,13 +44,13 @@ pub fn radio_check( let message = format!("{}, {}, {}", p_callsign, a_callsign, "five by five"); let voice_message = format!( - "{}, {}, {}", + "{} . . . {} . . . {}", p_callsign.to_voice(), a_callsign.to_voice(), "five by five" ); - commands.spawn(TextMessage::new(message)); + commands.entity(*pilot).insert(TextMessage::new(message)); commands .entity(*operator) .insert(VoiceMessage::new(voice_message)); diff --git a/src/commands/tripwire.rs b/src/commands/tripwire.rs index 3a067a0..538993a 100644 --- a/src/commands/tripwire.rs +++ b/src/commands/tripwire.rs @@ -96,7 +96,7 @@ pub fn set_tripwire( distance ); - commands.spawn(TextMessage::new(message)); + commands.entity(*pilot).insert(TextMessage::new(message)); commands .entity(*operator) .insert(VoiceMessage::new(message_voice)); diff --git a/src/config.rs b/src/config.rs index 816eb06..c71b737 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, path::PathBuf}; use bevy::ecs::system::Resource; use guardian_core::{ components::{GrpcBaseUrl, SrsSocketAddr, SttBaseUrl}, - srs::{Modulation as SrsModulation, Voice}, + srs::Modulation as SrsModulation, }; use serde::{Deserialize, Serialize}; @@ -27,7 +27,6 @@ pub struct SrsConfig { pub struct ChannelConfig { pub frequency: u64, pub modulation: Modulation, // 0=AM, 1=FM? - pub voice: Voice, } impl TryFrom for Config { @@ -57,7 +56,6 @@ impl Config { ChannelConfig { frequency: 251000000, modulation: Modulation::Am, - voice: Voice::new("David"), }, ); diff --git a/src/main.rs b/src/main.rs index 093a3a3..a4016d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,8 @@ mod commands; mod config; mod tripwire; +use std::path::PathBuf; + use bevy::{ app::{App, Update}, ecs::{ @@ -11,6 +13,7 @@ use bevy::{ system::{Commands, Query, Res}, }, }; +use clap::Parser; use commands::CommandsPlugin; use config::{Channels, Config}; use guardian_core::{ @@ -19,8 +22,15 @@ use guardian_core::{ DefaultPlugins, TokioResource, }; use tokio::runtime::Handle; +use tracing::info; use tripwire::TripwirePlugin; +#[derive(Parser, Debug)] +struct CommandLineArguments { + #[arg(short, long)] + config: Option, +} + #[tokio::main] async fn main() -> Result<(), Box> { let subscriber = tracing_subscriber::FmtSubscriber::builder() @@ -35,7 +45,21 @@ async fn main() -> Result<(), Box> { tracing::subscriber::set_global_default(subscriber)?; - let config = Config::load("config.toml".into())?; + let args = CommandLineArguments::parse(); + + let config = match args.config { + Some(c) => { + if !c.try_exists()? { + return Err(format!("Config file {} not found", c.display()).into()); + } + c + } + None => "config.toml".into(), + }; + + info!("Loading config {}", config.display()); + + let config = Config::load(config)?; App::new() .insert_resource(config.srs.server) @@ -64,20 +88,8 @@ fn give_awacs_radio( bevy::log::info!("{} now has a radio", callsign); - commands.entity(ent).insert(Radio::new( - channel.frequency, - channel.modulation, - channel.voice.clone(), - )); + commands + .entity(ent) + .insert(Radio::new(channel.frequency, channel.modulation)); } } - -// // Initial player tripwire? get from some db so player doesnt need to redo it everytime -// fn add_tripwire(mut commands: Commands, players: Query>) { -// for ent in players.iter() { -// commands.entity(ent).insert(Tripwire { -// range: 2.0, -// reported: vec![], -// }); -// } -// } diff --git a/src/tripwire.rs b/src/tripwire.rs index 90ab9e8..73be825 100644 --- a/src/tripwire.rs +++ b/src/tripwire.rs @@ -26,7 +26,7 @@ impl Plugin for TripwirePlugin { fn tripwire( mut commands: Commands, awacs: Query<(Entity, &Callsign, &Radio), (With, With, With)>, - mut players: Query<(&Callsign, &Position, &RadioInfo, &mut Tripwire), With>, + mut players: Query<(Entity, &Callsign, &Position, &RadioInfo, &mut Tripwire), With>, npc: Query<(&Id, &Position, &Heading, &Velocity), (Without, With)>, ) { // get the players radio frequencies @@ -34,7 +34,7 @@ fn tripwire( // broadcast message on that ferquency and as that awacs for (ent, awacs, radio) in awacs.iter() { - for (p_callsign, p_position, radioinfo, mut p_tripwire) in players.iter_mut() { + for (p_ent, p_callsign, p_position, radioinfo, mut p_tripwire) in players.iter_mut() { // check if user is on the same frequency as awacs if !radioinfo .radios @@ -56,13 +56,14 @@ fn tripwire( let bra = Braa::new(p_position, n_position, n_heading); let message = format!("{}, {}, {}", p_callsign, awacs, bra); let voice_message = format!( - "{}, {}, {}", + "{} . . . {} . . . {}", p_callsign.to_voice(), awacs.to_voice(), bra.to_voice() ); - commands.spawn(TextMessage::new(message)); + // commands.spawn((Id::new(player_id.into()), TextMessage::new(message))); + commands.entity(p_ent).insert(TextMessage::new(message)); commands .entity(ent) .insert(VoiceMessage::new(voice_message));