mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix build failure on Windows
This commit is contained in:
parent
d380f3034c
commit
850e564a99
2 changed files with 11 additions and 15 deletions
|
@ -21,7 +21,7 @@ const MAX_BUFFER_SIZE: usize = 128 * 1024;
|
||||||
pub(super) fn all_voices(validate: bool) -> Result<Vec<TtsVoice>> {
|
pub(super) fn all_voices(validate: bool) -> Result<Vec<TtsVoice>> {
|
||||||
SpeechSynthesizer::AllVoices()?
|
SpeechSynthesizer::AllVoices()?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|info| TtsVoice::from_voice_information(info, validate))
|
.map(|info| tts_voice_from_information(info, validate))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,16 +91,14 @@ fn write_reader_to_file(reader: DataReader, file: &mut File, stream_size: usize)
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TtsVoice {
|
fn tts_voice_from_information(info: VoiceInformation, validate: bool) -> Result<TtsVoice> {
|
||||||
fn from_voice_information(info: VoiceInformation, validate: bool) -> Result<Self> {
|
Ok(TtsVoice {
|
||||||
Ok(Self {
|
id: info.Id()?.to_string_lossy(),
|
||||||
id: info.Id()?.to_string_lossy(),
|
name: info.DisplayName()?.to_string_lossy(),
|
||||||
name: info.DisplayName()?.to_string_lossy(),
|
language: info.Language()?.to_string_lossy(),
|
||||||
language: info.Language()?.to_string_lossy(),
|
// Windows lists voices that fail when actually trying to use them. This has been
|
||||||
// Windows lists voices that fail when actually trying to use them. This has been
|
// observed with voices from an uninstalled language pack.
|
||||||
// observed with voices from an uninstalled language pack.
|
// Validation is optional because it may be slow.
|
||||||
// Validation is optional because it may be slow.
|
available: validate.then(|| synthesize_stream(&info, 1.0, "").is_ok()),
|
||||||
available: validate.then(|| synthesize_stream(&info, 1.0, "").is_ok()),
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,5 +53,3 @@ use lazy_static::lazy_static;
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub(crate) static ref PYTHON_UNIT_TESTS: bool = env::var("ANKI_TEST_MODE").is_ok();
|
pub(crate) static ref PYTHON_UNIT_TESTS: bool = env::var("ANKI_TEST_MODE").is_ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporary during proto migration
|
|
||||||
|
|
Loading…
Reference in a new issue