WIP push-to-talk Letta chat frontend
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add basic device manager structs and app state

+292 -19
+173 -18
src-tauri/Cargo.lock
··· 42 42 ] 43 43 44 44 [[package]] 45 + name = "alsa" 46 + version = "0.9.2" 47 + source = "registry+https://github.com/rust-lang/crates.io-index" 48 + checksum = "bdc00893e7a970727e9304671b2c88577b4cfe53dc64019fdfdf9683573a09c4" 49 + dependencies = [ 50 + "alsa-sys", 51 + "bitflags 2.9.3", 52 + "cfg-if", 53 + "libc", 54 + ] 55 + 56 + [[package]] 57 + name = "alsa-sys" 58 + version = "0.3.1" 59 + source = "registry+https://github.com/rust-lang/crates.io-index" 60 + checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" 61 + dependencies = [ 62 + "libc", 63 + "pkg-config", 64 + ] 65 + 66 + [[package]] 45 67 name = "android-tzdata" 46 68 version = "0.1.1" 47 69 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 562 584 ] 563 585 564 586 [[package]] 587 + name = "coreaudio-rs" 588 + version = "0.13.0" 589 + source = "registry+https://github.com/rust-lang/crates.io-index" 590 + checksum = "1aae284fbaf7d27aa0e292f7677dfbe26503b0d555026f702940805a630eac17" 591 + dependencies = [ 592 + "bitflags 1.3.2", 593 + "libc", 594 + "objc2-audio-toolbox", 595 + "objc2-core-audio", 596 + "objc2-core-audio-types", 597 + "objc2-core-foundation", 598 + ] 599 + 600 + [[package]] 601 + name = "cpal" 602 + version = "0.16.0" 603 + source = "registry+https://github.com/rust-lang/crates.io-index" 604 + checksum = "cbd307f43cc2a697e2d1f8bc7a1d824b5269e052209e28883e5bc04d095aaa3f" 605 + dependencies = [ 606 + "alsa", 607 + "coreaudio-rs", 608 + "dasp_sample", 609 + "jni", 610 + "js-sys", 611 + "libc", 612 + "mach2", 613 + "ndk", 614 + "ndk-context", 615 + "num-derive", 616 + "num-traits", 617 + "objc2-audio-toolbox", 618 + "objc2-core-audio", 619 + "objc2-core-audio-types", 620 + "wasm-bindgen", 621 + "wasm-bindgen-futures", 622 + "web-sys", 623 + "windows 0.54.0", 624 + ] 625 + 626 + [[package]] 565 627 name = "cpufeatures" 566 628 version = "0.2.17" 567 629 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 675 737 "quote", 676 738 "syn 2.0.106", 677 739 ] 740 + 741 + [[package]] 742 + name = "dasp_sample" 743 + version = "0.11.0" 744 + source = "registry+https://github.com/rust-lang/crates.io-index" 745 + checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" 678 746 679 747 [[package]] 680 748 name = "deranged" ··· 1533 1601 "js-sys", 1534 1602 "log", 1535 1603 "wasm-bindgen", 1536 - "windows-core", 1604 + "windows-core 0.61.2", 1537 1605 ] 1538 1606 1539 1607 [[package]] ··· 1942 2010 checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" 1943 2011 1944 2012 [[package]] 2013 + name = "mach2" 2014 + version = "0.4.3" 2015 + source = "registry+https://github.com/rust-lang/crates.io-index" 2016 + checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" 2017 + dependencies = [ 2018 + "libc", 2019 + ] 2020 + 2021 + [[package]] 1945 2022 name = "markup5ever" 1946 2023 version = "0.14.1" 1947 2024 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2018 2095 name = "miwiwi" 2019 2096 version = "0.1.0" 2020 2097 dependencies = [ 2098 + "cpal", 2021 2099 "serde", 2022 2100 "serde_json", 2023 2101 "tauri", ··· 2111 2189 checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 2112 2190 2113 2191 [[package]] 2192 + name = "num-derive" 2193 + version = "0.4.2" 2194 + source = "registry+https://github.com/rust-lang/crates.io-index" 2195 + checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" 2196 + dependencies = [ 2197 + "proc-macro2", 2198 + "quote", 2199 + "syn 2.0.106", 2200 + ] 2201 + 2202 + [[package]] 2114 2203 name = "num-traits" 2115 2204 version = "0.2.19" 2116 2205 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2187 2276 ] 2188 2277 2189 2278 [[package]] 2279 + name = "objc2-audio-toolbox" 2280 + version = "0.3.1" 2281 + source = "registry+https://github.com/rust-lang/crates.io-index" 2282 + checksum = "10cbe18d879e20a4aea544f8befe38bcf52255eb63d3f23eca2842f3319e4c07" 2283 + dependencies = [ 2284 + "bitflags 2.9.3", 2285 + "libc", 2286 + "objc2 0.6.2", 2287 + "objc2-core-audio", 2288 + "objc2-core-audio-types", 2289 + "objc2-core-foundation", 2290 + "objc2-foundation 0.3.1", 2291 + ] 2292 + 2293 + [[package]] 2190 2294 name = "objc2-cloud-kit" 2191 2295 version = "0.3.1" 2192 2296 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2195 2299 "bitflags 2.9.3", 2196 2300 "objc2 0.6.2", 2197 2301 "objc2-foundation 0.3.1", 2302 + ] 2303 + 2304 + [[package]] 2305 + name = "objc2-core-audio" 2306 + version = "0.3.1" 2307 + source = "registry+https://github.com/rust-lang/crates.io-index" 2308 + checksum = "ca44961e888e19313b808f23497073e3f6b3c22bb485056674c8b49f3b025c82" 2309 + dependencies = [ 2310 + "dispatch2", 2311 + "objc2 0.6.2", 2312 + "objc2-core-audio-types", 2313 + "objc2-core-foundation", 2314 + ] 2315 + 2316 + [[package]] 2317 + name = "objc2-core-audio-types" 2318 + version = "0.3.1" 2319 + source = "registry+https://github.com/rust-lang/crates.io-index" 2320 + checksum = "c0f1cc99bb07ad2ddb6527ddf83db6a15271bb036b3eb94b801cd44fdc666ee1" 2321 + dependencies = [ 2322 + "bitflags 2.9.3", 2323 + "objc2 0.6.2", 2198 2324 ] 2199 2325 2200 2326 [[package]] ··· 3551 3677 "tao-macros", 3552 3678 "unicode-segmentation", 3553 3679 "url", 3554 - "windows", 3555 - "windows-core", 3680 + "windows 0.61.3", 3681 + "windows-core 0.61.2", 3556 3682 "windows-version", 3557 3683 "x11-dl", 3558 3684 ] ··· 3623 3749 "webkit2gtk", 3624 3750 "webview2-com", 3625 3751 "window-vibrancy", 3626 - "windows", 3752 + "windows 0.61.3", 3627 3753 ] 3628 3754 3629 3755 [[package]] ··· 3724 3850 "tauri-plugin", 3725 3851 "thiserror 2.0.16", 3726 3852 "url", 3727 - "windows", 3853 + "windows 0.61.3", 3728 3854 "zbus", 3729 3855 ] 3730 3856 ··· 3795 3921 "url", 3796 3922 "webkit2gtk", 3797 3923 "webview2-com", 3798 - "windows", 3924 + "windows 0.61.3", 3799 3925 ] 3800 3926 3801 3927 [[package]] ··· 3821 3947 "url", 3822 3948 "webkit2gtk", 3823 3949 "webview2-com", 3824 - "windows", 3950 + "windows 0.61.3", 3825 3951 "wry", 3826 3952 ] 3827 3953 ··· 4549 4675 dependencies = [ 4550 4676 "webview2-com-macros", 4551 4677 "webview2-com-sys", 4552 - "windows", 4553 - "windows-core", 4678 + "windows 0.61.3", 4679 + "windows-core 0.61.2", 4554 4680 "windows-implement", 4555 4681 "windows-interface", 4556 4682 ] ··· 4573 4699 checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c" 4574 4700 dependencies = [ 4575 4701 "thiserror 2.0.16", 4576 - "windows", 4577 - "windows-core", 4702 + "windows 0.61.3", 4703 + "windows-core 0.61.2", 4578 4704 ] 4579 4705 4580 4706 [[package]] ··· 4625 4751 4626 4752 [[package]] 4627 4753 name = "windows" 4754 + version = "0.54.0" 4755 + source = "registry+https://github.com/rust-lang/crates.io-index" 4756 + checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" 4757 + dependencies = [ 4758 + "windows-core 0.54.0", 4759 + "windows-targets 0.52.6", 4760 + ] 4761 + 4762 + [[package]] 4763 + name = "windows" 4628 4764 version = "0.61.3" 4629 4765 source = "registry+https://github.com/rust-lang/crates.io-index" 4630 4766 checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" 4631 4767 dependencies = [ 4632 4768 "windows-collections", 4633 - "windows-core", 4769 + "windows-core 0.61.2", 4634 4770 "windows-future", 4635 4771 "windows-link", 4636 4772 "windows-numerics", ··· 4642 4778 source = "registry+https://github.com/rust-lang/crates.io-index" 4643 4779 checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" 4644 4780 dependencies = [ 4645 - "windows-core", 4781 + "windows-core 0.61.2", 4782 + ] 4783 + 4784 + [[package]] 4785 + name = "windows-core" 4786 + version = "0.54.0" 4787 + source = "registry+https://github.com/rust-lang/crates.io-index" 4788 + checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" 4789 + dependencies = [ 4790 + "windows-result 0.1.2", 4791 + "windows-targets 0.52.6", 4646 4792 ] 4647 4793 4648 4794 [[package]] ··· 4654 4800 "windows-implement", 4655 4801 "windows-interface", 4656 4802 "windows-link", 4657 - "windows-result", 4803 + "windows-result 0.3.4", 4658 4804 "windows-strings", 4659 4805 ] 4660 4806 ··· 4664 4810 source = "registry+https://github.com/rust-lang/crates.io-index" 4665 4811 checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" 4666 4812 dependencies = [ 4667 - "windows-core", 4813 + "windows-core 0.61.2", 4668 4814 "windows-link", 4669 4815 "windows-threading", 4670 4816 ] ··· 4703 4849 source = "registry+https://github.com/rust-lang/crates.io-index" 4704 4850 checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" 4705 4851 dependencies = [ 4706 - "windows-core", 4852 + "windows-core 0.61.2", 4707 4853 "windows-link", 4854 + ] 4855 + 4856 + [[package]] 4857 + name = "windows-result" 4858 + version = "0.1.2" 4859 + source = "registry+https://github.com/rust-lang/crates.io-index" 4860 + checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" 4861 + dependencies = [ 4862 + "windows-targets 0.52.6", 4708 4863 ] 4709 4864 4710 4865 [[package]] ··· 5038 5193 "webkit2gtk", 5039 5194 "webkit2gtk-sys", 5040 5195 "webview2-com", 5041 - "windows", 5042 - "windows-core", 5196 + "windows 0.61.3", 5197 + "windows-core 0.61.2", 5043 5198 "windows-version", 5044 5199 "x11-dl", 5045 5200 ]
+1
src-tauri/Cargo.toml
··· 22 22 tauri-plugin-opener = "2" 23 23 serde = { version = "1", features = ["derive"] } 24 24 serde_json = "1" 25 + cpal = "0.16.0" 25 26 26 27 [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] 27 28 tauri-plugin-positioner = "2"
+24
src-tauri/src/devices/input.rs
··· 1 + use crate::devices::types::AudioDeviceError; 2 + use cpal::traits::HostTrait; 3 + use cpal::{default_host, Device, Host}; 4 + 5 + pub struct InputDeviceManager { 6 + host: Host, 7 + device: Device, 8 + } 9 + 10 + impl InputDeviceManager { 11 + pub fn new() -> Result<Self, AudioDeviceError> { 12 + let host = default_host(); 13 + let device = host 14 + .default_input_device() 15 + .ok_or(AudioDeviceError::NoDevicesFound)?; 16 + let manager = InputDeviceManager { host, device }; 17 + 18 + Ok(manager) 19 + } 20 + 21 + pub fn get_device(&self) -> &Device { 22 + &self.device 23 + } 24 + }
+3
src-tauri/src/devices/mod.rs
··· 1 + pub mod input; 2 + pub mod output; 3 + pub mod types;
+24
src-tauri/src/devices/output.rs
··· 1 + use crate::devices::types::AudioDeviceError; 2 + use cpal::traits::HostTrait; 3 + use cpal::{default_host, Device, Host}; 4 + 5 + pub struct OutputDeviceManager { 6 + host: Host, 7 + device: Device, 8 + } 9 + 10 + impl OutputDeviceManager { 11 + pub fn new() -> Result<Self, AudioDeviceError> { 12 + let host = default_host(); 13 + let device = host 14 + .default_output_device() 15 + .ok_or(AudioDeviceError::NoDevicesFound)?; 16 + let manager = OutputDeviceManager { host, device }; 17 + 18 + Ok(manager) 19 + } 20 + 21 + pub fn get_device(&self) -> &Device { 22 + &self.device 23 + } 24 + }
+36
src-tauri/src/devices/types.rs
··· 1 + use std::fmt; 2 + 3 + #[derive(Debug)] 4 + pub enum AudioDeviceError { 5 + NoHostAvailable, 6 + NoDevicesFound, 7 + ConfigurationError(String), 8 + CpalDevicesError(cpal::DevicesError), 9 + CpalConfigError(cpal::DefaultStreamConfigError), 10 + } 11 + 12 + impl fmt::Display for AudioDeviceError { 13 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 14 + match self { 15 + AudioDeviceError::NoHostAvailable => write!(f, "No host available"), 16 + AudioDeviceError::NoDevicesFound => write!(f, "No devices found"), 17 + AudioDeviceError::ConfigurationError(msg) => write!(f, "Configuration error: {}", msg), 18 + AudioDeviceError::CpalDevicesError(err) => write!(f, "CPAL device error: {}", err), 19 + AudioDeviceError::CpalConfigError(err) => write!(f, "CPAL config error: {}", err), 20 + } 21 + } 22 + } 23 + 24 + impl std::error::Error for AudioDeviceError {} 25 + 26 + impl From<cpal::DevicesError> for AudioDeviceError { 27 + fn from(err: cpal::DevicesError) -> Self { 28 + AudioDeviceError::CpalDevicesError(err) 29 + } 30 + } 31 + 32 + impl From<cpal::DefaultStreamConfigError> for AudioDeviceError { 33 + fn from(err: cpal::DefaultStreamConfigError) -> Self { 34 + AudioDeviceError::CpalConfigError(err) 35 + } 36 + }
+9 -1
src-tauri/src/lib.rs
··· 1 - use tauri::{WebviewUrl, WebviewWindowBuilder}; 1 + use crate::state::AppState; 2 + use tauri::{Manager, WebviewUrl, WebviewWindowBuilder}; 2 3 use tauri_plugin_positioner::{Position, WindowExt}; 3 4 use tauri_plugin_window_state::{StateFlags, WindowExt as StateWindowExt}; 5 + 6 + mod devices; 7 + mod state; 4 8 5 9 // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ 6 10 #[tauri::command] ··· 29 33 30 34 builder 31 35 .setup(|app| { 36 + let app_state = AppState::new().expect("failed to initialize application state"); 37 + 38 + app.manage(app_state); 39 + 32 40 let mut win_builder = 33 41 WebviewWindowBuilder::new(app, "main", WebviewUrl::default()).title("miwiwi"); 34 42
+22
src-tauri/src/state.rs
··· 1 + use std::sync::{Arc, RwLock}; 2 + 3 + use crate::devices::{ 4 + input::InputDeviceManager, output::OutputDeviceManager, types::AudioDeviceError, 5 + }; 6 + 7 + pub struct AppState { 8 + pub input_device_manager: Arc<RwLock<InputDeviceManager>>, 9 + pub output_device_manager: Arc<RwLock<OutputDeviceManager>>, 10 + } 11 + 12 + impl AppState { 13 + pub fn new() -> Result<Self, AudioDeviceError> { 14 + let input_device_manager = InputDeviceManager::new()?; 15 + let output_device_manager = OutputDeviceManager::new()?; 16 + 17 + Ok(AppState { 18 + input_device_manager: Arc::new(RwLock::new(input_device_manager)), 19 + output_device_manager: Arc::new(RwLock::new(output_device_manager)), 20 + }) 21 + } 22 + }