pub struct AudioRenderQuantum { /* private fields */ }
Expand description

Internal fixed length audio asset of RENDER_QUANTUM_SIZE sample frames for block rendering, basically a matrix of channels * [f32; RENDER_QUANTUM_SIZE] cf. https://webaudio.github.io/web-audio-api/#render-quantum

An AudioRenderQuantum has copy-on-write semantics, so it is cheap to clone.

Implementations

Number of channels in this AudioRenderQuantum

Set number of channels in this AudioRenderQuantum

Note: if the new number is higher than the previous, the new channels will be filled with garbage.

Panics

This function will panic if the given number of channels is outside the [1, 32] range, 32 being defined by the MAX_CHANNELS constant.

Get the samples from this specific channel.

Panics

Panics if the index is greater than the available number of channels

Get the samples (mutable) from this specific channel.

Panics

Panics if the index is greater than the available number of channels

Channel data as slice

Channel data as slice (mutable)

Up/Down-mix to the desired number of channels

Panics

This function will panic if the given number of channels is outside the [1, 32] range, 32 being defined by the MAX_CHANNELS constant.

Convert this buffer to silence

Convert to a single channel buffer, dropping excess channels

Modify every channel in the same way

Sum two AudioRenderQuantums

If the channel counts differ, the buffer with lower count will be upmixed.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.