Enum audio_visualizer::dynamic::window_top_btm::TransformFn[][src]

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.

Tuple Fields of Basic

0: fn(_: &[f32], _: f32) -> Vec<f32>
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.

Tuple Fields of Complex

0: &'a dyn Fn(&[f32], f32) -> Vec<(f64, f64)>

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.