parent
2879284030
commit
143147036c
@ -0,0 +1,29 @@
|
||||
use speech_dispatcher::*;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let connection = Connection::open("list_voices", "list_voices", "list_voices", Mode::Threaded)?;
|
||||
|
||||
let modules = connection.list_output_modules()?;
|
||||
println!("Modules available: {:?}", modules);
|
||||
for module in modules.into_iter() {
|
||||
if connection.set_output_module(&module).is_ok() {
|
||||
println!("Listing voices for module {}", module);
|
||||
} else {
|
||||
println!("Failed to set output module to {}", module);
|
||||
continue;
|
||||
};
|
||||
let voices = connection.list_synthesis_voices()?;
|
||||
for voice in voices.into_iter() {
|
||||
if let Some(variant) = voice.variant.as_deref() {
|
||||
println!(
|
||||
" Name: {} / Language: {} / Variant: {}",
|
||||
voice.name, voice.language, variant
|
||||
);
|
||||
} else {
|
||||
println!(" Name: {} / Language: {}", voice.name, voice.language);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Use connection.set_synthesis_voice(voice.name) to set the voice to use.
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in new issue