events: start moving towards a more control-handle based task architecture

This commit is contained in:
2026-06-08 14:57:54 +02:00
parent aa84381d97
commit aba2194032
3 changed files with 137 additions and 56 deletions
+15 -2
View File
@@ -1,6 +1,17 @@
use std::process::Command;
pub async fn start_tts() -> tokio::sync::mpsc::Sender<String> {
#[derive(Debug)]
pub struct TtsControl {
request_sink: tokio::sync::mpsc::Sender<String>
}
impl TtsControl {
pub async fn speak(&self, text: String) {
self.request_sink.send(text).await.unwrap();
}
}
pub async fn start_tts() -> TtsControl {
let (tts_request_sender, mut tts_request_receiver) = tokio::sync::mpsc::channel(3);
@@ -12,5 +23,7 @@ pub async fn start_tts() -> tokio::sync::mpsc::Sender<String> {
}
});
tts_request_sender
TtsControl {
request_sink: tts_request_sender
}
}