pub enum Formatter {
Float {
precision: usize,
},
Decibel {
precision: usize,
},
DecibelDirect {
precision: usize,
min_db: f64,
},
Frequency,
Milliseconds {
precision: usize,
},
Seconds {
precision: usize,
},
Percent {
precision: usize,
},
Pan,
Ratio {
precision: usize,
},
Semitones,
Boolean,
}Expand description
Parameter value formatter.
Defines how plain parameter values are converted to display strings and parsed back from user input.
Variants§
Float
Generic float with configurable precision (e.g., “1.23”).
Decibel
Decibel formatter for gain/level parameters.
Input is linear amplitude (0.0 = silence, 1.0 = unity). Display: “-12.0 dB”, “-inf dB”
DecibelDirect
Direct decibel formatter where input is already in dB.
Used by FloatParam::db() where the plain value is stored as dB.
Display: “+12.0 dB”, “-60.0 dB”
Fields
Frequency
Frequency formatter with automatic Hz/kHz scaling.
Display: “440 Hz”, “1.50 kHz”
Milliseconds
Milliseconds formatter.
Display: “10.0 ms”
Seconds
Seconds formatter.
Display: “1.50 s”
Percent
Percentage formatter.
Input is 0.0-1.0, display is 0%-100%. Display: “75%”
Pan
Pan formatter for stereo position.
Input is -1.0 (left) to +1.0 (right). Display: “L50”, “C”, “R50”
Ratio
Ratio formatter for compressors.
Display: “4.0:1”, “∞:1”
Semitones
Semitones formatter for pitch shifting.
Display: “+12 st”, “-7 st”, “0 st”
Boolean
Boolean formatter.
Display: “On”, “Off”
Implementations§
Source§impl Formatter
impl Formatter
Sourcepub fn format(&self, value: f64) -> String
pub fn format(&self, value: f64) -> String
Format a plain value to a display string.
The interpretation of value depends on the formatter variant:
Decibel: linear amplitude (1.0 = 0 dB)Frequency: HzMilliseconds: msSeconds: sPercent: 0.0-1.0 (displayed as 0%-100%)Pan: -1.0 to +1.0Ratio: ratio value (4.0 = “4:1”)Semitones: integer semitonesBoolean: >0.5 = On, <=0.5 = Off