pub struct SegmentReader<E> { /* private fields */ }silero and non-target_family=wasm only.Expand description
Walks the finalized segments of one recording: cuts each segment’s audio out of the window, labels it, and frees what no reader needs any more.
The buffer is marked before each decode, because a segment’s audio ends where the buffer stood before the call that emitted it — agreement lags one decode behind the newest stride.
Implementations§
Source§impl<E: Embedder> SegmentReader<E>
impl<E: Embedder> SegmentReader<E>
pub fn new(labeler: SegmentLabeler<E>) -> Self
pub fn labeler(&self) -> &SegmentLabeler<E>
Sourcepub fn rewind(&mut self)
pub fn rewind(&mut self)
Forgets where the last recording stood. A new recording starts at zero, and a window measured from the old position would clamp to nothing. The labeler’s memory of voices stays.
pub fn labeler_mut(&mut self) -> &mut SegmentLabeler<E>
Sourcepub fn next<T: Transcriber, L: Layer>(
&mut self,
operation: &mut Operation<'_, T, L>,
recording: &mut RecordingReader,
) -> Result<Option<Heard>, TranscriptionError>
pub fn next<T: Transcriber, L: Layer>( &mut self, operation: &mut Operation<'_, T, L>, recording: &mut RecordingReader, ) -> Result<Option<Heard>, TranscriptionError>
The next finalized segment and whose voice it was, or None once the
recording ends. Marking the buffer, decoding, labeling, and freeing
the audio behind the decoder have to happen in that order, so the
order lives here rather than in every caller.
Freeing is safe without asking anyone: a second reader of the same recording holds its own fork, with its own window and its own floor.