mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-11-22 15:25: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};
|
use tts::{Features, TTS as Tts};
|
||||||
|
|
||||||
#[derive(NativeClass)]
|
#[derive(NativeClass)]
|
||||||
|
@ -8,7 +9,7 @@ struct TTS(Tts);
|
||||||
|
|
||||||
#[methods]
|
#[methods]
|
||||||
impl TTS {
|
impl TTS {
|
||||||
fn new(_owner: &Node) -> Self {
|
fn _init(_owner: gdnative::Node) -> Self {
|
||||||
let tts = Tts::default().unwrap();
|
let tts = Tts::default().unwrap();
|
||||||
Self(tts)
|
Self(tts)
|
||||||
}
|
}
|
||||||
|
@ -121,18 +122,18 @@ impl TTS {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[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();
|
let message = message.to_string();
|
||||||
self.0.speak(message, interrupt).unwrap();
|
self.0.speak(message, interrupt).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
fn stop(&mut self, _owner: &Node) {
|
fn stop(&mut self, _owner: Node) {
|
||||||
self.0.stop().unwrap();
|
self.0.stop().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
fn is_rate_supported(&mut self, _owner: &Node) -> bool {
|
fn is_rate_supported(&mut self, _owner: Node) -> bool {
|
||||||
let Features {
|
let Features {
|
||||||
rate: rate_supported,
|
rate: rate_supported,
|
||||||
..
|
..
|
||||||
|
@ -141,7 +142,7 @@ impl TTS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(handle: InitHandle) {
|
fn init(handle: gdnative::init::InitHandle) {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
handle.add_class::<TTS>();
|
handle.add_class::<TTS>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user