Use new Tolk library and update backend.

This commit is contained in:
Nolan Darilek 2019-09-10 10:41:28 -05:00
parent 04c066d7e0
commit 1c1f38b55d
3 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "tts"
version = "0.1.1"
version = "0.2.0"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
repository = "https://gitlab.com/ndarilek/tts-rs"
description = "High-level Text-To-Speech (TTS) interface"
@ -16,7 +16,7 @@ log = "0.4"
env_logger = "0.6"
[target.'cfg(windows)'.dependencies]
tolk = { git = "https://github.com/ndarilek/tolk-rs" }
tolk = "0.2"
[target.'cfg(target_os = "linux")'.dependencies]
speech-dispatcher = "0.3"

View File

@ -1,3 +1,4 @@
use std::io;
use std::u8;
use tts::*;
@ -35,5 +36,7 @@ fn main() -> Result<(), std::io::Error> {
tts.set_volume(original_volume)?;
}
tts.speak("Goodbye.", false)?;
let mut _input = String::new();
io::stdin().read_line(&mut _input)?;
Ok(())
}

View File

@ -10,6 +10,7 @@ impl Tolk {
pub fn new() -> impl Backend {
info!("Initializing Tolk backend");
let tolk = TolkPtr::new();
tolk.try_sapi(true);
Tolk(tolk)
}
}
@ -17,7 +18,7 @@ impl Tolk {
impl Backend for Tolk {
fn supported_features(&self) -> Features {
Features {
stop: false,
stop: true,
rate: false,
pitch: false,
volume: false,
@ -32,7 +33,8 @@ impl Backend for Tolk {
fn stop(&self) -> Result<(), Error> {
trace!("stop()");
unimplemented!();
self.0.silence();
Ok(())
}
fn get_rate(&self) -> Result<u8, Error> {