mod cevio;
mod com_manager;
mod error;
mod parameter;
pub use cevio::*;
pub use error::*;
pub use parameter::*;
#[cfg(test)]
mod tests {
use serial_test::serial;
use std::time::Instant;
use super::*;
#[test]
#[serial]
fn minimal() -> Result<()> {
let cevio = CevioAI::new()?;
cevio.start(false)?;
println!("CeVIO AI started");
let cast = CastBuilder::default()
.cast("さとうささら")
.volume(Volume::new(100).unwrap())
.tone_scale(ToneScale::new(100).unwrap())
.build()?;
println!("Cast built: {cast:?}");
cevio.apply_cast(&cast)?;
println!("Cast applied");
let e = cevio.speak("こんにちは")?;
println!("Speaking started");
e.wait_timeout(30.0)?;
let phonemes = cevio.phonemes("はじめまして")?;
println!("{phonemes:?}");
cevio.close(CloseMode::Interactive)?;
Ok(())
}
#[test]
#[serial]
fn full() -> Result<()> {
let cevio = CevioAI::new()?;
cevio.start(false)?;
let components = cevio.available_casts()?;
for component in components {
let start = Instant::now();
println!("{component:?}");
let cast = CastBuilder::default()
.cast(component)
.volume(Volume::new(100).unwrap())
.tone_scale(ToneScale::new(100).unwrap())
.build()?;
cevio.apply_cast(&cast)?;
let components = cevio.components()?;
println!("{components:?}");
let e = cevio.speak("こんにちは")?;
e.wait_timeout(30.0)?;
let phonemes = cevio.phonemes("はじめまして")?;
println!("{phonemes:?}");
println!("{}ms", start.elapsed().as_millis());
}
cevio.close(CloseMode::Interactive)?;
Ok(())
}
#[test]
#[serial]
fn test_builder_patterns() -> Result<()> {
let config = CevioAIConfigBuilder::default()
.start_host(true)
.no_wait(false)
.initial_cast("さとうささら")
.initial_volume(Volume::new(80).unwrap())
.build()?;
let _cevio = CevioAI::with_config(config)?;
let _cast_defaults = CastBuilder::default()
.with_defaults()
.cast("さとうささら")
.build()?;
let _cast_preset = CastBuilder::default()
.from_preset(VoicePreset::Energetic)
.cast("さとうささら")
.build()?;
Ok(())
}
}