Struct rodio::Sink

source ·
pub struct Sink { /* private fields */ }
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§

source§

impl Sink

source

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

Builds a new Sink, beginning playback on a stream.

source

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

Builds a new Sink.

source

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

Appends a sound to the queue of sounds to play.

source

pub fn volume(&self) -> f32

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.

source

pub fn set_volume(&self, value: f32)

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.

source

pub fn speed(&self) -> f32

Gets the speed of the sound.

The value 1.0 is the “normal” speed (unfiltered input). Any value other than 1.0 will change the play speed of the sound.

source

pub fn set_speed(&self, value: f32)

Changes the speed of the sound.

The value 1.0 is the “normal” speed (unfiltered input). Any value other than 1.0 will change the play speed of the sound.

source

pub fn play(&self)

Resumes playback of a paused sink.

No effect if not paused.

source

pub fn pause(&self)

Pauses playback of this sink.

No effect if already paused.

A paused sink can be resumed with play().

source

pub fn is_paused(&self) -> bool

Gets if a sink is paused

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

source

pub fn stop(&self)

Stops the sink by emptying the queue.

source

pub fn detach(self)

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

source

pub fn sleep_until_end(&self)

Sleeps the current thread until the sound ends.

source

pub fn empty(&self) -> bool

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

source

pub fn len(&self) -> usize

Returns the number of sounds currently in the queue.

Trait Implementations§

source§

impl Drop for Sink

source§

fn drop(&mut self)

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for Fwhere T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,