pub struct PlaybackTimeline {
pub samples_played: Arc<AtomicU64>,
/* private fields */
}Expand description
Shared timeline that the decode thread writes and the UI reads. The decode thread appends boundaries; the UI reads them + samples_played to derive current track and position.
Fields§
§samples_played: Arc<AtomicU64>Total interleaved samples consumed (played) by the audio engine. Written by CoreAudio render callback, read by UI.
Implementations§
Source§impl PlaybackTimeline
impl PlaybackTimeline
pub fn new() -> Arc<Self>
Sourcepub fn samples_played_counter(&self) -> Arc<AtomicU64> ⓘ
pub fn samples_played_counter(&self) -> Arc<AtomicU64> ⓘ
Get a clone of the samples_played Arc for the audio engine.
Sourcepub fn current_playback(
&self,
) -> Option<(QueueItemId, PathBuf, StreamInfo, u64)>
pub fn current_playback( &self, ) -> Option<(QueueItemId, PathBuf, StreamInfo, u64)>
Derive current track info and position from the playback head. Called by the UI on every tick. Returns (id, path, stream_info, position_ms).
Acquires the boundaries read lock BEFORE reading samples_played so
channels/sample_rate/boundaries are all from a consistent snapshot.
Without this ordering, a track transition could update the atomics
after we read samples_played but before we read the boundary list.
Auto Trait Implementations§
impl !Freeze for PlaybackTimeline
impl !RefUnwindSafe for PlaybackTimeline
impl Send for PlaybackTimeline
impl Sync for PlaybackTimeline
impl Unpin for PlaybackTimeline
impl UnsafeUnpin for PlaybackTimeline
impl UnwindSafe for PlaybackTimeline
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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