mirror of https://github.com/ndarilek/tts-rs.git
Bump version and Tolk dependency.
This commit is contained in:
parent
d85d56c3ee
commit
ca7789f157
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tts"
|
name = "tts"
|
||||||
version = "0.17.1"
|
version = "0.17.2"
|
||||||
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"
|
||||||
|
@ -21,7 +21,7 @@ thiserror = "1"
|
||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
tolk = { version = "0.4", optional = true }
|
tolk = { version = "0.5", optional = true }
|
||||||
windows = "0.9"
|
windows = "0.9"
|
||||||
|
|
||||||
[target.'cfg(windows)'.build-dependencies]
|
[target.'cfg(windows)'.build-dependencies]
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
#[cfg(all(windows, feature = "tolk"))]
|
#[cfg(all(windows, feature = "tolk"))]
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use log::{info, trace};
|
use log::{info, trace};
|
||||||
use tolk::Tolk as TolkPtr;
|
use tolk::Tolk as TolkPtr;
|
||||||
|
|
||||||
use crate::{Backend, BackendId, Error, Features, UtteranceId};
|
use crate::{Backend, BackendId, Error, Features, UtteranceId};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct Tolk(TolkPtr);
|
pub(crate) struct Tolk(Arc<TolkPtr>);
|
||||||
|
|
||||||
impl Tolk {
|
impl Tolk {
|
||||||
pub(crate) fn new() -> Option<Self> {
|
pub(crate) fn new() -> Option<Self> {
|
||||||
info!("Initializing Tolk backend");
|
info!("Initializing Tolk backend");
|
||||||
let tolk = TolkPtr::new();
|
let tolk = TolkPtr::new();
|
||||||
if tolk::Tolk::detect_screen_reader().is_some() {
|
if tolk.detect_screen_reader().is_some() {
|
||||||
Some(Tolk(tolk))
|
Some(Tolk(tolk))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -27,6 +27,8 @@ use libc::c_char;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use objc::{class, msg_send, sel, sel_impl};
|
use objc::{class, msg_send, sel, sel_impl};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
#[cfg(all(windows, feature = "tolk"))]
|
||||||
|
use tolk::Tolk;
|
||||||
|
|
||||||
mod backends;
|
mod backends;
|
||||||
|
|
||||||
|
@ -537,7 +539,8 @@ impl Tts {
|
||||||
{
|
{
|
||||||
#[cfg(feature = "tolk")]
|
#[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"))]
|
#[cfg(not(feature = "tolk"))]
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue