pub trait AudioBlockOps<S>where
S: Sample,{
// Required methods
fn copy_from_block(&mut self, block: &impl AudioBlock<S>);
fn copy_from_block_resize(&mut self, block: &impl AudioBlock<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);
}Required Methods§
Sourcefn copy_from_block(&mut self, block: &impl AudioBlock<S>)
fn copy_from_block(&mut self, block: &impl AudioBlock<S>)
Copy will panic if blocks don’t have the exact same size
Sourcefn copy_from_block_resize(&mut self, block: &impl AudioBlock<S>)
fn copy_from_block_resize(&mut self, block: &impl AudioBlock<S>)
Destination block will take over the size from source block. Panics if destination block has not enough memory allocated to grow.
Sourcefn for_each_including_non_visible(&mut self, f: impl FnMut(&mut S))
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.
Sourcefn enumerate(&mut self, f: impl FnMut(u16, usize, &mut S))
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.
Sourcefn enumerate_including_non_visible(&mut self, f: impl FnMut(u16, usize, &mut S))
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.
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.