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>

source

pub fn len(&self) -> usize

Get the number of channels.

source

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.

source

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.

source

pub unsafe fn get_unchecked_mut(&mut self, channel_index: usize) -> &mut f32

The same as get_mut(), but without any bounds checking.

Safety

channel_index must be in the range 0..Self::len().

source

pub fn to_simd<const LANES: usize>(&self) -> Simd<f32, LANES>where LaneCount<LANES>: SupportedLaneCount,

Available on crate feature 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.

source

pub unsafe fn to_simd_unchecked<const LANES: usize>(&self) -> Simd<f32, LANES>where LaneCount<LANES>: SupportedLaneCount,

Available on crate feature 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().

source

pub fn from_simd<const LANES: usize>(&mut self, vector: Simd<f32, LANES>)where LaneCount<LANES>: SupportedLaneCount,

Available on crate feature simd only.

Write data from a SIMD vector to this sample’s channel data. This takes the padding added by to_simd() into account.

source

pub unsafe fn from_simd_unchecked<const LANES: usize>( &mut self, vector: Simd<f32, LANES> )where LaneCount<LANES>: SupportedLaneCount,

Available on crate feature 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().

Trait Implementations§

source§

impl<'slice, 'sample> IntoIterator for ChannelSamples<'slice, 'sample>

§

type Item = &'sample mut f32

The type of the elements being iterated over.
§

type IntoIter = ChannelSamplesIter<'slice, 'sample>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'slice, 'sample> RefUnwindSafe for ChannelSamples<'slice, 'sample>

§

impl<'slice, 'sample> !Send for ChannelSamples<'slice, 'sample>

§

impl<'slice, 'sample> !Sync for ChannelSamples<'slice, 'sample>

§

impl<'slice, 'sample> Unpin for ChannelSamples<'slice, 'sample>where 'sample: 'slice,

§

impl<'slice, 'sample> !UnwindSafe for ChannelSamples<'slice, 'sample>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<T> Any for Twhere T: Any,

§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,