/// Process an audio buffer containing `f32` values.
///
/// # Example
/// ```no_run
/// # use vst2::plugin::{Info, Plugin};
/// # use vst2::buffer::AudioBuffer;
/// #
/// # struct ExamplePlugin;
/// # impl Plugin for ExamplePlugin {
/// #     fn get_info(&self) -> Info { Default::default() }
/// #
/// // Processor that clips samples above 0.4 or below -0.4:
/// fn process(&mut self, buffer: AudioBuffer<f32>){
///     let (inputs, mut outputs) = buffer.split();
///
///     for (channel, ibuf) in inputs.iter().enumerate() {
///         for (i, sample) in ibuf.iter().enumerate() {
///             outputs[channel][i] = if *sample > 0.4 {
///                 0.4
///             } else if *sample < -0.4 {
///                 -0.4
///             } else {
///                 *sample
///             };
///         }
///     }
/// }
/// # }
/// ```
Process an audio buffer containing `f32` values.
Process an audio buffer containing ` f32 ` values .
fn process(&mut self, buffer: AudioBuffer<f32>) {
        // For each input and output
        for (input, output) in buffer.zip() {
            // For each input sample and output sample in buffer
            for (in_frame, out_frame) in input.into_iter().zip(output.into_iter()) {
                *out_frame = *in_frame;
            }
        }
    }
fn process ( & mut self , buffer : AudioBuffer < f32 > ) { // For each input and output for ( input , output ) in buffer . zip ( ) { // For each input sample and output sample in buffer for ( in_frame , out_frame ) in input . into_iter ( ) . zip ( output . into_iter ( ) ) { * out_frame = * in_frame ; } } }
Process an audio buffer containing `f32` values.
Process an audio buffer containing ` f32 ` values .
&mut self
buffer
AudioBuffer<f32>
example
None
use vst2::plugin::{info, plugin};
None
use vst2::buffer::audiobuffer;
None
struct exampleplugin;
None
impl plugin for exampleplugin {
None
fn get_info(&self) -> info { default::default() }
Processor that clips samples above 0.4 or below -0.4:
fn process(&mut self, buffer: AudioBuffer){
let (inputs, mut outputs) = buffer.split().

for (channel, ibuf) in inputs.iter().enumerate() {
for (i, sample) in ibuf.iter().enumerate() {
outputs[channel][i] = if *sample > 0.4 {
0.4
} else if *sample < -0.4 {
0.4
} else {
sample
};
}
}
}
Processor that clips samples above 0 . 4 or below - 0 . 4 : fn process ( &mut self buffer : AudioBuffer ) { let ( inputs mut outputs ) = buffer . split () . for ( channel ibuf ) in inputs . iter () . enumerate () { for ( i sample ) in ibuf . iter () . enumerate () { outputs [ channel ] [ i ] = if * sample > 0 . 4 { 0 . 4 } else if * sample < - 0 . 4 { 0 . 4 } else { sample } ; } } }
}
None