pub struct SpeechSynthesizer { /* private fields */ }
Expand description
SpeechSynthesizer struct holds functionality for text-to-speech synthesis.
Implementations
sourceimpl SpeechSynthesizer
impl SpeechSynthesizer
pub fn from_config(
speech_config: SpeechConfig,
audio_config: AudioConfig
) -> Result<Self>
pub fn from_auto_detect_source_lang_config(
speech_config: SpeechConfig,
audio_config: AudioConfig,
lang_config: AutoDetectSourceLanguageConfig
) -> Result<Self>
sourcepub async fn speak_text_async(
&self,
text: &str
) -> Result<SpeechSynthesisResult>
pub async fn speak_text_async(
&self,
text: &str
) -> Result<SpeechSynthesisResult>
Executes the speech synthesis on plain text, asynchronously.
sourcepub async fn speak_ssml_async(
&self,
ssml: &str
) -> Result<SpeechSynthesisResult>
pub async fn speak_ssml_async(
&self,
ssml: &str
) -> Result<SpeechSynthesisResult>
Executes the speech synthesis on SSML, asynchronously.
sourcepub async fn start_speaking_text_async(
&self,
text: &str
) -> Result<SpeechSynthesisResult>
pub async fn start_speaking_text_async(
&self,
text: &str
) -> Result<SpeechSynthesisResult>
Starts the speech synthesis on plain text, asynchronously. It returns when the synthesis request is started to process (the result reason is SynthesizingAudioStarted).
sourcepub async fn start_speaking_ssml_async(
&self,
ssml: &str
) -> Result<SpeechSynthesisResult>
pub async fn start_speaking_ssml_async(
&self,
ssml: &str
) -> Result<SpeechSynthesisResult>
Starts the speech synthesis on SSML, asynchronously. It returns when the synthesis request is started to process (the result reason is SynthesizingAudioStarted).
sourcepub async fn stop_speaking_async(&self) -> Result<()>
pub async fn stop_speaking_async(&self) -> Result<()>
Stops the speech synthesis, asynchronously. It stops audio speech synthesis and discards any unread data in audio.PullAudioOutputStream.
sourcepub async fn get_voices_async(
&self,
locale: &str
) -> Result<SynthesisVoicesResult>
pub async fn get_voices_async(
&self,
locale: &str
) -> Result<SynthesisVoicesResult>
Gets the available voices, asynchronously. The parameter locale specifies the locale of voices, in BCP-47 format; or leave it empty to get all available voices.
pub fn get_auth_token(&self) -> Result<String>
sourcepub fn set_auth_token(&mut self, token: &str) -> Result<()>
pub fn set_auth_token(&mut self, token: &str) -> Result<()>
Sets the authorization token that will be used for connecting to the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the synthesizer will encounter errors during synthesizing.
pub fn set_synthesizer_started_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisEvent) + 'static + Send,
pub fn set_synthesizer_synthesizing_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisEvent) + 'static + Send,
pub fn set_synthesizer_completed_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisEvent) + 'static + Send,
pub fn set_synthesizer_canceled_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisEvent) + 'static + Send,
pub fn set_synthesizer_word_boundary_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisWordBoundaryEvent) + 'static + Send,
pub fn set_synthesizer_viseme_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisVisemeEvent) + 'static + Send,
pub fn set_synthesizer_bookmark_cb<F>(&mut self, f: F) -> Result<()> where
F: Fn(SpeechSynthesisBookmarkEvent) + 'static + Send,
Trait Implementations
sourceimpl Debug for SpeechSynthesizer
impl Debug for SpeechSynthesizer
impl Sync for SpeechSynthesizer
Auto Trait Implementations
impl !RefUnwindSafe for SpeechSynthesizer
impl Send for SpeechSynthesizer
impl Unpin for SpeechSynthesizer
impl !UnwindSafe for SpeechSynthesizer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more