Skip to main content

AudioBlockOpsMut

Trait AudioBlockOpsMut 

Source
pub trait AudioBlockOpsMut<S: Sample> {
    // Required methods
    fn copy_from_block(&mut self, block: &impl AudioBlock<S>);
    fn copy_from_block_exact(&mut self, block: &impl AudioBlock<S>);
    fn copy_mono_to_all_channels(&mut self, mono: &AudioBlockMonoView<'_, S>);
    fn for_each(&mut self, f: impl FnMut(&mut S));
    fn for_each_including_non_visible(&mut self, f: impl FnMut(&mut S));
    fn enumerate(&mut self, f: impl FnMut(u16, usize, &mut S));
    fn enumerate_including_non_visible(
        &mut self,
        f: impl FnMut(u16, usize, &mut S),
    );
    fn fill_with(&mut self, sample: S);
    fn clear(&mut self)
       where S: Default;
}

Required Methods§

Source

fn copy_from_block(&mut self, block: &impl AudioBlock<S>)

Copy samples from source block, clamping to the smaller dimensions. Resizes destination to min(src, dst) channels and frames. Never panics - safely handles mismatched block sizes.

Source

fn copy_from_block_exact(&mut self, block: &impl AudioBlock<S>)

Copy samples from source block, requiring exact size match. Panics if source and destination don’t have identical channels and frames.

Source

fn copy_mono_to_all_channels(&mut self, mono: &AudioBlockMonoView<'_, S>)

Copy a mono block to all channels of this block. Panics if blocks don’t have the same number of frames.

Source

fn for_each(&mut self, f: impl FnMut(&mut S))

Gives access to all samples in the block.

Source

fn for_each_including_non_visible(&mut self, f: impl FnMut(&mut S))

Gives access to all samples in the block. This is faster than for_each by not checking bounds of the block. It can be used if your algorithm does not change if wrong samples are accessed. For example this is the case for gain, clear, etc.

Source

fn enumerate(&mut self, f: impl FnMut(u16, usize, &mut S))

Gives access to all samples in the block while supplying the information about which channel and frame number the sample is stored in.

Source

fn enumerate_including_non_visible(&mut self, f: impl FnMut(u16, usize, &mut S))

Gives access to all samples in the block while supplying the information about which channel and frame number the sample is stored in.

This is faster than enumerate by not checking bounds of the block. It can be used if your algorithm does not change if wrong samples are accessed. For example this is the case for applying a gain, clear, etc.

Source

fn fill_with(&mut self, sample: S)

Sets all samples in the block to the specified value

Source

fn clear(&mut self)
where S: Default,

Sets all samples in the block to the default value (zero for numeric types)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§