1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-23 08: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] [dev-dependencies]
env_logger = "0.8" env_logger = "0.8"
[dependencies.windows]
version = "0.23"
features = [
"Foundation",
"Media_Core",
"Media_Playback",
"Media_SpeechSynthesis",
"Storage_Streams",
]
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
tolk = { version = "0.5", optional = true } tolk = { version = "0.5", optional = true }
windows = "0.9"
[target.'cfg(windows)'.build-dependencies]
windows = "0.9"
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
speech-dispatcher = "0.7" speech-dispatcher = "0.7"

View File

@ -1,14 +1,4 @@
fn main() { 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") { if std::env::var("TARGET").unwrap().contains("-apple") {
println!("cargo:rustc-link-lib=framework=AVFoundation"); println!("cargo:rustc-link-lib=framework=AVFoundation");
if !std::env::var("CARGO_CFG_TARGET_OS") if !std::env::var("CARGO_CFG_TARGET_OS")

View File

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

View File

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

View File

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