pub enum StructOp {
Replace {
key: String,
kind: NodeKind,
},
Insert {
key: String,
kind: NodeKind,
},
Delete {
key: String,
},
SetMod {
key: String,
kind: ModKind,
},
SwapMix {
key: String,
},
ReplaceTree {
key: String,
node: AudioNode,
},
InsertTree {
key: String,
node: AudioNode,
},
SetModTree {
key: String,
m: ModNode,
},
}Expand description
One structural edit.
Variants§
Replace
Replace the node at key with a kind (subtrees preserved where the
sorts allow; replacing a source with a processor wraps the source).
Insert
Insert a processor/mix between the node at key and its parent
(i.e., into the wire toward the output).
Delete
Delete the node at key, splicing its (primary) input up.
SetMod
Set the modulation slot of the module at key (everything but the
two slotless binary nodes has one).
key addresses the audio module that owns the slot, not the slot
itself. A source kind replaces the slot’s whole term; a shaper wraps
it — see ModKind. To edit deeper into a chain, or to install one
wholesale, use StructOp::SetModTree.
SwapMix
Swap the two audio inputs of the binary node at key.
Named for the only production that accepted it when it was written; it now applies to all six two-input kinds, because “swap the two inputs” is a musical move on every one of them and the menu has always offered it on every one of them.
ReplaceTree
Replace the subtree at key with an explicit fragment (the wire
gesture “plug this staged chain in here, discard what was there” —
callers park the old subtree client-side).
InsertTree
Insert an explicit processor/mix fragment into the wire between
key and its parent; the old subtree becomes the fragment’s primary
input (a Mix keeps its own b branch).
SetModTree
Install an explicit modulation fragment on the module at key.