1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-21 13:09:37 +00:00

Upgrade windows-rs to 0.23.

This commit is contained in:
Nolan Darilek 2021-11-01 10:36:15 -05:00
parent dc3129b79c
commit 92538fbdb8
5 changed files with 14 additions and 22 deletions

View File

@ -20,12 +20,18 @@ thiserror = "1"
[dev-dependencies]
env_logger = "0.8"
[dependencies.windows]
version = "0.23"
features = [
"Foundation",
"Media_Core",
"Media_Playback",
"Media_SpeechSynthesis",
"Storage_Streams",
]
[target.'cfg(windows)'.dependencies]
tolk = { version = "0.5", optional = true }
windows = "0.9"
[target.'cfg(windows)'.build-dependencies]
windows = "0.9"
[target.'cfg(target_os = "linux")'.dependencies]
speech-dispatcher = "0.7"

View File

@ -1,14 +1,4 @@
fn main() {
#[cfg(windows)]
if std::env::var("TARGET").unwrap().contains("windows") {
windows::build!(
Windows::Foundation::{EventRegistrationToken, IAsyncOperation, TypedEventHandler},
Windows::Media::Core::MediaSource,
Windows::Media::Playback::{MediaPlaybackSession, MediaPlaybackState, MediaPlayer, MediaPlayerAudioCategory},
Windows::Media::SpeechSynthesis::{SpeechSynthesisStream, SpeechSynthesizer, SpeechSynthesizerOptions},
Windows::Storage::Streams::IRandomAccessStream,
);
}
if std::env::var("TARGET").unwrap().contains("-apple") {
println!("cargo:rustc-link-lib=framework=AVFoundation");
if !std::env::var("CARGO_CFG_TARGET_OS")

View File

@ -4,10 +4,7 @@ use std::sync::Mutex;
use lazy_static::lazy_static;
use log::{info, trace};
mod bindings;
use bindings::Windows::{
use windows::{
Foundation::TypedEventHandler,
Media::{
Core::MediaSource,
@ -18,8 +15,8 @@ use bindings::Windows::{
use crate::{Backend, BackendId, Error, Features, UtteranceId, CALLBACKS};
impl From<windows::Error> for Error {
fn from(e: windows::Error) -> Self {
impl From<windows::runtime::Error> for Error {
fn from(e: windows::runtime::Error) -> Self {
Error::WinRt(e)
}
}

View File

@ -1 +0,0 @@
::windows::include_bindings!();

View File

@ -117,7 +117,7 @@ pub enum Error {
JavaScriptError(wasm_bindgen::JsValue),
#[cfg(windows)]
#[error("WinRT error")]
WinRt(windows::Error),
WinRt(windows::runtime::Error),
#[error("Unsupported feature")]
UnsupportedFeature,
#[error("Out of range")]