Skip to main content

rodecaster_protocol/names/
output.rs

1//! [`OutputParam`]: the singleton `OUTPUT`-node parameter family.
2
3// The fifteen properties a real Pro II / Duo fullSync carries on the single
4// OUTPUT node (confirmed from capture, firmware 1.7.3): monitor (speaker) and
5// Bluetooth output levels/mutes, the multi-out mode, and the recording-bus
6// flags the firmware co-locates here.
7wire_param_enum! {
8    /// An output-bus parameter: one of the flat properties the device carries on
9    /// the single `OUTPUT` node. There is exactly one, so this family takes no
10    /// addressing key. Covers the monitor (speaker) output, the Bluetooth
11    /// output, the multi-output mode, and the recording-bus flags the firmware
12    /// co-locates on this node.
13    OutputParam {
14    // Monitor (speaker) output.
15    MonLevel => "outputMonLevel",
16    MonMute => "outputMonMute",
17    MonAutoMute => "outputMonAutoMute",
18    MonAutoMuteActive => "outputMonAutoMuteActive",
19    MonFixed => "outputMonFixed",
20    // Bluetooth output.
21    BtLevel => "outputBTLevel",
22    BtMute => "outputBTMute",
23    BtAutoMute => "outputBTAutoMute",
24    BtAutoMuteActive => "outputBTAutoMuteActive",
25    // Multi-output (USB/aux fan-out).
26    MultiMode => "outputMultiMode",
27    MultiBypass => "outputMultiBypass",
28    Prefader => "outputPrefader",
29    // Recording bus (the firmware carries these on OUTPUT).
30    RecordingCompressionQuality => "recordingCompressionQuality",
31    RecordingMultitrackMode => "recordingMultitrackMode",
32    RecordingProcessingBypass => "recordingProcessingBypass",
33    }
34}
35
36#[cfg(test)]
37mod tests {
38    use super::*;
39
40    #[test]
41    fn output_param_name_round_trips() {
42        // Every typed OUTPUT param: from_name(as_str(x)) == x.
43        let params = [
44            OutputParam::MonLevel,
45            OutputParam::MonMute,
46            OutputParam::MonAutoMute,
47            OutputParam::MonAutoMuteActive,
48            OutputParam::MonFixed,
49            OutputParam::BtLevel,
50            OutputParam::BtMute,
51            OutputParam::BtAutoMute,
52            OutputParam::BtAutoMuteActive,
53            OutputParam::MultiMode,
54            OutputParam::MultiBypass,
55            OutputParam::Prefader,
56            OutputParam::RecordingCompressionQuality,
57            OutputParam::RecordingMultitrackMode,
58            OutputParam::RecordingProcessingBypass,
59        ];
60        for p in params {
61            assert_eq!(OutputParam::from_name(p.as_str()), p);
62            assert!(p.is_known());
63            assert_eq!(p.to_string(), p.as_str());
64        }
65    }
66
67    #[test]
68    fn output_param_exact_wire_names() {
69        // The BT acronym is upper-case on the wire; recording* params live on
70        // OUTPUT but keep their own prefix.
71        assert_eq!(OutputParam::BtLevel.as_str(), "outputBTLevel");
72        assert_eq!(OutputParam::MonLevel.as_str(), "outputMonLevel");
73        assert_eq!(
74            OutputParam::RecordingMultitrackMode.as_str(),
75            "recordingMultitrackMode"
76        );
77    }
78
79    #[test]
80    fn output_param_unknown_falls_back_to_other() {
81        let p = OutputParam::from_name("outputMysteryFlag");
82        assert_eq!(p, OutputParam::Other("outputMysteryFlag".to_string()));
83        assert!(!p.is_known());
84        assert_eq!(OutputParam::from_name(p.as_str()), p);
85    }
86}