mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-17 10:39:36 +00:00
Add ugly hack to prove that speech works.
This commit is contained in:
parent
32f57d8578
commit
1ac0b91981
|
@ -1,7 +1,10 @@
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use tts::*;
|
||||
|
||||
fn run() -> Result<(), Error> {
|
||||
let mut tts = TTS::default()?;
|
||||
thread::sleep(Duration::from_secs(5));
|
||||
let Features {
|
||||
utterance_callbacks,
|
||||
..
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
use std::sync::Mutex;
|
||||
|
||||
use jni::objects::{GlobalRef, JObject};
|
||||
use jni::JNIEnv;
|
||||
use jni::JavaVM;
|
||||
use lazy_static::lazy_static;
|
||||
use log::info;
|
||||
|
@ -27,7 +26,7 @@ impl Android {
|
|||
*backend_id += 1;
|
||||
let native_activity = ndk_glue::native_activity();
|
||||
let vm = Self::vm()?;
|
||||
let env = vm.attach_current_thread()?;
|
||||
let env = vm.attach_current_thread_permanently()?;
|
||||
let tts = env.new_object(
|
||||
"android/speech/tts/TextToSpeech",
|
||||
"(Landroid/content/Context;Landroid/speech/tts/TextToSpeech$OnInitListener;)V",
|
||||
|
@ -69,7 +68,7 @@ impl Backend for Android {
|
|||
println!("Speaking {}, {:?}", text, interrupt);
|
||||
let vm = Self::vm()?;
|
||||
println!("Retrieved");
|
||||
let env = vm.attach_current_thread()?;
|
||||
let env = vm.get_env()?;
|
||||
println!("attached");
|
||||
let tts = self.tts.as_obj();
|
||||
let text = env.new_string(text)?;
|
||||
|
|
Loading…
Reference in New Issue
Block a user