pub struct Session { /* private fields */ }Available on non-
target_family=wasm only.Expand description
One PCM-producing utterance.
The session owns its synthesis worker. Dropping it cancels and joins that worker, so an abandoned reader cannot leave model inference running.
Implementations§
Source§impl Session
impl Session
pub fn sample_rate(&self) -> u32
Sourcepub fn read(&mut self, out: &mut [f32]) -> Result<usize, SynthesisError>
pub fn read(&mut self, out: &mut [f32]) -> Result<usize, SynthesisError>
Copies the next PCM samples into out, waiting for samples or the
terminal synthesis result. Zero means the utterance completed.
Sourcepub fn into_clip(self) -> Result<Clip, SynthesisError>
pub fn into_clip(self) -> Result<Clip, SynthesisError>
Reads the rest of the utterance as one clip at the engine’s rate.
Sourcepub fn play_on(
self,
output: &SpeakerOutput,
started: impl FnOnce(),
) -> Result<(), SynthesisError>
Available on crate feature playback only.
pub fn play_on( self, output: &SpeakerOutput, started: impl FnOnce(), ) -> Result<(), SynthesisError>
playback only.Plays this utterance and reports when its first source sample reaches the output callback.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more