use std::os::raw::c_int;
use piper1_rs_sys::piper_synthesize_options;
#[derive(Copy, Clone)]
pub struct PiperSynthesisOptions {
pub speaker_id: c_int,
pub length_scale: f32,
pub noise_scale: f32,
pub noise_w_scale: f32,
}
impl PiperSynthesisOptions {
pub fn set_speaker_id(&mut self, speaker_id: c_int) -> &mut Self {
self.speaker_id = speaker_id;
self
}
pub fn set_length_scale(&mut self, length_scale: f32) -> &mut Self {
self.length_scale = length_scale;
self
}
pub fn set_noise_scale(&mut self, noise_scale: f32) -> &mut Self {
self.noise_scale = noise_scale;
self
}
pub fn set_noise_w_scale(&mut self, noise_w_scale: f32) -> &mut Self {
self.noise_w_scale = noise_w_scale;
self
}
}
impl From<piper_synthesize_options> for PiperSynthesisOptions {
fn from(
piper_synthesize_options {
speaker_id,
length_scale,
noise_scale,
noise_w_scale,
}: piper_synthesize_options,
) -> Self {
Self {
speaker_id,
length_scale,
noise_scale,
noise_w_scale,
}
}
}
impl From<&PiperSynthesisOptions> for piper_synthesize_options {
fn from(val: &PiperSynthesisOptions) -> Self {
piper_synthesize_options {
speaker_id: val.speaker_id,
length_scale: val.length_scale,
noise_scale: val.noise_scale,
noise_w_scale: val.noise_w_scale,
}
}
}