wire_param_enum! {
ChannelParam {
EqOn => "eqOn",
EqLowOn => "eqLowOn",
EqLowGain => "eqLowGain",
EqLowQ => "eqLowQ",
EqLowShelf => "eqLowShelf",
EqMidOn => "eqMidOn",
EqMidGain => "eqMidGain",
EqMidQ => "eqMidQ",
EqMidBell => "eqMidBell",
EqHighOn => "eqHighOn",
EqHighGain => "eqHighGain",
EqHighQ => "eqHighQ",
EqHighBell => "eqHighBell",
CompressorOn => "compressorOn",
CompressorThreshold => "compressorThreshold",
CompressorRatio => "compressorRatio",
CompressorAttack => "compressorAttack",
CompressorRelease => "compressorRelease",
CompressorGain => "compressorGain",
DeesserOn => "deesserOn",
DeesserThreshold => "deesserThreshold",
DeesserRatio => "deesserRatio",
DeesserAttack => "deesserAttack",
DeesserRelease => "deesserRelease",
DeesserGain => "deesserGain",
DeesserFrequency => "deesserFrequency",
NoiseGateOn => "noiseGateOn",
NoiseGateThreshold => "noiseGateThreshold",
NoiseGateRange => "noiseGateRange",
NoiseGateAttack => "noiseGateAttack",
NoiseGateHold => "noiseGateHold",
NoiseGateRelease => "noiseGateRelease",
NoiseGateHysteresis => "noiseGateHysteresis",
HpfOn => "hpfOn",
HpfFrequency => "hpfFrequency",
HpfSlope => "hpfSlope",
HpfLowerOn => "hpfLowerOn",
HpfHigherOn => "hpfHigherOn",
AphexOn => "aphexOn",
AphexAeMix => "aphexAEMix",
AphexAeTune => "aphexAETune",
AphexBbDrive => "aphexBBDrive",
AphexBbTune => "aphexBBTune",
PanOn => "channelPanOn",
Pan => "channelPan",
PanL => "channelPanL",
PanR => "channelPanR",
PanMode => "channelPanMode",
Depth => "channelDepth",
Sparkle => "channelSparkle",
Punch => "channelPunch",
AdvancedProcessing => "channelAdvancedProcessing",
BypassProcessing => "channelBypassProcessing",
CurrentFxPreset => "channelCurrentFxPreset",
ListenSource => "channelListenSource",
TalkbackEnable => "channelTalkbackEnable",
WirelessMute => "channelWirelessMute",
ChannelIndex => "channelIndex",
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn channel_param_name_round_trips() {
let params = [
ChannelParam::EqHighGain,
ChannelParam::CompressorThreshold,
ChannelParam::DeesserFrequency,
ChannelParam::NoiseGateOn,
ChannelParam::HpfSlope,
ChannelParam::AphexAeMix,
ChannelParam::PanMode,
ChannelParam::Depth,
ChannelParam::ListenSource,
ChannelParam::WirelessMute,
];
for p in params {
assert_eq!(ChannelParam::from_name(p.as_str()), p);
assert!(p.is_known());
assert_eq!(p.to_string(), p.as_str());
}
}
#[test]
fn channel_param_exact_wire_names() {
assert_eq!(ChannelParam::AphexAeMix.as_str(), "aphexAEMix");
assert_eq!(ChannelParam::AphexBbDrive.as_str(), "aphexBBDrive");
assert_eq!(ChannelParam::Pan.as_str(), "channelPan");
assert_eq!(ChannelParam::Depth.as_str(), "channelDepth");
}
#[test]
fn channel_param_unknown_falls_back_to_other() {
let p = ChannelParam::from_name("channelMysteryKnob");
assert_eq!(p, ChannelParam::Other("channelMysteryKnob".to_string()));
assert!(!p.is_known());
assert_eq!(p.as_str(), "channelMysteryKnob");
assert_eq!(ChannelParam::from_name(p.as_str()), p);
}
}