chore: Update to Bevy 0.9 and TTS 0.25.

This commit is contained in:
Nolan Darilek 2022-12-06 13:22:26 -06:00
parent 678c56bfad
commit 10be842598
2 changed files with 11 additions and 5 deletions

View File

@ -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 = ""

View File

@ -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<TtsEvent>);
fn poll_callbacks(channel: Res<TtsChannel>, mut events: EventWriter<TtsEvent>) {
@ -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::<TtsEvent>()
.insert_resource(TtsChannel(rx))
.insert_resource(tts)