Struct symphonia_core::audio::SampleBuffer

source ·
pub struct SampleBuffer<S: Sample> { /* private fields */ }
Expand description

A SampleBuffer, is a sample oriented buffer. It is agnostic to the ordering/layout of samples within the buffer. SampleBuffer is mean’t for safely importing and exporting sample data to and from Symphonia using the sample’s in-memory data-type.

Implementations§

source§

impl<S: Sample> SampleBuffer<S>

source

pub fn new(duration: Duration, spec: SignalSpec) -> SampleBuffer<S>

Instantiate a new SampleBuffer using the specified signal specification and of the given duration.

source

pub fn len(&self) -> usize

Gets the number of written samples.

source

pub fn is_empty(&self) -> bool

Returns true if the buffer contains no written samples.

source

pub fn samples(&self) -> &[S]

Gets an immutable slice of all written samples.

source

pub fn samples_mut(&mut self) -> &mut [S]

Gets a mutable slice of all written samples.

source

pub fn capacity(&self) -> usize

Gets the maximum number of samples the SampleBuffer may store.

source

pub fn clear(&mut self)

Clears all written samples.

source

pub fn copy_planar_ref(&mut self, src: AudioBufferRef<'_>)

Copies all audio data from the source AudioBufferRef in planar channel order into the SampleBuffer. The two buffers must be equivalent.

source

pub fn copy_planar_typed<F>(&mut self, src: &AudioBuffer<F>)
where F: Sample + IntoSample<S>,

Copies all audio data from a source AudioBuffer into the SampleBuffer in planar channel order. The two buffers must be equivalent.

source

pub fn copy_interleaved_ref(&mut self, src: AudioBufferRef<'_>)

Copies all audio data from the source AudioBufferRef in interleaved channel order into the SampleBuffer. The two buffers must be equivalent.

source

pub fn copy_interleaved_typed<F>(&mut self, src: &AudioBuffer<F>)
where F: Sample + IntoSample<S>,

Copies all audio samples from a source AudioBuffer into the SampleBuffer in interleaved channel order. The two buffers must be equivalent.

Auto Trait Implementations§

§

impl<S> Freeze for SampleBuffer<S>

§

impl<S> RefUnwindSafe for SampleBuffer<S>
where S: RefUnwindSafe,

§

impl<S> Send for SampleBuffer<S>
where S: Send,

§

impl<S> Sync for SampleBuffer<S>
where S: Sync,

§

impl<S> Unpin for SampleBuffer<S>

§

impl<S> UnwindSafe for SampleBuffer<S>
where S: UnwindSafe,

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

source§

fn into_sample(self) -> T

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.