pub struct FileInputBlock<S: Sample> { /* private fields */ }Expand description
Reads audio from a file into the DSP graph.
Wraps a Reader implementation to stream audio samples into the graph.
Supports optional looping for continuous playback.
Implementations§
Source§impl<S: Sample> FileInputBlock<S>
impl<S: Sample> FileInputBlock<S>
Sourcepub fn new(reader: Box<dyn Reader<S>>) -> Self
pub fn new(reader: Box<dyn Reader<S>>) -> Self
Create a FileInputBlock with the Reader implementation for a particular type of audio file.
Sourcepub fn set_loop_enabled(&mut self, enabled: bool)
pub fn set_loop_enabled(&mut self, enabled: bool)
Set whether the audio will be looped or not.
Sourcepub fn set_position(&mut self, position: usize)
pub fn set_position(&mut self, position: usize)
Set the position at which the audio file’s samples are being read.
Sourcepub fn get_position(&self) -> usize
pub fn get_position(&self) -> usize
Get the position at which the audio file’s samples are being read.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check whether the reader has finished reading every sample in the audio file.
Sourcepub fn get_reader(&self) -> &dyn Reader<S>
pub fn get_reader(&self) -> &dyn Reader<S>
Get the underlying Reader implementation of the FileInputBlock.
Trait Implementations§
Source§impl<S: Sample> Block<S> for FileInputBlock<S>
impl<S: Sample> Block<S> for FileInputBlock<S>
Source§fn process(
&mut self,
_inputs: &[&[S]],
outputs: &mut [&mut [S]],
_modulation_values: &[S],
context: &DspContext,
)
fn process( &mut self, _inputs: &[&[S]], outputs: &mut [&mut [S]], _modulation_values: &[S], context: &DspContext, )
Process audio through this block. Read more
Source§fn input_count(&self) -> usize
fn input_count(&self) -> usize
Returns the number of input ports this block accepts.
Source§fn output_count(&self) -> usize
fn output_count(&self) -> usize
Returns the number of output ports this block produces.
Source§fn modulation_outputs(&self) -> &[ModulationOutput]
fn modulation_outputs(&self) -> &[ModulationOutput]
Returns the modulation outputs this block provides. Read more
Source§fn channel_config(&self) -> ChannelConfig
fn channel_config(&self) -> ChannelConfig
Returns how this block handles multi-channel audio. Read more
Source§impl<S: Sample> From<FileInputBlock<S>> for BlockType<S>
impl<S: Sample> From<FileInputBlock<S>> for BlockType<S>
Source§fn from(block: FileInputBlock<S>) -> Self
fn from(block: FileInputBlock<S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S> Freeze for FileInputBlock<S>
impl<S> !RefUnwindSafe for FileInputBlock<S>
impl<S> Send for FileInputBlock<S>
impl<S> Sync for FileInputBlock<S>
impl<S> Unpin for FileInputBlock<S>
impl<S> !UnwindSafe for FileInputBlock<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more