Struct web_audio_api::alloc::AudioBuffer[][src]

pub struct AudioBuffer { /* fields omitted */ }

Memory-resident audio asset, basically a matrix of channels * samples

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

Implementations

impl AudioBuffer[src]

pub fn new(channel: ChannelData) -> Self[src]

pub fn number_of_channels(&self) -> usize[src]

Number of channels in this AudioBuffer

pub fn set_number_of_channels(&mut self, n: usize)[src]

Set number of channels in this AudioBuffer

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

pub fn channel_data(&self, channel: usize) -> &ChannelData[src]

Get the samples from this specific channel.

pub fn channel_data_mut(&mut self, channel: usize) -> &mut ChannelData[src]

Get the samples from this specific channel (mutable).

pub fn mix(&mut self, channels: usize, interpretation: ChannelInterpretation)[src]

Up/Down-mix to the desired number of channels

pub fn make_silent(&mut self)[src]

Convert this buffer to silence

pub fn force_mono(&mut self)[src]

Convert to a single channel buffer, dropping excess channels

pub fn modify_channels<F: Fn(&mut ChannelData)>(&mut self, fun: F)[src]

Modify every channel in the same way

pub fn add(&mut self, other: &Self, interpretation: ChannelInterpretation)[src]

Sum two AudioBuffers

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

Trait Implementations

impl Clone for AudioBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.