Skip to main content

rodecaster_protocol/names/
meter.rs

1//! [`MeterParam`]: per-`METER`-node parameter family.
2
3// The six properties each METER node carries (confirmed from capture,
4// firmware 1.7.3): a passthrough fader-level snapshot and left/right meter
5// level + peak values, plus a `meterStereo` flag distinguishing stereo pairs.
6// Note that `faderLevel` also appears on `FADER` nodes under
7// `PHYSICALINTERFACE`; the two are separate wire properties even though
8// they share a name (path shape distinguishes them at decode time).
9wire_param_enum! {
10    /// A per-meter parameter: one of the flat properties the device carries
11    /// on each `METER` node (typically one per fader strip, though the exact
12    /// count depends on firmware layout). Provides live L/R meter levels and
13    /// peaks plus a stereo-pair flag. `FaderLevel` is a passthrough of the
14    /// strip's fader position (the same value that appears on the strip's
15    /// `FADER` node under `PHYSICALINTERFACE`).
16    ///
17    /// The `faderLevel` wire name is shared with `FADER`; decoding
18    /// distinguishes by path shape (METER paths never match FADER paths).
19    MeterParam {
20    FaderLevel => "faderLevel",
21    MeterLevelL => "meterLevelL",
22    MeterLevelR => "meterLevelR",
23    MeterPeakL => "meterPeakL",
24    MeterPeakR => "meterPeakR",
25    MeterStereo => "meterStereo",
26    }
27}
28
29#[cfg(test)]
30mod tests {
31    use super::*;
32
33    #[test]
34    fn meter_param_name_round_trips() {
35        let params = [
36            MeterParam::FaderLevel,
37            MeterParam::MeterLevelL,
38            MeterParam::MeterLevelR,
39            MeterParam::MeterPeakL,
40            MeterParam::MeterPeakR,
41            MeterParam::MeterStereo,
42        ];
43        for p in params {
44            assert_eq!(MeterParam::from_name(p.as_str()), p);
45            assert!(p.is_known());
46        }
47    }
48
49    #[test]
50    fn meter_param_shares_fader_level_wire_name() {
51        // `faderLevel` intentionally collides with FADER's property: path
52        // shape distinguishes the two at decode time.
53        assert_eq!(MeterParam::FaderLevel.as_str(), "faderLevel");
54    }
55}