Module param_range

Module param_range 

Source
Expand description

Range mapping for parameter normalization.

This module provides traits and implementations for mapping between plain parameter values (in natural units like Hz, dB, ms) and normalized values (0.0 to 1.0) used for host communication.

§Example

use beamer_core::param_range::{RangeMapper, LinearMapper, LogMapper};

// Linear mapping for most parameters
let linear = LinearMapper::new(0.0..=100.0);
assert_eq!(linear.normalize(50.0), 0.5);
assert_eq!(linear.denormalize(0.5), 50.0);

// Logarithmic mapping for frequency parameters
let log = LogMapper::new(20.0..=20000.0);
// 632 Hz is roughly the geometric mean of 20 and 20000
assert!((log.denormalize(0.5) - 632.0).abs() < 1.0);

Structs§

LinearMapper
Linear range mapping.
LogMapper
Logarithmic range mapping.

Traits§

RangeMapper
Trait for mapping between plain values and normalized values.