pub struct PlaybackTimeline { /* private fields */ }Expand description
A sorted (playback_time → position) timeline over word events.
Implementations§
Source§impl PlaybackTimeline
impl PlaybackTimeline
Sourcepub fn from_callback_events(
events: &[(String, f32, f32, i32, i32, bool)],
speed: f32,
) -> Self
pub fn from_callback_events( events: &[(String, f32, f32, i32, i32, bool)], speed: f32, ) -> Self
Build from boundary-callback tuples as delivered by the engines:
(word, start_secs, end_secs, byte_offset, len, estimated).
speed is the playback speed factor (1.0 = normal, 1.25 = 25%
faster playback via a tempo filter): audio timestamps are divided
by it so the timeline is keyed in playback wall-clock time.
Non-positive speeds fall back to 1.0.
Sourcepub fn from_word_boundaries(
boundaries: &[WordBoundary],
text: &str,
speed: f32,
) -> Self
pub fn from_word_boundaries( boundaries: &[WordBoundary], text: &str, speed: f32, ) -> Self
Build from Vec<WordBoundary> (as returned by
synth_with_boundaries), recovering each word’s byte offset in
text with a crate::word_search::WordSearch: exact match,
then case-insensitive with combining diacritics ignored, then
hold-last on a miss (punctuation artifacts, normalization
differences).
§Panics (debug builds only)
Panics via debug_assert! when the boundaries are not in
non-decreasing audio-offset order — the forward scan assumes
spoken order. Engine output always is.
Sourcepub fn byte_offset_at(&self, playback_secs: f32) -> i32
pub fn byte_offset_at(&self, playback_secs: f32) -> i32
The byte offset into the source text being spoken at
playback_secs, holding the last event at or before that time —
including holding the last known offset across entries whose
offset is unknown (-1). Returns 0 before the first event and on an
empty timeline.
Sourcepub fn word_at(&self, playback_secs: f32) -> Option<&TimelineEntry>
pub fn word_at(&self, playback_secs: f32) -> Option<&TimelineEntry>
The word being spoken at playback_secs, if any has been
scheduled by then.
Sourcepub fn entries(&self) -> &[TimelineEntry]
pub fn entries(&self) -> &[TimelineEntry]
All entries, in playback order.