mirror of
https://github.com/lightsoutgames/bevy_tts.git
synced 2025-06-02 11:55:57 +00:00
chore: Update to Bevy 0.16.
This commit is contained in:
parent
b3be60ea8d
commit
0d192fe64f
|
@ -2,6 +2,13 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## Version 0.11.0 - 2025-05-16
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Add Nix-based build and CI configuration.
|
||||||
|
- Update to Bevy 016.
|
||||||
|
|
||||||
## Version 0.10.0 - 2024-12-05
|
## Version 0.10.0 - 2024-12-05
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
|
@ -17,12 +17,12 @@ speech_dispatcher_0_11 = ["tts/speech_dispatcher_0_11"]
|
||||||
tolk = ["tts/tolk"]
|
tolk = ["tts/tolk"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.15", default-features = false }
|
bevy = { version = "0.16", default-features = false }
|
||||||
crossbeam-channel = "0.5"
|
crossbeam-channel = "0.5"
|
||||||
tts = { version = "0.26", default-features = false }
|
tts = { version = "0.26", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bevy = { version = "0.15", default-features = true }
|
bevy = { version = "0.16", default-features = true }
|
||||||
|
|
||||||
[package.metadata.release]
|
[package.metadata.release]
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -83,15 +83,19 @@ fn event_poll(mut events: EventReader<TtsEvent>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shows how to output speech in response to a keypress.
|
// Shows how to output speech in response to a keypress.
|
||||||
fn greet(input: Res<ButtonInput<KeyCode>>, mut tts: ResMut<Tts>, mut speaker: Query<&mut Tts>) {
|
fn greet(
|
||||||
|
input: Res<ButtonInput<KeyCode>>,
|
||||||
|
mut tts: ResMut<Tts>,
|
||||||
|
mut speaker: Query<&mut Tts>,
|
||||||
|
) -> Result {
|
||||||
if input.just_pressed(KeyCode::KeyG) {
|
if input.just_pressed(KeyCode::KeyG) {
|
||||||
tts.speak("Hey there!", true).unwrap();
|
tts.speak("Hey there!", true).unwrap();
|
||||||
}
|
}
|
||||||
if input.just_pressed(KeyCode::KeyS) {
|
if input.just_pressed(KeyCode::KeyS) {
|
||||||
if let Ok(mut speaker) = speaker.get_single_mut() {
|
let mut speaker = speaker.single_mut()?;
|
||||||
speaker
|
speaker
|
||||||
.speak("Hey there from the TTS component!", true)
|
.speak("Hey there from the TTS component!", true)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
38
flake.lock
38
flake.lock
|
@ -1,24 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"naersk": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1745925850,
|
|
||||||
"narHash": "sha256-cyAAMal0aPrlb1NgzMxZqeN1mAJ2pJseDhm2m6Um8T0=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"rev": "38bc60bbc157ae266d4a0c96671c6c742ee17a5f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"ref": "master",
|
|
||||||
"repo": "naersk",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747312588,
|
"lastModified": 1747312588,
|
||||||
|
@ -35,26 +16,9 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1747312588,
|
|
||||||
"narHash": "sha256-MmJvj6mlWzeRwKGLcwmZpKaOPZ5nJb/6al5CXqJsgjo=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "b1bebd0fe266bbd1820019612ead889e96a8fa2d",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"naersk": "naersk",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs": "nixpkgs_2",
|
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
naersk.url = "github:nix-community/naersk/master";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
@ -10,13 +9,11 @@
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
utils,
|
utils,
|
||||||
naersk,
|
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (
|
utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
naersk-lib = pkgs.callPackage naersk { };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShell =
|
devShell =
|
||||||
|
@ -30,6 +27,8 @@
|
||||||
pkg-config
|
pkg-config
|
||||||
pre-commit
|
pre-commit
|
||||||
git-cliff
|
git-cliff
|
||||||
|
cargo-release
|
||||||
|
cargo-outdated
|
||||||
];
|
];
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
speechd
|
speechd
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use bevy::{
|
use bevy::{
|
||||||
ecs::{component::ComponentId, world::DeferredWorld},
|
ecs::{component::HookContext, world::DeferredWorld},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::{unbounded, Receiver};
|
use crossbeam_channel::{unbounded, Receiver};
|
||||||
|
@ -31,13 +31,13 @@ pub enum TtsEvent {
|
||||||
#[derive(Component, Resource)]
|
#[derive(Component, Resource)]
|
||||||
struct TtsChannel(Receiver<TtsEvent>);
|
struct TtsChannel(Receiver<TtsEvent>);
|
||||||
|
|
||||||
fn on_tts_added(mut world: DeferredWorld, entity: Entity, _: ComponentId) {
|
fn on_tts_added(mut world: DeferredWorld, HookContext { entity, .. }: HookContext) {
|
||||||
let tts = &world.get::<Tts>(entity).unwrap();
|
let tts = &world.get::<Tts>(entity).unwrap();
|
||||||
let channel = setup_tts(tts);
|
let channel = setup_tts(tts);
|
||||||
world.commands().entity(entity).insert(channel);
|
world.commands().entity(entity).insert(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_tts_removed(mut world: DeferredWorld, entity: Entity, _: ComponentId) {
|
fn on_tts_removed(mut world: DeferredWorld, HookContext { entity, .. }: HookContext) {
|
||||||
world.commands().entity(entity).remove::<TtsChannel>();
|
world.commands().entity(entity).remove::<TtsChannel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ fn poll_callbacks(
|
||||||
speakers: Query<(Entity, &TtsChannel), With<Tts>>,
|
speakers: Query<(Entity, &TtsChannel), With<Tts>>,
|
||||||
) {
|
) {
|
||||||
if let Ok(msg) = channel.0.try_recv() {
|
if let Ok(msg) = channel.0.try_recv() {
|
||||||
events.send(msg);
|
events.write(msg);
|
||||||
}
|
}
|
||||||
for (entity, channel) in &speakers {
|
for (entity, channel) in &speakers {
|
||||||
if let Ok(msg) = channel.0.try_recv() {
|
if let Ok(msg) = channel.0.try_recv() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user