pub struct Channel<'device>(/* private fields */);
Expand description

A mixing channel for playing a MixChunk.

Implementations§

source§

impl<'device> Channel<'device>

source

pub fn volume(&self) -> u32

Returns the output volume of the channel. The volume is in 0..=128.

source

pub fn set_volume(&self, volume: u32)

Sets the output volume of the channel. The volume is clamped to 0..=128.

source

pub fn play(self, chunk: &MixChunk<'_>, options: PlayOptions) -> Result<Self>

Starts to play a chunk.

source

pub fn play_fade_in( self, chunk: &MixChunk<'_>, fade_in: u32, options: PlayOptions ) -> Result<Self>

Starts to play a chunk with fade-in time in milliseconds.

source

pub fn pause(&'device mut self) -> Option<Pauser<'device>>

Pauses playing and returns the Pauser, or None if it is free.

source

pub fn halt(&self)

Halts playing on the channel.

source

pub fn fade_out(&self, fade_out: u32) -> usize

Fade out playing on the channel in milliseconds. And returns the numbers of channels that is fading out.

source

pub fn is_playing(&self) -> bool

Returns whether the channel is playing.

source

pub fn playing_chunk(&self) -> Option<MixChunk<'_>>

Returns the playing chunk if exists.

Trait Implementations§

source§

impl<'device> Debug for Channel<'device>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'device> EffectAttachExt for Channel<'device>

source§

fn attach(&self, effect: Effect<'_>)

Attaches the effect to the channel.
source§

fn detach_all(&self)

Detaches all the effect from the channel.
source§

impl<'device> PartialEq for Channel<'device>

source§

fn eq(&self, other: &Channel<'device>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'device> Eq for Channel<'device>

source§

impl<'device> StructuralPartialEq for Channel<'device>

Auto Trait Implementations§

§

impl<'device> !RefUnwindSafe for Channel<'device>

§

impl<'device> !Send for Channel<'device>

§

impl<'device> !Sync for Channel<'device>

§

impl<'device> Unpin for Channel<'device>

§

impl<'device> !UnwindSafe for Channel<'device>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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.

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.