mirror of https://github.com/ndarilek/tts-rs.git
WinRT fixes.
* Use released `winrt` crate. * Implement `is_speaking`.
This commit is contained in:
parent
b691124d3f
commit
c82ea5f3b3
|
@ -15,7 +15,7 @@ thiserror = "1"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
tolk = "0.2"
|
tolk = "0.2"
|
||||||
winrt = { git = "https://github.com/microsoft/winrt-rs", rev = "ed46a71f506c343b3eb4fa6c15a4d9db1397ebcf" }
|
winrt = "0.7"
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
speech-dispatcher = "0.4"
|
speech-dispatcher = "0.4"
|
||||||
|
|
|
@ -4,15 +4,15 @@ use winrt::*;
|
||||||
import!(
|
import!(
|
||||||
dependencies
|
dependencies
|
||||||
os
|
os
|
||||||
modules
|
types
|
||||||
"windows.media.core"
|
windows::media::core::MediaSource
|
||||||
"windows.media.playback"
|
windows::media::playback::{MediaPlaybackItem, MediaPlaybackList, MediaPlaybackState, MediaPlayer}
|
||||||
"windows.media.speechsynthesis"
|
windows::media::speech_synthesis::SpeechSynthesizer
|
||||||
);
|
);
|
||||||
|
|
||||||
use log::{info, trace};
|
use log::{info, trace};
|
||||||
use windows::media::core::MediaSource;
|
use windows::media::core::MediaSource;
|
||||||
use windows::media::playback::{MediaPlaybackItem, MediaPlaybackList, MediaPlayer};
|
use windows::media::playback::{MediaPlaybackItem, MediaPlaybackList, MediaPlaybackState, MediaPlayer};
|
||||||
use windows::media::speech_synthesis::SpeechSynthesizer;
|
use windows::media::speech_synthesis::SpeechSynthesizer;
|
||||||
|
|
||||||
use crate::{Backend, Error, Features};
|
use crate::{Backend, Error, Features};
|
||||||
|
@ -139,6 +139,8 @@ impl Backend for WinRT {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_speaking(&self) -> std::result::Result<bool, Error> {
|
fn is_speaking(&self) -> std::result::Result<bool, Error> {
|
||||||
unimplemented!()
|
let state = self.player.playback_session()?.playback_state()?;
|
||||||
|
let playing = state == MediaPlaybackState::Playing;
|
||||||
|
Ok(playing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue