use crate::layout::Layout;
use crate::valuetree::{Node, Property};
use crate::Value;
pub fn n(name: &str) -> Node {
Node {
name: name.to_string(),
properties: vec![],
children: vec![],
}
}
pub fn np(name: &str, properties: Vec<Property>) -> Node {
Node {
name: name.to_string(),
properties,
children: vec![],
}
}
pub fn nc(name: &str, children: Vec<Node>) -> Node {
Node {
name: name.to_string(),
properties: vec![],
children,
}
}
pub fn prop(name: &str, value: Value) -> Property {
Property {
name: name.to_string(),
value,
}
}
pub fn synthetic_root() -> Node {
let phys = nc(
"PHYSICALINTERFACE",
vec![n("HEADER"), n("FADER"), n("FADER"), n("FADER")],
);
let mut children = vec![
n("OTHER"),
phys, n("CHANNEL"),
n("CHANNEL"),
n("CHANNEL"),
];
for _ in 0..26 {
children.push(n("MIX"));
}
for _ in 0..19 {
children.push(n("INPUTSOURCE"));
}
children.push(n("MASTERCHANNEL"));
children.push(n("OUTPUT"));
children.push(n("DUCKER"));
children.push(n("RECORDER"));
children.push(n("PLAYER"));
children.push(n("HEADPHONE"));
children.push(n("HEADPHONE"));
children.push(n("EFFECTS_PARAMETERS"));
children.push(n("EFFECTS_PARAMETERS"));
children.push(n("EFFECTS_PARAMETERS"));
children.push(n("GUI"));
children.push(nc(
"SOUNDPADS",
vec![n("PADHEADER"), n("PAD"), n("PAD"), n("PAD")],
));
children.push(n("SYSTEM"));
nc("DEVICE", children)
}
pub fn layout() -> Layout {
Layout::from_full_sync(&synthetic_root()).unwrap()
}
pub fn minimal_layout() -> Layout {
let phys = nc("PHYSICALINTERFACE", vec![n("FADER")]);
let mut children = vec![phys, n("CHANNEL")];
for _ in 0..13 {
children.push(n("MIX"));
}
Layout::from_full_sync(&nc("DEVICE", children)).unwrap()
}