Struct rodio::Sink[][src]

pub struct Sink { /* fields omitted */ }
Expand description

Handle to an device that outputs sounds.

Dropping the Sink stops all sounds. You can use detach if you want the sounds to continue playing.

Implementations

impl Sink[src]

pub fn try_new(stream: &OutputStreamHandle) -> Result<Sink, PlayError>[src]

Builds a new Sink, beginning playback on a stream.

pub fn new_idle() -> (Sink, SourcesQueueOutput<f32>)[src]

Builds a new Sink.

pub fn append<S>(&self, source: S) where
    S: Source + Send + 'static,
    S::Item: Sample,
    S::Item: Send
[src]

Appends a sound to the queue of sounds to play.

pub fn volume(&self) -> f32[src]

Gets the volume of the sound.

The value 1.0 is the “normal” volume (unfiltered input). Any value other than 1.0 will multiply each sample by this value.

pub fn set_volume(&self, value: f32)[src]

Changes the volume of the sound.

The value 1.0 is the “normal” volume (unfiltered input). Any value other than 1.0 will multiply each sample by this value.

pub fn play(&self)[src]

Resumes playback of a paused sink.

No effect if not paused.

pub fn pause(&self)[src]

Pauses playback of this sink.

No effect if already paused.

A paused sink can be resumed with play().

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

Gets if a sink is paused

Sinks can be paused and resumed using pause() and play(). This returns true if the sink is paused.

pub fn stop(&self)[src]

Stops the sink by emptying the queue.

pub fn detach(self)[src]

Destroys the sink without stopping the sounds that are still playing.

pub fn sleep_until_end(&self)[src]

Sleeps the current thread until the sound ends.

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

Returns true if this sink has no more sounds to play.

pub fn len(&self) -> usize[src]

Returns the number of sounds currently in the queue.

Trait Implementations

impl Drop for Sink[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl RefUnwindSafe for Sink

impl Send for Sink

impl Sync for Sink

impl Unpin for Sink

impl UnwindSafe for Sink

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.