float_param

Macro float_param 

Source
macro_rules! float_param {
    ($name:ident $(: $t:ty)?, range: $min:literal..$max:literal, default: $default:literal) => { ... };
}
Expand description

Convenience macro for quickly creating a float parameter based on a field.

Example:

use scamble::dsp::{Parameter, ParameterType};
use scamble::float_param;

struct MyDsp {
    intensity: f32
}

let _: Parameter<MyDsp> = Parameter::with_unit("intensity", "%", float_param!(intensity, range: 0.0..1.0, default: 0.5));

If the field is not f32, it must be specified and castable to f32, such as: float_param!(intensity: f64, range: 0.0..1.0, default: 0.5)