Skip to main content

rodecaster_protocol/names/
effects.rs

1//! [`EffectsParam`]: the per-slot root `EFFECTS_PARAMETERS`-node parameter family.
2
3// The (up to) twenty-one properties a real Pro II / Duo fullSync carries on each
4// root-level EFFECTS_PARAMETERS node (confirmed from capture, firmware 1.7.3).
5// The device exposes a contiguous run of these at the tree root, one per
6// channel-strip effects slot, with `effectsIdx` equal to the run ordinal, so
7// address a slot by its index. (The PADEFFECTS node nests its own
8// EFFECTS_PARAMETERS set with non-contiguous indices; those pad/sample effects
9// are a separate addressing context, not covered here.)
10wire_param_enum! {
11    /// A per-slot effects parameter: one of the flat properties the device
12    /// carries on a root `EFFECTS_PARAMETERS` node. The device exposes a
13    /// contiguous run of these (one per channel-strip effects slot), so address a
14    /// slot by its index. Covers the six processors the Rodecaster effects engine
15    /// exposes (reverb, echo/delay, pitch shift, distortion, robot, voice
16    /// disguise), each with its `*On` enable plus its tone controls. `effectsIdx`
17    /// echoes the slot index; `channelInputSource` (present only when the slot is
18    /// bound) is the source the slot processes.
19    EffectsParam {
20    // Reverb.
21    ReverbOn => "reverbOn",
22    ReverbMix => "reverbMix",
23    ReverbModel => "reverbModel",
24    ReverbHighCut => "reverbHighCut",
25    ReverbLowCut => "reverbLowCut",
26    // Echo / delay.
27    EchoOn => "echoOn",
28    EchoMix => "echoMix",
29    EchoDecay => "echoDecay",
30    EchoDelay => "echoDelay",
31    EchoHighCut => "echoHighCut",
32    EchoLowCut => "echoLowCut",
33    // Pitch shift.
34    PitchShiftOn => "pitchShiftOn",
35    PitchShiftSemitones => "pitchShiftSemitones",
36    // Distortion.
37    DistortionOn => "distortionOn",
38    DistortionIntensity => "distortionIntensity",
39    // Robot.
40    RobotOn => "robotOn",
41    RobotLevel => "robotLevel",
42    RobotMix => "robotMix",
43    // Voice disguise.
44    VoiceDisguiseOn => "voiceDisguiseOn",
45    // Identity / binding.
46    Idx => "effectsIdx",
47    InputSource => "channelInputSource",
48    }
49}
50
51#[cfg(test)]
52mod tests {
53    use super::*;
54
55    #[test]
56    fn effects_param_round_trips_and_exact_wire_names() {
57        for p in [
58            EffectsParam::ReverbOn,
59            EffectsParam::ReverbMix,
60            EffectsParam::EchoDelay,
61            EffectsParam::PitchShiftSemitones,
62            EffectsParam::DistortionIntensity,
63            EffectsParam::RobotMix,
64            EffectsParam::VoiceDisguiseOn,
65            EffectsParam::Idx,
66            EffectsParam::InputSource,
67        ] {
68            assert_eq!(EffectsParam::from_name(p.as_str()), p);
69            assert!(p.is_known());
70            assert_eq!(p.to_string(), p.as_str());
71        }
72        assert_eq!(EffectsParam::ReverbModel.as_str(), "reverbModel");
73        assert_eq!(EffectsParam::EchoHighCut.as_str(), "echoHighCut");
74        assert_eq!(EffectsParam::Idx.as_str(), "effectsIdx");
75        // The source binding shares its wire name with the channel strip's source
76        // assignment; which family it resolves to is decided by the node path,
77        // not the property name.
78        assert_eq!(EffectsParam::InputSource.as_str(), "channelInputSource");
79    }
80
81    #[test]
82    fn effects_param_unknown_falls_back_to_other() {
83        let p = EffectsParam::from_name("flangerOn");
84        assert_eq!(p, EffectsParam::Other("flangerOn".to_string()));
85        assert!(!p.is_known());
86        assert_eq!(EffectsParam::from_name(p.as_str()), p);
87    }
88}