pub struct ChannelGroup<'device> { /* private fields */ }
Expand description

A channel group, reserving some Channels.

Implementations§

source§

impl<'device> ChannelGroup<'device>

source

pub fn new(_device: &'device MixDevice<'device>, len: usize) -> Self

Constructs the new channel group.

source

pub fn partition(self, left_len: usize) -> (Self, Self)

Partitions the group into two groups. The length of first element of tuple will be left_len, and the other will be self.len - left_len. And halts all the playing channel before doing it.

§Panics

Panics if self.len < left_len.

source

pub fn first_free(&self) -> Option<Channel<'_>>

Returns the first free mixing channel if exists.

source

pub fn oldest_playing(&self) -> Option<Channel<'_>>

Returns the oldest playing channel in the group.

source

pub fn newest_playing(&self) -> Option<Channel<'_>>

Returns the newest playing channel in the group.

source

pub fn halt_all(&self)

Halts all the playing channel.

source

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

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

source

pub fn len(&self) -> usize

Returns the numbers of channels in the group.

source

pub fn is_empty(&self) -> bool

Returns whether the group is empty.

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<'device> Unpin for ChannelGroup<'device>

§

impl<'device> !UnwindSafe for ChannelGroup<'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.