From ca7789f157fa96ce06ffced8309e6ef043dfee23 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Thu, 20 May 2021 13:59:02 -0500 Subject: [PATCH] Bump version and Tolk dependency. --- Cargo.toml | 4 ++-- src/backends/tolk.rs | 6 ++++-- src/lib.rs | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 229c438..bc3795d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tts" -version = "0.17.1" +version = "0.17.2" authors = ["Nolan Darilek "] 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] diff --git a/src/backends/tolk.rs b/src/backends/tolk.rs index 9b93a5e..51431a8 100644 --- a/src/backends/tolk.rs +++ b/src/backends/tolk.rs @@ -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); impl Tolk { pub(crate) fn new() -> Option { 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 diff --git a/src/lib.rs b/src/lib.rs index 6c0b5f8..d62c245 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;