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

An audio processor which plays a file in loop

Implementations§

source§

impl AudioFileProcessor

source

pub fn from_path( handle: &Handle, audio_settings: AudioProcessorSettings, path: &str ) -> Result<Self, AudioFileError>

source

pub fn new( gc_handle: &Handle, audio_file_settings: InMemoryAudioFile, audio_settings: AudioProcessorSettings ) -> Self

source

pub fn num_samples(&self) -> usize

Unsafe get buffer for offline rendering

source

pub fn buffer(&self) -> &Vec<Vec<f32>>

Unsafe get buffer for offline rendering

source

pub fn handle(&self) -> &Shared<AudioFileProcessorHandle>

source

pub fn play(&self)

Resume playback

source

pub fn pause(&self)

Pause playback

source

pub fn stop(&self)

Stop playback and go back to the start of the file

source

pub fn is_playing(&self) -> bool

Whether the file is being played back

source

pub fn process_single(&self) -> impl Iterator<Item = f32> + '_

Trait Implementations§

source§

impl AudioProcessor for AudioFileProcessor

source§

fn prepare(&mut self, context: &mut AudioContext)

Prepares for playback

Note: Currently this will load the audio file on the audio-thread. It’d be an interesting exercise to perform this on a background thread.

§

type SampleType = f32

source§

fn process( &mut self, _context: &mut AudioContext, data: &mut AudioBuffer<Self::SampleType> )

Process a block of samples by mutating the input AudioBuffer

Auto Trait Implementations§

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.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

source§

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