1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! [`MasterParam`]: the singleton `MASTERCHANNEL`-node parameter family.
// The seven properties a real Pro II / Duo fullSync carries on the single
// MASTERCHANNEL node (confirmed from capture, firmware 1.7.3): the master-bus
// Compellor (RODE's compressor/leveller) plus the master delay.
wire_param_enum! {
/// A master-bus parameter: one of the flat properties the device carries on
/// the single `MASTERCHANNEL` node. There is exactly one master bus, so this
/// family takes no addressing key (unlike [`crate::ChannelParam`], which is
/// per-fader). Covers the master Compellor (RODE's compressor/leveller) and
/// the master delay.
MasterParam {
// Compellor (master compressor / leveller).
CompellorOn => "masterCompellorOn",
CompellorThreshold => "masterCompellorThreshold",
CompellorAttack => "masterCompellorAttack",
CompellorRelease => "masterCompellorRelease",
CompellorGain => "masterCompellorGain",
// Master delay.
DelayOn => "masterDelayOn",
DelaySeconds => "masterDelaySeconds",
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn master_param_name_round_trips() {
// Every typed MASTERCHANNEL param: from_name(as_str(x)) == x.
let params = [
MasterParam::CompellorOn,
MasterParam::CompellorThreshold,
MasterParam::CompellorAttack,
MasterParam::CompellorRelease,
MasterParam::CompellorGain,
MasterParam::DelayOn,
MasterParam::DelaySeconds,
];
for p in params {
assert_eq!(MasterParam::from_name(p.as_str()), p);
assert!(p.is_known());
assert_eq!(p.to_string(), p.as_str());
}
}
#[test]
fn master_param_exact_wire_names() {
// The master* prefix and Compellor casing must match the firmware.
assert_eq!(MasterParam::CompellorOn.as_str(), "masterCompellorOn");
assert_eq!(MasterParam::DelaySeconds.as_str(), "masterDelaySeconds");
}
#[test]
fn master_param_unknown_falls_back_to_other() {
let p = MasterParam::from_name("masterMysteryFlag");
assert_eq!(p, MasterParam::Other("masterMysteryFlag".to_string()));
assert!(!p.is_known());
assert_eq!(MasterParam::from_name(p.as_str()), p);
}
}