Struct nih_plug::buffer::ChannelSamples
source · pub struct ChannelSamples<'slice, 'sample: 'slice> { /* private fields */ }
Expand description
Can construct iterators over actual iterator over the channel data for a sample, yielded by
SamplesIter
. Can be turned into an iterator, or ChannelSamples::iter_mut()
can be used
to iterate over the channel data multiple times, or more efficiently you can use
ChannelSamples::get_unchecked_mut()
to do the same thing.
Implementations§
source§impl<'slice, 'sample> ChannelSamples<'slice, 'sample>
impl<'slice, 'sample> ChannelSamples<'slice, 'sample>
sourcepub fn iter_mut(&mut self) -> ChannelSamplesIter<'slice, 'sample> ⓘ
pub fn iter_mut(&mut self) -> ChannelSamplesIter<'slice, 'sample> ⓘ
A resetting iterator. This lets you iterate over the same channels multiple times. Otherwise
you don’t need to use this function as ChannelSamples
already implements
IntoIterator
.
sourcepub fn get_mut(&mut self, channel_index: usize) -> Option<&mut f32>
pub fn get_mut(&mut self, channel_index: usize) -> Option<&mut f32>
Access a sample by index. Useful when you would otherwise iterate over this ‘Channels’ iterator multiple times.
sourcepub unsafe fn get_unchecked_mut(&mut self, channel_index: usize) -> &mut f32
pub unsafe fn get_unchecked_mut(&mut self, channel_index: usize) -> &mut f32
sourcepub fn to_simd<const LANES: usize>(&self) -> Simd<f32, LANES>where
LaneCount<LANES>: SupportedLaneCount,
Available on crate feature simd
only.
pub fn to_simd<const LANES: usize>(&self) -> Simd<f32, LANES>where LaneCount<LANES>: SupportedLaneCount,
simd
only.Get a SIMD vector containing the channel data for this buffer. If LANES > channels.len()
then this will be padded with zeroes. If LANES < channels.len()
then this won’t contain
all values.
sourcepub unsafe fn to_simd_unchecked<const LANES: usize>(&self) -> Simd<f32, LANES>where
LaneCount<LANES>: SupportedLaneCount,
Available on crate feature simd
only.
pub unsafe fn to_simd_unchecked<const LANES: usize>(&self) -> Simd<f32, LANES>where LaneCount<LANES>: SupportedLaneCount,
simd
only.Get a SIMD vector containing the channel data for this buffer. Will always read exactly
LANES
channels.
Safety
Undefined behavior if LANES > channels.len()
.
sourcepub fn from_simd<const LANES: usize>(&mut self, vector: Simd<f32, LANES>)where
LaneCount<LANES>: SupportedLaneCount,
Available on crate feature simd
only.
pub fn from_simd<const LANES: usize>(&mut self, vector: Simd<f32, LANES>)where LaneCount<LANES>: SupportedLaneCount,
simd
only.Write data from a SIMD vector to this sample’s channel data. This takes the padding added by
to_simd()
into account.
sourcepub unsafe fn from_simd_unchecked<const LANES: usize>(
&mut self,
vector: Simd<f32, LANES>
)where
LaneCount<LANES>: SupportedLaneCount,
Available on crate feature simd
only.
pub unsafe fn from_simd_unchecked<const LANES: usize>( &mut self, vector: Simd<f32, LANES> )where LaneCount<LANES>: SupportedLaneCount,
simd
only.Write data from a SIMD vector to this sample’s channel data. This assumes LANES
matches
exactly with the number of channels in the buffer.
Safety
Undefined behavior if LANES > channels.len()
.