Skip to main content

rodecaster_protocol/names/
rcsync.rs

1//! [`RcSyncMixParam`]: per-`RCSYNCMIX`-node parameter family.
2//!
3//! `RCSYNCMIX` nodes model the RODECaster Sync bus's own routing matrix.
4//! Six of the seven properties share wire names with the regular `MIX` cell
5//! family (`mixDisabled`, `mixLevelWithAnchor`, `mixLink`, `mixLinkRequest`,
6//! `mixMute`, `mixUnlinkRequest`); one is unique to rcSync
7//! (`mixRcSyncLevelRequest`). Decoding distinguishes RCSYNCMIX from the
8//! regular MIX matrix by path shape: regular MIX cells fall inside the
9//! discovered `first_mix + source * MIX_COUNT_PER_SOURCE + mix` run, while
10//! RCSYNCMIX sits elsewhere.
11
12wire_param_enum! {
13    /// A per-rcSync-mix parameter: the flat properties on each `RCSYNCMIX`
14    /// node. Six wire names are shared with the regular `MIX` cell family
15    /// (`mixDisabled`, `mixLevelWithAnchor`, `mixLink`, `mixLinkRequest`,
16    /// `mixMute`, `mixUnlinkRequest`); `mixRcSyncLevelRequest` is
17    /// rcSync-specific. The two node types are distinguished by path
18    /// shape at decode time.
19    RcSyncMixParam {
20    MixDisabled => "mixDisabled",
21    MixLevelWithAnchor => "mixLevelWithAnchor",
22    MixLink => "mixLink",
23    MixLinkRequest => "mixLinkRequest",
24    MixMute => "mixMute",
25    MixUnlinkRequest => "mixUnlinkRequest",
26    MixRcSyncLevelRequest => "mixRcSyncLevelRequest",
27    }
28}
29
30#[cfg(test)]
31mod tests {
32    use super::*;
33
34    #[test]
35    fn rc_sync_mix_param_round_trips_all_seven() {
36        for p in [
37            RcSyncMixParam::MixDisabled,
38            RcSyncMixParam::MixLevelWithAnchor,
39            RcSyncMixParam::MixLink,
40            RcSyncMixParam::MixLinkRequest,
41            RcSyncMixParam::MixMute,
42            RcSyncMixParam::MixUnlinkRequest,
43            RcSyncMixParam::MixRcSyncLevelRequest,
44        ] {
45            assert_eq!(RcSyncMixParam::from_name(p.as_str()), p);
46            assert!(p.is_known());
47        }
48    }
49}