Update APIs to support case where getting a voice is supported but the value isn't set.

This commit is contained in:
Nolan Darilek 2022-03-31 10:43:07 -05:00
parent e699f7e5e5
commit b9aa36cb3b
2 changed files with 4 additions and 3 deletions

View File

@ -198,7 +198,7 @@ impl Backend for SpeechDispatcher {
Ok(rv) Ok(rv)
} }
fn voice(&self) -> Result<Voice, Error> { fn voice(&self) -> Result<Option<Voice>, Error> {
unimplemented!() unimplemented!()
} }

View File

@ -301,9 +301,10 @@ impl Backend for WinRt {
Ok(!utterances.is_empty()) Ok(!utterances.is_empty())
} }
fn voice(&self) -> Result<Voice, Error> { fn voice(&self) -> Result<Option<Voice>, Error> {
let voice = self.synth.Voice()?; let voice = self.synth.Voice()?;
voice.try_into() let voice = voice.try_into()?;
Ok(Some(voice))
} }
fn voices(&self) -> Result<Vec<Voice>, Error> { fn voices(&self) -> Result<Vec<Voice>, Error> {