pub struct LipSyncTrack {
pub events: Vec<PhonemeEvent>,
pub duration: f32,
}Expand description
A complete lip-sync track: an ordered sequence of PhonemeEvents.
Fields§
§events: Vec<PhonemeEvent>Phoneme events sorted by start time.
duration: f32Total duration of the track in seconds.
Implementations§
Source§impl LipSyncTrack
impl LipSyncTrack
Sourcepub fn add_event(&mut self, event: PhonemeEvent)
pub fn add_event(&mut self, event: PhonemeEvent)
Append a phoneme event, updating duration as needed.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Number of events in the track.
Sourcepub fn evaluate(&self, t: f32, mapper: &VisemeMapper) -> VisemeMorphWeights
pub fn evaluate(&self, t: f32, mapper: &VisemeMapper) -> VisemeMorphWeights
Evaluate morph weights at time t.
Finds the active event (start ≤ t < end) and applies a short coarticulation blend: in the last 0.05 s of an event the weights are linearly interpolated toward the next event’s weights.
Sourcepub fn from_string(s: &str) -> Self
pub fn from_string(s: &str) -> Self
Parse a simple phoneme timeline string.
Format: "0.0:AA 0.2:B 0.4:IY"
Each token is <start>:<PHONEME>. The duration of each event is
inferred as the gap to the next token, or 0.1 s for the last token.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LipSyncTrack
impl RefUnwindSafe for LipSyncTrack
impl Send for LipSyncTrack
impl Sync for LipSyncTrack
impl Unpin for LipSyncTrack
impl UnsafeUnpin for LipSyncTrack
impl UnwindSafe for LipSyncTrack
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more