From a0945d7ebb6789eb5cb793e5eabda568422df615 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Thu, 31 Mar 2022 11:04:47 -0500 Subject: [PATCH] Update example for new API. --- examples/hello_world.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index dc70110..fdfc02d 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -81,11 +81,13 @@ fn main() -> Result<(), Error> { let Features { get_voice, .. } = tts.supported_features(); if get_voice { let original_voice = tts.voice()?; - for v in &voices { - tts.set_voice(v)?; - tts.speak(format!("This is {}.", v.name), false)?; + if let Some(original_voice) = original_voice { + for v in &voices { + tts.set_voice(v)?; + tts.speak(format!("This is {}.", v.name()), false)?; + } + tts.set_voice(&original_voice)?; } - tts.set_voice(&original_voice)?; } } tts.speak("Goodbye.", false)?;