Skip to main content

ChunkItem

Enum ChunkItem 

Source
pub enum ChunkItem<'b, S: Sample, const N: usize> {
    Full {
        ch: usize,
        sample: usize,
        inp: &'b [S; N],
        out: &'b mut [S; N],
    },
    Tail {
        ch: usize,
        sample: usize,
        inp: &'b [S],
        out: &'b mut [S],
    },
}
Expand description

One yielded chunk from AudioBuffer::chunks_mut.

Full is the SIMD-friendly path: inp and out are stack arrays of exactly N elements, ready to feed truce-simd’s block ops. Tail is the trailing fragment when num_samples() isn’t a multiple of N; fall back to a scalar loop.

Variants§

§

Full

Full N-sample chunk. The &[S; N] / &mut [S; N] are the shape truce-simd ops are written against - no slice length check at the call site.

Fields

§ch: usize

Channel index this chunk belongs to.

§sample: usize

Sample offset within the audio block this chunk starts at. Use this when indexing into a precomputed envelope array - chunks_mut iterates channel-major, so the envelope (typically read once per audio block via read_block::<num_samples>()) is shared across all channel passes.

§inp: &'b [S; N]

Read-only N-sample input slice.

§out: &'b mut [S; N]

Mutable N-sample output slice.

§

Tail

Trailing chunk when num_samples() isn’t a multiple of N. Length is in (0, N). Fall back to scalar processing.

Fields

§ch: usize

Channel index this chunk belongs to.

§sample: usize

Sample offset within the audio block this chunk starts at.

§inp: &'b [S]

Read-only tail input slice; length < N.

§out: &'b mut [S]

Mutable tail output slice; length < N.

Auto Trait Implementations§

§

impl<'b, S, const N: usize> Freeze for ChunkItem<'b, S, N>

§

impl<'b, S, const N: usize> RefUnwindSafe for ChunkItem<'b, S, N>
where S: RefUnwindSafe,

§

impl<'b, S, const N: usize> Send for ChunkItem<'b, S, N>

§

impl<'b, S, const N: usize> Sync for ChunkItem<'b, S, N>

§

impl<'b, S, const N: usize> Unpin for ChunkItem<'b, S, N>

§

impl<'b, S, const N: usize> UnsafeUnpin for ChunkItem<'b, S, N>

§

impl<'b, S, const N: usize> !UnwindSafe for ChunkItem<'b, S, N>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.