pub struct QueueControl<S>{ /* private fields */ }Expand description
Cloneable queue command capability without beat-grid identity or topology.
Implementations§
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
pub fn action_at_item_end(&self) -> ActionAtItemEnd
Sourcepub fn current(&self) -> Option<TrackEntry>
pub fn current(&self) -> Option<TrackEntry>
The currently playing track entry, if any.
Sourced from the navigation cursor (not the player) so the queue
reports None after advance_to_next runs off the end of the
queue (RepeatMode::Off exhaustion). The player’s own
current_index stays parked at the last-played slot — read it
via Self::current_index when the call site needs the
last-played index even after queue-end.
Sourcepub fn current_index(&self) -> Option<usize>
pub fn current_index(&self) -> Option<usize>
The currently playing track’s queue index (player-reported).
pub fn set_action_at_item_end(&self, action: ActionAtItemEnd)
pub fn set_playback_order(&self, order: PlaybackOrder)
Sourcepub fn set_repeat(&self, mode: RepeatMode)
pub fn set_repeat(&self, mode: RepeatMode)
Set repeat mode.
Sourcepub fn subscribe<E: EventSet>(&self) -> EventReceiver<E>
pub fn subscribe<E: EventSet>(&self) -> EventReceiver<E>
Subscribe to the unified event stream:
QueueEvent + underlying player /
audio / hls / file events.
Sourcepub fn track(&self, id: TrackId) -> Option<TrackEntry>
pub fn track(&self, id: TrackId) -> Option<TrackEntry>
Lookup a track entry by id.
Sourcepub fn track_source(&self, id: TrackId) -> Option<TrackSource<S>>
pub fn track_source(&self, id: TrackId) -> Option<TrackSource<S>>
The original TrackSource for id, if still queued. Lets callers
rebuild a resource by track identity rather than by queue position.
Sourcepub fn attach_observer<O: AudioObserver>(&self, id: TrackId, observer: O)
pub fn attach_observer<O: AudioObserver>(&self, id: TrackId, observer: O)
Attach a bounded decoded-audio observer to id’s decoder.
Attachment is nonblocking and works before, during, or after resource loading. Only one observer is active for a track at a time.
Sourcepub fn current_abr_handle(&self) -> Option<AbrHandle>
pub fn current_abr_handle(&self) -> Option<AbrHandle>
ABR handle of the currently playing adaptive item, if any.
Returned handle drives runtime variant/bandwidth control — FFI and
GUI use it for set_abr_mode / set_preferred_peak_bitrate.
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Rate the player’s master bus runs at, and therefore the frame axis used by decoded-audio observers attached to this queue.
Sourcepub fn current_variant(&self) -> Option<VariantInfo>
pub fn current_variant(&self) -> Option<VariantInfo>
Live variant metadata of the currently playing adaptive item. Pulled from the player’s stashed ABR handle on every call so a renderer can poll for the up-to-date label after every frame without depending on event delivery.
Sourcepub fn playback_order(&self) -> PlaybackOrder
pub fn playback_order(&self) -> PlaybackOrder
Current traversal order.
Sourcepub fn repeat_mode(&self) -> RepeatMode
pub fn repeat_mode(&self) -> RepeatMode
Current repeat mode.
Sourcepub fn tracks(&self) -> Vec<TrackEntry>
pub fn tracks(&self) -> Vec<TrackEntry>
Snapshot of all track entries, in queue order.
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
Sourcepub fn append<T: Into<TrackSource<S>>>(
&self,
source: T,
) -> Result<TrackId, QueueError>
pub fn append<T: Into<TrackSource<S>>>( &self, source: T, ) -> Result<TrackId, QueueError>
Append a track. Loading starts immediately in the background.
The id is allocated from the global counter via
TrackId::allocate; use Self::append_with_id when the
caller owns the id (FFI item pre-allocation).
§Errors
Returns QueueError::Play after the resident player is closed.
Sourcepub fn append_with_id<T: Into<TrackSource<S>>>(
&self,
id: TrackId,
source: T,
) -> Result<TrackId, QueueError>
pub fn append_with_id<T: Into<TrackSource<S>>>( &self, id: TrackId, source: T, ) -> Result<TrackId, QueueError>
Append a track with a caller-supplied id. The id MUST come from
TrackId::allocate so it stays inside the process-wide
monotonic address space. Used by the FFI layer where the item
reserves its id at construction and surfaces it as audioId
before insert.
§Errors
Returns QueueError::Play after the resident player is closed.
Sourcepub fn clear(&self)
pub fn clear(&self)
Remove all tracks from the queue. Dropping the records aborts their in-flight loads.
Sourcepub fn insert<T: Into<TrackSource<S>>>(
&self,
source: T,
after: Option<TrackId>,
) -> Result<TrackId, QueueError>
pub fn insert<T: Into<TrackSource<S>>>( &self, source: T, after: Option<TrackId>, ) -> Result<TrackId, QueueError>
Insert a track after the given id, or at the head when after is
None. Loading starts immediately.
§Errors
Returns QueueError::UnknownTrackId if after does not match any
track.
Sourcepub fn insert_with_id<T: Into<TrackSource<S>>>(
&self,
id: TrackId,
source: T,
after: Option<TrackId>,
) -> Result<TrackId, QueueError>
pub fn insert_with_id<T: Into<TrackSource<S>>>( &self, id: TrackId, source: T, after: Option<TrackId>, ) -> Result<TrackId, QueueError>
Insert a track with a caller-supplied id. See
Self::append_with_id for why the id MUST come from
TrackId::allocate.
§Errors
Returns QueueError::UnknownTrackId if after does not match
any track.
Sourcepub fn remove(&self, id: TrackId) -> Result<(), QueueError>
pub fn remove(&self, id: TrackId) -> Result<(), QueueError>
Remove a track from the queue by id.
If the removed track is currently playing:
- with tracks remaining → switches to the next (or previous if we were at the tail) with an immediate cut.
- with no tracks remaining → pauses the player.
§Errors
Returns QueueError::UnknownTrackId if id is not in the queue.
Sourcepub fn set_tracks<I, T>(&self, sources: I)
pub fn set_tracks<I, T>(&self, sources: I)
Replace the entire queue with the given sources.
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
pub fn crossfade_settings(&self) -> CrossfadeSettings
Sourcepub fn process_notifications(&self)
pub fn process_notifications(&self)
Drain pending player-side notifications. Called by FFI tick
loops after Self::tick.
Sourcepub fn set_crossfade_settings(
&self,
settings: CrossfadeSettings,
) -> Result<(), PlayError>
pub fn set_crossfade_settings( &self, settings: CrossfadeSettings, ) -> Result<(), PlayError>
Update the profile captured by future transitions.
§Errors
Returns an error when any profile value is invalid.
Sourcepub fn set_default_rate(&self, rate: f32)
pub fn set_default_rate(&self, rate: f32)
Set the default playback rate.
Sourcepub fn set_eq_layout(&self, layout: Vec<EqBandConfig>) -> Result<(), PlayError>
pub fn set_eq_layout(&self, layout: Vec<EqBandConfig>) -> Result<(), PlayError>
Sourcepub fn set_rate(&self, rate: f32)
pub fn set_rate(&self, rate: f32)
Set the live playback rate (mirrors into the tempo-mode sibling so a running key-locked stretch tracks the move).
Sourcepub fn set_volume(&self, volume: f32)
pub fn set_volume(&self, volume: f32)
Set the volume (0.0..=1.0).
Sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
Whether playback is active.
Sourcepub fn default_rate(&self) -> f32
pub fn default_rate(&self) -> f32
Default playback rate.
Sourcepub fn status(&self) -> PlayerStatus
pub fn status(&self) -> PlayerStatus
Live engine playback status.
Sourcepub fn engine_load(&self) -> EngineLoadSnapshot
pub fn engine_load(&self) -> EngineLoadSnapshot
Live audio-engine cost (realtime factor / load / ms).
Sourcepub fn eq_band_count(&self) -> usize
pub fn eq_band_count(&self) -> usize
Number of EQ bands.
Sourcepub fn duration_seconds(&self) -> Option<f64>
pub fn duration_seconds(&self) -> Option<f64>
Current track duration in seconds.
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
Sourcepub fn notify_audio_route_changed(&self, reason: &str) -> Result<(), QueueError>
pub fn notify_audio_route_changed(&self, reason: &str) -> Result<(), QueueError>
Platform audio-route changed while playback may be active.
Recreates the native output stream below the queue without changing queue state, current item, or track loading.
§Errors
Returns QueueError when the underlying player cannot restart
the active audio route.
Sourcepub fn notify_interruption(&self, kind: InterruptionKind)
pub fn notify_interruption(&self, kind: InterruptionKind)
The platform interrupted, or released, the audio output.
Recording the fact is all this does: an interruption leaves the native output unscheduled, and restoring it is the route-invalidation path.
Sourcepub fn play(&self)
pub fn play(&self)
Starts playback, marking a consumed slot or retaining the selection until loading finishes. Reconciliation is serialized with load completion.
Sourcepub fn playback_view(&self) -> PlaybackView
pub fn playback_view(&self) -> PlaybackView
Single coherent read of the player’s live playback state.
Pollers (the FFI time thread, snapshot) get position, duration,
decoded frontier, and the playing flag from one call instead of
several separate accessors. The player-sourced fields come from one
PlaybackSnapshot via its From
conversion; position is then replaced with this queue’s cached,
0.0-smoothed value.
Sourcepub fn set_session_ducking(
&self,
mode: SessionDuckingMode,
) -> Result<(), QueueError>
pub fn set_session_ducking( &self, mode: SessionDuckingMode, ) -> Result<(), QueueError>
Lower or restore the whole session output under a competing sound, such as a call or a navigation prompt.
§Errors
Returns QueueError when the session rejects the change.
Sourcepub fn position_seconds(&self) -> Option<f64>
pub fn position_seconds(&self) -> Option<f64>
Latest monotonic playback position for the current track in
seconds. Updated on every Self::tick; skips transient 0.0
samples the engine produces on pause/resume so downstream UIs
see stable values.
Sourcepub fn seek(&self, seconds: f64) -> Result<SeekOutcome, QueueError>
pub fn seek(&self, seconds: f64) -> Result<SeekOutcome, QueueError>
Seek within the currently-playing track.
Seek-hang detection is not handled here: the audio pipeline’s
own #[hang_watchdog] instrumentation (e.g. Audio::read,
Stream::read, decode_next_chunk) already panics with a
stacktrace and context dump when no progress is observed. Adding
a second Queue-level watchdog would just duplicate those panics.
Returns the typed SeekOutcome — either
Landed with the requested target (the actual landed position is
reconciled by the worker after applying the seek; this call returns
the optimistic outcome) or PastEof if the target is beyond the
known track duration.
§Errors
Returns QueueError::Play if the player reports a seek failure.
Sourcepub fn tick(&self) -> Result<(), QueueError>
pub fn tick(&self) -> Result<(), QueueError>
Periodic tick: drives PlayerImpl::tick and drains queued engine
events to act on ItemDidPlayToEnd (filtered) and forward
CurrentItemChanged as
QueueEvent::CurrentTrackChanged.
§Errors
Forwards PlayError from PlayerImpl::tick.
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
Sourcepub fn select(
&self,
id: TrackId,
transition: Transition,
) -> Result<(), QueueError>
pub fn select( &self, id: TrackId, transition: Transition, ) -> Result<(), QueueError>
Select a track by id, applying the given Transition. If the
track is still loading or pending, both the id and the
transition are stashed and applied when loading finishes.
§Errors
Returns QueueError::UnknownTrackId if id is not in the queue,
QueueError::NotReady if the track is in a terminal failed state,
or QueueError::Play if the underlying select_item call fails.
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
Sourcepub fn next(
&self,
transition: Transition,
) -> Result<Option<TrackId>, QueueError>
pub fn next( &self, transition: Transition, ) -> Result<Option<TrackId>, QueueError>
Advance to the next track per navigation rules. Returns the newly
selected id, or None when the queue has ended (and
RepeatMode::Off is active).
§Errors
Returns a queue or player error when the successor cannot be selected.
Sourcepub fn previous(
&self,
transition: Transition,
) -> Result<Option<TrackId>, QueueError>
pub fn previous( &self, transition: Transition, ) -> Result<Option<TrackId>, QueueError>
Go back to the previous track. Returns the newly selected id, or
None at index 0.
§Errors
Returns a queue or player error when the predecessor cannot be selected.
Source§impl<S> QueueControl<S>
impl<S> QueueControl<S>
Trait Implementations§
Source§impl<S> Clone for QueueControl<S>
impl<S> Clone for QueueControl<S>
Auto Trait Implementations§
impl<S> !RefUnwindSafe for QueueControl<S>
impl<S> !UnwindSafe for QueueControl<S>
impl<S> Freeze for QueueControl<S>
impl<S> Send for QueueControl<S>
impl<S> Sync for QueueControl<S>
impl<S> Unpin for QueueControl<S>
impl<S> UnsafeUnpin for QueueControl<S>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.