pub trait TTSEngine: Send + Sync {
// Required methods
fn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn synthesize_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
callback: Box<dyn Fn(Vec<u8>) + Sync + Send>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn list_voices<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<VoiceInfo>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn name(&self) -> &str;
fn as_any(&self) -> &(dyn Any + 'static);
}Expand description
Abstract TTS engine trait for extensibility
Required Methods§
Sourcefn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Synthesize text to audio data
Sourcefn synthesize_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
callback: Box<dyn Fn(Vec<u8>) + Sync + Send>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn synthesize_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
callback: Box<dyn Fn(Vec<u8>) + Sync + Send>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Synthesize with streaming callback for long texts