Struct AudioFileProcessor

Source
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.

Source§

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.

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.