Bump version and Tolk dependency.

This commit is contained in:
Nolan Darilek 2021-05-20 13:59:02 -05:00
parent d85d56c3ee
commit ca7789f157
3 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "tts"
version = "0.17.1"
version = "0.17.2"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
repository = "https://github.com/ndarilek/tts-rs"
description = "High-level Text-To-Speech (TTS) interface"
@ -21,7 +21,7 @@ thiserror = "1"
env_logger = "0.8"
[target.'cfg(windows)'.dependencies]
tolk = { version = "0.4", optional = true }
tolk = { version = "0.5", optional = true }
windows = "0.9"
[target.'cfg(windows)'.build-dependencies]

View File

@ -1,17 +1,19 @@
#[cfg(all(windows, feature = "tolk"))]
use std::sync::Arc;
use log::{info, trace};
use tolk::Tolk as TolkPtr;
use crate::{Backend, BackendId, Error, Features, UtteranceId};
#[derive(Clone, Debug)]
pub(crate) struct Tolk(TolkPtr);
pub(crate) struct Tolk(Arc<TolkPtr>);
impl Tolk {
pub(crate) fn new() -> Option<Self> {
info!("Initializing Tolk backend");
let tolk = TolkPtr::new();
if tolk::Tolk::detect_screen_reader().is_some() {
if tolk.detect_screen_reader().is_some() {
Some(Tolk(tolk))
} else {
None

View File

@ -27,6 +27,8 @@ use libc::c_char;
#[cfg(target_os = "macos")]
use objc::{class, msg_send, sel, sel_impl};
use thiserror::Error;
#[cfg(all(windows, feature = "tolk"))]
use tolk::Tolk;
mod backends;
@ -537,7 +539,8 @@ impl Tts {
{
#[cfg(feature = "tolk")]
{
return tolk::Tolk::detect_screen_reader().is_some();
let tolk = Tolk::new();
return tolk.detect_screen_reader().is_some();
}
#[cfg(not(feature = "tolk"))]
return false;