[−][src]Struct songbird::tracks::TrackHandle
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]
command_channel: Sender<TrackCommand>,
seekable: bool,
uuid: Uuid,
metadata: Box<Metadata>
) -> Self
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]
&self,
event: Event,
action: F
) -> TrackResult<()>
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]
F: FnOnce(&mut Track) + Send + Sync + 'static,
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]
pub fn clone(&self) -> TrackHandle
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TrackHandle
[src]
Auto Trait Implementations
impl !RefUnwindSafe for TrackHandle
[src]
impl Send for TrackHandle
[src]
impl Sync for TrackHandle
[src]
impl Unpin for TrackHandle
[src]
impl !UnwindSafe for TrackHandle
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,