Skip to main content

EditorPlayer

Struct EditorPlayer 

Source
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: u64

Exclusive end of the playable range (defaults to duration_frames).

§looping: bool

Implementations§

Source§

impl EditorPlayer

Source

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.

Source

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.

Source

fn with_driver(driver: Driver, fps: u32, duration_frames: u64) -> Self

Source

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.

Source

pub fn pause(&mut self)

Pause advancing.

Source

pub fn toggle_play(&mut self)

Toggle play/pause.

Source

pub const fn is_playing(&self) -> bool

Whether the clock is currently advancing.

Source

pub fn seek(&mut self, frame: u64)

Seek to an exact frame (clamped to the playable range).

Source

pub fn step(&mut self, delta: i64)

Step delta frames (negative = back) and pause. Clamps at the range boundaries.

Source

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).

Source

pub const fn rate(&self) -> f32

Current playback rate.

Source

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.

Source

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.

Source

pub fn clear_in_out(&mut self)

Clear in/out points back to the full project range.

Source

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.

Source

pub const fn in_frame(&self) -> u64

In-point (inclusive).

Source

pub const fn out_frame(&self) -> u64

Out-point (exclusive).

Source

pub const fn set_looping(&mut self, looping: bool)

Enable / disable looping over the in/out range.

Source

pub const fn looping(&self) -> bool

Whether looping is enabled.

Source

pub fn current_frame(&self) -> u64

The current playhead frame (clamped to the playable range).

Source

pub const fn fps(&self) -> u32

Project frame rate.

Source

pub const fn duration_frames(&self) -> u64

Total project length in frames.

Source

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.

Source

pub fn progress(&self) -> f32

Normalised progress through the in/out range, 0.0..=1.0.

Source

fn last_frame(&self) -> u64

Last playable frame index (out_frame - 1, never below in_frame).

Source

fn raw_frame(&self) -> u64

Frame implied by the driver’s elapsed time, before range clamping.

Source

fn frame_to_elapsed(&self, frame: u64) -> Duration

Trait Implementations§

Source§

impl Clone for EditorPlayer

Source§

fn clone(&self) -> EditorPlayer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EditorPlayer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,