Struct songbird::tracks::TrackHandle[][src]

pub struct TrackHandle { /* fields omitted */ }

Handle for safe control of a Track from other threads, outside of the audio mixing and voice handling context.

These are cheap to clone, using Arc<...> internally.

Many method calls here are fallible; in most cases, this will be because the underlying Track object has been discarded. Those which aren’t refer to immutable properties of the underlying stream, or shared data not used by the driver.

Implementations

impl TrackHandle[src]

pub fn new(
    command_channel: Sender<TrackCommand>,
    seekable: bool,
    uuid: Uuid,
    metadata: Box<Metadata>
) -> Self
[src]

Creates a new handle, using the given command sink and hint as to whether the underlying Input supports seek operations.

pub fn play(&self) -> TrackResult<()>[src]

Unpauses an audio track.

pub fn pause(&self) -> TrackResult<()>[src]

Pauses an audio track.

pub fn stop(&self) -> TrackResult<()>[src]

Stops an audio track.

This is final, and will cause the audio context to fire a TrackEvent::End event.

pub fn set_volume(&self, volume: f32) -> TrackResult<()>[src]

Sets the volume of an audio track.

pub fn make_playable(&self) -> TrackResult<()>[src]

Ready a track for playing if it is lazily initialised.

Currently, only Restartable sources support lazy setup. This call is a no-op for all others.

pub fn is_seekable(&self) -> bool[src]

Denotes whether the underlying Input stream is compatible with arbitrary seeking.

If this returns false, all calls to seek_time will fail, and the track is incapable of looping.

pub fn seek_time(&self, position: Duration) -> TrackResult<()>[src]

Seeks along the track to the specified position.

If the underlying Input does not support seeking, then all calls will fail with TrackError::SeekUnsupported.

pub fn add_event<F: EventHandler + 'static>(
    &self,
    event: Event,
    action: F
) -> TrackResult<()>
[src]

Attach an event handler to an audio track. These will receive EventContext::Track.

Events which can only be fired by the global context return TrackError::InvalidTrackEvent

pub fn action<F>(&self, action: F) -> TrackResult<()> where
    F: FnOnce(&mut Track) + Send + Sync + 'static, 
[src]

Perform an arbitrary synchronous action on a raw Track object.

Users must ensure that no costly work or blocking occurs within the supplied function or closure. Taking excess time could prevent timely sending of packets, causing audio glitches and delays.

pub async fn get_info(&self) -> TrackResult<Box<TrackState>>[src]

Request playback information and state from the audio context.

pub fn enable_loop(&self) -> TrackResult<()>[src]

Set an audio track to loop indefinitely.

If the underlying Input does not support seeking, then all calls will fail with TrackError::SeekUnsupported.

pub fn disable_loop(&self) -> TrackResult<()>[src]

Set an audio track to no longer loop.

If the underlying Input does not support seeking, then all calls will fail with TrackError::SeekUnsupported.

pub fn loop_for(&self, count: usize) -> TrackResult<()>[src]

Set an audio track to loop a set number of times.

If the underlying Input does not support seeking, then all calls will fail with TrackError::SeekUnsupported.

pub fn uuid(&self) -> Uuid[src]

Returns this handle’s (and track’s) unique identifier.

pub fn metadata(&self) -> &Metadata[src]

Returns the metadata stored in the handle.

Metadata is cloned from the inner Input at the time a track/handle is created, and is effectively read-only from then on.

pub fn typemap(&self) -> &RwLock<TypeMap>[src]

Allows access to this track’s attached TypeMap.

TypeMaps allow additional, user-defined data shared by all handles to be attached to any track.

Driver code will never attempt to lock access to this map, preventing deadlock/stalling.

pub fn send(&self, cmd: TrackCommand) -> TrackResult<()>[src]

Send a raw command to the Track object.

Trait Implementations

impl Clone for TrackHandle[src]

impl Debug for TrackHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]