Fix issue where is_speaking always returns true under WinRT, and bump version.

This commit is contained in:
Nolan Darilek 2020-11-02 13:30:39 -06:00
parent efdb274eb4
commit 565aa6d654
3 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "tts" name = "tts"
version = "0.10.2" version = "0.10.3"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"] authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
repository = "https://github.com/ndarilek/tts-rs" repository = "https://github.com/ndarilek/tts-rs"
description = "High-level Text-To-Speech (TTS) interface" description = "High-level Text-To-Speech (TTS) interface"

View File

@ -27,6 +27,10 @@ fn main() -> Result<(), Error> {
println!("Stopped speaking {:?}", utterance) println!("Stopped speaking {:?}", utterance)
})))?; })))?;
} }
let Features { is_speaking, .. } = tts.supported_features();
if is_speaking {
println!("Are we speaking? {}", tts.is_speaking()?);
}
tts.speak("Hello, world.", false)?; tts.speak("Hello, world.", false)?;
let Features { rate, .. } = tts.supported_features(); let Features { rate, .. } = tts.supported_features();
if rate { if rate {

View File

@ -269,7 +269,7 @@ impl Backend for WinRT {
fn is_speaking(&self) -> std::result::Result<bool, Error> { fn is_speaking(&self) -> std::result::Result<bool, Error> {
let state = self.player.playback_session()?.playback_state()?; let state = self.player.playback_session()?.playback_state()?;
let playing = state == MediaPlaybackState::Opening || state == MediaPlaybackState::Playing; let playing = state == MediaPlaybackState::Playing;
Ok(playing) Ok(playing)
} }
} }