pub struct ConstantMask(pub u64);Expand description
An optional optimization hint on which channels have all samples
set to the same value. The first bit (0x1) is the first
channel, the second bit is the second channel, and so on.
This can be useful for nodes that use audio buffers as CV (control voltage) ports.
Tuple Fields§
§0: u64Implementations§
Source§impl ConstantMask
impl ConstantMask
Sourcepub const NONE_CONSTANT: Self
pub const NONE_CONSTANT: Self
A mask with no channels marked as constant
Sourcepub const MONO_CONSTANT: Self
pub const MONO_CONSTANT: Self
A mask with only the first channel marked as constant
Sourcepub const STEREO_CONSTANT: Self
pub const STEREO_CONSTANT: Self
A mask with only the first two channels marked as constant
Sourcepub const fn new_all_constant(num_channels: usize) -> Self
pub const fn new_all_constant(num_channels: usize) -> Self
Construct a new ConstantMask with all channels marked as
constant.
num_channels must be less than or equal to 64.
Sourcepub const fn is_channel_constant(&self, i: usize) -> bool
pub const fn is_channel_constant(&self, i: usize) -> bool
Returns true if the channel is marked as constant, false
otherwise.
i must be less than 64.
Sourcepub const fn any_channel_constant(&self, num_channels: usize) -> bool
pub const fn any_channel_constant(&self, num_channels: usize) -> bool
Returns true if any channel is marked as constant, false
otherwise.
num_channels must be less than or equal to 64.
Sourcepub const fn all_channels_constant(&self, num_channels: usize) -> bool
pub const fn all_channels_constant(&self, num_channels: usize) -> bool
Returns true if all channels are marked as constant, false
otherwise.
num_channels must be less than or equal to 64.
Sourcepub const fn range_constant(&self, range: Range<usize>) -> bool
pub const fn range_constant(&self, range: Range<usize>) -> bool
Returns true if all channels in the given range are marked
as constant, false otherwise.
This range must be in the range [0, 64]
Sourcepub fn set_channel(&mut self, i: usize, constant: bool)
pub fn set_channel(&mut self, i: usize, constant: bool)
Mark/un-mark the given channel as constant.
i must be less than 64.
pub const fn union(self, other: Self) -> Self
pub fn union_with(&mut self, other: Self)
Sourcepub fn to_silence_mask<V: AsRef<[f32]>>(self, channels: &[V]) -> SilenceMask
pub fn to_silence_mask<V: AsRef<[f32]>>(self, channels: &[V]) -> SilenceMask
Convert this constant mask into a silence mask.
Sourcepub unsafe fn to_silence_mask_unchecked<V: AsRef<[f32]>>(
self,
channels: &[V],
) -> SilenceMask
pub unsafe fn to_silence_mask_unchecked<V: AsRef<[f32]>>( self, channels: &[V], ) -> SilenceMask
Convert this constant mask into a silence mask, assuming
that none of the slices in channels are empty.
§Safety
All slices in channels must not be empty.
Trait Implementations§
Source§impl Clone for ConstantMask
impl Clone for ConstantMask
Source§fn clone(&self) -> ConstantMask
fn clone(&self) -> ConstantMask
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConstantMask
impl Debug for ConstantMask
Source§impl Default for ConstantMask
impl Default for ConstantMask
Source§fn default() -> ConstantMask
fn default() -> ConstantMask
Source§impl Hash for ConstantMask
impl Hash for ConstantMask
Source§impl PartialEq for ConstantMask
impl PartialEq for ConstantMask
impl Copy for ConstantMask
impl Eq for ConstantMask
impl StructuralPartialEq for ConstantMask
Auto Trait Implementations§
impl Freeze for ConstantMask
impl RefUnwindSafe for ConstantMask
impl Send for ConstantMask
impl Sync for ConstantMask
impl Unpin for ConstantMask
impl UnwindSafe for ConstantMask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().