2021-12-02 12:56:10 +00:00
|
|
|
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);
|
2022-01-27 16:21:53 +00:00
|
|
|
for module in modules {
|
2021-12-02 12:56:10 +00:00
|
|
|
if connection.set_output_module(&module).is_ok() {
|
2022-01-27 16:21:53 +00:00
|
|
|
println!("Listing voices for module {module}");
|
2021-12-02 12:56:10 +00:00
|
|
|
} else {
|
2022-01-27 16:21:53 +00:00
|
|
|
println!("Failed to set output module to {module}");
|
2021-12-02 12:56:10 +00:00
|
|
|
continue;
|
|
|
|
};
|
|
|
|
let voices = connection.list_synthesis_voices()?;
|
2022-01-27 16:21:53 +00:00
|
|
|
for voice in voices {
|
|
|
|
if let Some(variant) = voice.variant {
|
2021-12-02 12:56:10 +00:00
|
|
|
println!(
|
2022-01-27 16:21:53 +00:00
|
|
|
" Name: {} / Language: {} / Variant: {variant}",
|
|
|
|
voice.name, voice.language
|
2021-12-02 12:56:10 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
println!(" Name: {} / Language: {}", voice.name, voice.language);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-27 16:26:12 +00:00
|
|
|
// Use connection.set_synthesis_voice(voice) to set the voice to use.
|
2021-12-02 12:56:10 +00:00
|
|
|
Ok(())
|
|
|
|
}
|