pub struct Servo<A: Automaton> { /* private fields */ }Expand description
Bridges an automaton to a graph parameter, stepping on every clock tick and sending control commands to the signal graph.
Also accepts external control events (MIDI, OSC, CV/Gate) via
CommandEnum::Control, applying registered Mappings to convert
them into SetParameter commands.
Implementations§
Source§impl<A: Automaton + 'static> Servo<A>
impl<A: Automaton + 'static> Servo<A>
Sourcepub fn new(
id: impl Into<String>,
automaton: A,
target_node: NodeId,
target_param: impl Into<String>,
mapping: ParameterMapping,
min: f64,
max: f64,
system: Arc<ActorSystem>,
graph_ref: ActorRef<CommandEnum>,
) -> Self
pub fn new( id: impl Into<String>, automaton: A, target_node: NodeId, target_param: impl Into<String>, mapping: ParameterMapping, min: f64, max: f64, system: Arc<ActorSystem>, graph_ref: ActorRef<CommandEnum>, ) -> Self
Creates a new Servo linking an automaton to a target parameter.
Sourcepub fn spawn(self, system: &ActorSystem) -> ActorRef<CommandEnum>
pub fn spawn(self, system: &ActorSystem) -> ActorRef<CommandEnum>
Spawns this servo as a detached tokio actor, returning its address.
The actor listens for ClockTick to step the automaton, and for
AutomatonCommand variants to handle enable/reset/UI value events.
Sourcepub fn with_table(self, table: Vec<ParamValue>) -> Self
pub fn with_table(self, table: Vec<ParamValue>) -> Self
Attaches a preset value table; raw automaton output selects table entries by index.
Sourcepub fn with_pitch_bend(self, cc: u8, semitones: f64) -> Self
pub fn with_pitch_bend(self, cc: u8, semitones: f64) -> Self
Enable pitch bend tracking via MIDI CC.
When a pitch bend CC arrives and a note is active, the servo
recalculates frequency as midi_to_freq(note) * 2^(bend/12).
Sourcepub fn with_mod_wheel(self, cc: u8) -> Self
pub fn with_mod_wheel(self, cc: u8) -> Self
Enable mod wheel tracking via MIDI CC.
When a mod wheel CC arrives and a note is active, the servo
recalculates amplitude as (velocity/127) * mod_wheel.
Sourcepub fn with_mappings(self, mappings: Vec<Mapping>) -> Self
pub fn with_mappings(self, mappings: Vec<Mapping>) -> Self
Attaches sensor event mappings for Control dispatch.
When the servo receives a ControlEvent, each mapping is checked;
matching events produce SetParameter commands sent to the graph.
Sourcepub fn with_control(self, strategy: ControlStrategy) -> Self
pub fn with_control(self, strategy: ControlStrategy) -> Self
Set the control strategy — how the automaton affects the parameter value.
Absolute(default): automaton output [0,1] maps to [min,max].Modulation { depth }: automaton output [-1,1] modulates aroundbase.
Sourcepub fn with_conflict(self, strategy: ConflictStrategy) -> Self
pub fn with_conflict(self, strategy: ConflictStrategy) -> Self
Set the conflict resolution strategy — how UI/HID input interacts with automaton control for the same parameter.
LastWriteWins(default): both sources send independently; mailbox order.TouchOverride: HID input freezes automaton untilUiRelease.BasePlusModulation: HID input sets the base value; automaton modulates around it.