Skip to main content

rodecaster_protocol/names/
headphone.rs

1//! [`HeadphoneParam`]: the per-jack `HEADPHONE`-node parameter family.
2
3// The two properties a real Pro II / Duo fullSync carries on each HEADPHONE
4// node (confirmed from capture, firmware 1.7.3). Unlike MASTERCHANNEL / OUTPUT /
5// DUCKER, HEADPHONE is multi-instance (one per physical headphone jack: 4 on the
6// Pro II), so events and commands carry a headphone index.
7wire_param_enum! {
8    /// A per-headphone parameter: one of the flat properties the device carries
9    /// on a `HEADPHONE` node. The device has one node per physical headphone jack
10    /// (4 on the Pro II), so address a headphone by its index. `headphoneColour`
11    /// is the jack's LED ring colour (ARGB hex string); `headphoneType` selects
12    /// the connected gear profile.
13    HeadphoneParam {
14    Colour => "headphoneColour",
15    Type => "headphoneType",
16    }
17}
18
19#[cfg(test)]
20mod tests {
21    use super::*;
22
23    #[test]
24    fn headphone_param_round_trips_and_exact_wire_names() {
25        for p in [HeadphoneParam::Colour, HeadphoneParam::Type] {
26            assert_eq!(HeadphoneParam::from_name(p.as_str()), p);
27            assert!(p.is_known());
28            assert_eq!(p.to_string(), p.as_str());
29        }
30        assert_eq!(HeadphoneParam::Colour.as_str(), "headphoneColour");
31        assert_eq!(HeadphoneParam::Type.as_str(), "headphoneType");
32    }
33
34    #[test]
35    fn headphone_param_unknown_falls_back_to_other() {
36        let p = HeadphoneParam::from_name("headphoneMystery");
37        assert_eq!(p, HeadphoneParam::Other("headphoneMystery".to_string()));
38        assert!(!p.is_known());
39        assert_eq!(HeadphoneParam::from_name(p.as_str()), p);
40    }
41}