pub trait AudioProcessorImpl<T: FloatType + Float>: Sized {
Show 17 methods
// Required methods
fn new(sample_rate: f32, buffer_size: usize) -> AudioProcessor<T>;
fn set_mix(&mut self, mix: f32);
fn get_mix(&self) -> f32;
fn use_filter(&mut self, use_filter: bool);
fn is_using_filter(&self) -> bool;
fn set_low_cut(&mut self, low_cut: f32);
fn get_low_cut(&self) -> f32;
fn set_high_cut(&mut self, high_cut: f32);
fn get_high_cut(&self) -> f32;
fn set_sample_rate(&mut self, sample_rate: f32);
fn get_sample_rate(&self) -> f32;
fn add_effect(&mut self, effect: AudioEffect<T>) -> AudioEffectState;
fn remove_effect(
&mut self,
name: &str,
) -> Result<AudioEffect<T>, AudioEffectState>;
fn move_effect(&mut self, from: usize, to: usize);
fn get_effect(&self, name: &str) -> Result<AudioEffect<T>, AudioEffectState>;
fn connect_analyser(&mut self, anal: Rc<RefCell<AudioAnalyser<T>>>);
fn disconnect_analyser(&mut self) -> Option<Rc<RefCell<AudioAnalyser<T>>>>;
}Expand description
Public API trait for audio processors. This manages a sequence of effects and global processing settings.
Required Methods§
Sourcefn new(sample_rate: f32, buffer_size: usize) -> AudioProcessor<T>
fn new(sample_rate: f32, buffer_size: usize) -> AudioProcessor<T>
Creates a new audio processor with the given sample rate and buffer size.
Sourcefn use_filter(&mut self, use_filter: bool)
fn use_filter(&mut self, use_filter: bool)
Enables or disables the global filter.
Sourcefn is_using_filter(&self) -> bool
fn is_using_filter(&self) -> bool
Checks if the global filter is enabled.
Sourcefn set_low_cut(&mut self, low_cut: f32)
fn set_low_cut(&mut self, low_cut: f32)
Sets the low-cut frequency for the global filter (clamped between 10.0 and 22050.0 Hz).
Sourcefn get_low_cut(&self) -> f32
fn get_low_cut(&self) -> f32
Gets the low-cut frequency for the global filter.
Sourcefn set_high_cut(&mut self, high_cut: f32)
fn set_high_cut(&mut self, high_cut: f32)
Sets the high-cut frequency for the global filter (clamped between 10.0 and 22050.0 Hz).
Sourcefn get_high_cut(&self) -> f32
fn get_high_cut(&self) -> f32
Gets the high-cut frequency for the global filter.
Sourcefn set_sample_rate(&mut self, sample_rate: f32)
fn set_sample_rate(&mut self, sample_rate: f32)
Sets the sample rate for the processor and updates all effects. Clamped between 1000.0 and 192000.0 Hz.
Sourcefn get_sample_rate(&self) -> f32
fn get_sample_rate(&self) -> f32
Gets the current sample rate.
Sourcefn add_effect(&mut self, effect: AudioEffect<T>) -> AudioEffectState
fn add_effect(&mut self, effect: AudioEffect<T>) -> AudioEffectState
Adds an effect to the processor.
Returns EffectAlreadyExists if an effect with the same name is present.
Sourcefn remove_effect(
&mut self,
name: &str,
) -> Result<AudioEffect<T>, AudioEffectState>
fn remove_effect( &mut self, name: &str, ) -> Result<AudioEffect<T>, AudioEffectState>
Removes an effect by name.
Returns the removed effect or EffectNoEntry if not found.
Sourcefn move_effect(&mut self, from: usize, to: usize)
fn move_effect(&mut self, from: usize, to: usize)
Moves an effect from one position to another in the processing sequence.
Sourcefn get_effect(&self, name: &str) -> Result<AudioEffect<T>, AudioEffectState>
fn get_effect(&self, name: &str) -> Result<AudioEffect<T>, AudioEffectState>
Gets a clone of the effect by name.
Returns EffectNoEntry if not found.
Sourcefn connect_analyser(&mut self, anal: Rc<RefCell<AudioAnalyser<T>>>)
fn connect_analyser(&mut self, anal: Rc<RefCell<AudioAnalyser<T>>>)
Connects an analyzer to the processor for audio analysis.
Sourcefn disconnect_analyser(&mut self) -> Option<Rc<RefCell<AudioAnalyser<T>>>>
fn disconnect_analyser(&mut self) -> Option<Rc<RefCell<AudioAnalyser<T>>>>
Disconnects and returns the connected analyzer, if any.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.