mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-11-22 03:55:56 +00:00
Ugh, off my game today. For some reason, the previous revert was impartial.
This commit is contained in:
parent
4990454320
commit
54222b1fcb
13
src/lib.rs
13
src/lib.rs
|
@ -1,4 +1,5 @@
|
|||
use gdnative::prelude::*;
|
||||
use gdnative::init::*;
|
||||
use gdnative::*;
|
||||
use tts::{Features, TTS as Tts};
|
||||
|
||||
#[derive(NativeClass)]
|
||||
|
@ -8,7 +9,7 @@ struct TTS(Tts);
|
|||
|
||||
#[methods]
|
||||
impl TTS {
|
||||
fn new(_owner: &Node) -> Self {
|
||||
fn _init(_owner: gdnative::Node) -> Self {
|
||||
let tts = Tts::default().unwrap();
|
||||
Self(tts)
|
||||
}
|
||||
|
@ -121,18 +122,18 @@ impl TTS {
|
|||
}
|
||||
|
||||
#[export]
|
||||
fn speak(&mut self, _owner: &Node, message: GodotString, interrupt: bool) {
|
||||
fn speak(&mut self, _owner: Node, message: GodotString, interrupt: bool) {
|
||||
let message = message.to_string();
|
||||
self.0.speak(message, interrupt).unwrap();
|
||||
}
|
||||
|
||||
#[export]
|
||||
fn stop(&mut self, _owner: &Node) {
|
||||
fn stop(&mut self, _owner: Node) {
|
||||
self.0.stop().unwrap();
|
||||
}
|
||||
|
||||
#[export]
|
||||
fn is_rate_supported(&mut self, _owner: &Node) -> bool {
|
||||
fn is_rate_supported(&mut self, _owner: Node) -> bool {
|
||||
let Features {
|
||||
rate: rate_supported,
|
||||
..
|
||||
|
@ -141,7 +142,7 @@ impl TTS {
|
|||
}
|
||||
}
|
||||
|
||||
fn init(handle: InitHandle) {
|
||||
fn init(handle: gdnative::init::InitHandle) {
|
||||
env_logger::init();
|
||||
handle.add_class::<TTS>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user