pub struct EditorPlayer {
driver: Driver,
fps: u32,
duration_frames: u64,
in_frame: u64,
out_frame: u64,
looping: bool,
}Expand description
A frame-indexed playback clock over a fixed-length project.
Time is measured in project frames at fps. The
playhead is constrained to [in_frame, out_frame); out of those, in/out
points scope playback + export, and looping wraps back to in_frame.
Fields§
§driver: Driver§fps: u32§duration_frames: u64§in_frame: u64§out_frame: u64Exclusive end of the playable range (defaults to duration_frames).
looping: boolImplementations§
Source§impl EditorPlayer
impl EditorPlayer
Sourcepub fn new(fps: u32, duration_frames: u64) -> Self
pub fn new(fps: u32, duration_frames: u64) -> Self
A realtime player for a project of duration_frames at fps.
Starts paused at frame 0 with no in/out trim and looping off.
Sourcepub fn fixed(fps: u32, duration_frames: u64) -> Self
pub fn fixed(fps: u32, duration_frames: u64) -> Self
A fixed-step player (one frame per tick at rate 1×)
for deterministic, reproducible stepping — the export clock.
fn with_driver(driver: Driver, fps: u32, duration_frames: u64) -> Self
Sourcepub fn play(&mut self)
pub fn play(&mut self)
Begin advancing. If the playhead is parked at the end of a non-looping range, restart from the in-point first.
Sourcepub fn toggle_play(&mut self)
pub fn toggle_play(&mut self)
Toggle play/pause.
Sourcepub const fn is_playing(&self) -> bool
pub const fn is_playing(&self) -> bool
Whether the clock is currently advancing.
Sourcepub fn step(&mut self, delta: i64)
pub fn step(&mut self, delta: i64)
Step delta frames (negative = back) and pause. Clamps at the
range boundaries.
Sourcepub fn set_rate(&mut self, rate: f32)
pub fn set_rate(&mut self, rate: f32)
Set the playback rate (1.0 = realtime, 2.0 = 2×, 0.5 = half).
Negative rates clamp to 0 (reverse playback is a future ticket).
Sourcepub fn tick(&mut self, dt: Duration)
pub fn tick(&mut self, dt: Duration)
Advance the clock by dt (realtime mode) or one fixed step (fixed
mode). At the end of the range: loop back to the in-point if
looping, otherwise clamp to the last frame and
pause. No-op while paused.
Sourcepub fn set_in_out(&mut self, a: u64, b: u64)
pub fn set_in_out(&mut self, a: u64, b: u64)
Set the in/out points (order-independent). The out-point is the exclusive end; the range is clamped to the project and forced non-empty. The playhead is re-clamped into the new range.
Sourcepub fn clear_in_out(&mut self)
pub fn clear_in_out(&mut self)
Clear in/out points back to the full project range.
Sourcepub fn set_duration(&mut self, duration_frames: u64)
pub fn set_duration(&mut self, duration_frames: u64)
Update the project length after an edit changed it (split / ripple delete / undo). If the range was untrimmed (out at the old end) the out-point tracks the new length; otherwise it’s clamped. The playhead is re-clamped into the new range.
Sourcepub const fn set_looping(&mut self, looping: bool)
pub const fn set_looping(&mut self, looping: bool)
Enable / disable looping over the in/out range.
Sourcepub fn current_frame(&self) -> u64
pub fn current_frame(&self) -> u64
The current playhead frame (clamped to the playable range).
Sourcepub const fn duration_frames(&self) -> u64
pub const fn duration_frames(&self) -> u64
Total project length in frames.
Sourcepub const fn driver(&self) -> &Driver
pub const fn driver(&self) -> &Driver
Borrow the underlying [Driver] — e.g. for the zoom engine (ED.16)
to sample animation Tracks against the same clock as the playhead.
Sourcefn last_frame(&self) -> u64
fn last_frame(&self) -> u64
Last playable frame index (out_frame - 1, never below in_frame).
fn frame_to_elapsed(&self, frame: u64) -> Duration
Trait Implementations§
Source§impl Clone for EditorPlayer
impl Clone for EditorPlayer
Source§fn clone(&self) -> EditorPlayer
fn clone(&self) -> EditorPlayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EditorPlayer
impl RefUnwindSafe for EditorPlayer
impl Send for EditorPlayer
impl Sync for EditorPlayer
impl Unpin for EditorPlayer
impl UnsafeUnpin for EditorPlayer
impl UnwindSafe for EditorPlayer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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