From 10be842598461d9c6f134618e6b2a412da79e8ff Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 6 Dec 2022 13:22:26 -0600 Subject: [PATCH] chore: Update to Bevy 0.9 and TTS 0.25. --- Cargo.toml | 7 ++++--- src/lib.rs | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5968e7..d44a33b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,17 +11,18 @@ edition = "2021" [features] default = ["speech_dispatcher_0_11", "tolk"] +speech_dispatcher_0_9 = ["tts/speech_dispatcher_0_9"] speech_dispatcher_0_10 = ["tts/speech_dispatcher_0_10"] speech_dispatcher_0_11 = ["tts/speech_dispatcher_0_11"] tolk = ["tts/tolk"] [dependencies] -bevy = { version = "0.8", default-features = false } +bevy = { version = "0.9", default-features = false } crossbeam-channel = "0.5" -tts = { version = "0.24", default-features = false } +tts = { version = "0.25", default-features = false } [dev-dependencies] -bevy = { version = "0.8", default-features = true } +bevy = { version = "0.9", default-features = true } [package.metadata.release] tag-prefix = "" diff --git a/src/lib.rs b/src/lib.rs index a341d73..c86a915 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,9 @@ use bevy::prelude::*; use crossbeam_channel::{unbounded, Receiver}; -pub use tts::{Backends, Error, Features, Tts, UtteranceId}; +pub use tts::{Backends, Error, Features, UtteranceId}; + +#[derive(Resource, Clone, Deref, DerefMut)] +pub struct Tts(tts::Tts); #[derive(Debug)] pub enum TtsEvent { @@ -9,6 +12,7 @@ pub enum TtsEvent { UtteranceStop(UtteranceId), } +#[derive(Resource)] struct TtsChannel(Receiver); fn poll_callbacks(channel: Res, mut events: EventWriter) { @@ -21,7 +25,7 @@ pub struct TtsPlugin; impl Plugin for TtsPlugin { fn build(&self, app: &mut App) { - let tts = Tts::default().unwrap(); + let tts = tts::Tts::default().unwrap(); let (tx, rx) = unbounded(); let tx_begin = tx.clone(); let tx_end = tx.clone(); @@ -44,6 +48,7 @@ impl Plugin for TtsPlugin { }))) .unwrap(); } + let tts = Tts(tts); app.add_event::() .insert_resource(TtsChannel(rx)) .insert_resource(tts)