pub enum TransformFn<'a> {
Basic(fn(&[f32], f32) -> Vec<f32>),
Complex(&'a dyn Fn(&[f32], f32) -> Vec<(f64, f64)>),
}
Expand description
Parameter type for open_window_connect_audio
. Describes how the audio data shall
be transformed, and thus, how it should be displayed in the lower part of the window.
The function is called every x milliseconds (refresh rate of window).
This works cross-platform (Windows, MacOS, Linux).
Variants§
Basic(fn(&[f32], f32) -> Vec<f32>)
Synchronized x-axis with the original data. Useful for transformations on the waveform, such as a (lowpass) filter.
Functions takes amplitude values and transforms them to a new amplitude value. It gets the sampling rate as second argument.
Complex(&'a dyn Fn(&[f32], f32) -> Vec<(f64, f64)>)
Use this, when the x-axis is different than for the original data. For example, if you want to display a spectrum.
Functions takes amplitude values (and their index) and transforms them to a new (x,y)-pair. Takes a closure instead of a function, so that it can capture state. It gets the sampling rate as second argument.