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
//! # Automaton control strategies
//!
//! Defines how an automaton affects a node parameter and how
//! conflicts between automatic and manual control are resolved.
/// How the automaton affects the target parameter
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ControlStrategy {
/// The automaton sets the parameter value directly.
///
/// The automaton output is expected in the [0, 1] range and is mapped
/// to [min, max] of the target parameter.
Absolute,
/// The automaton modulates around the base value.
///
/// The automaton output is expected in the [-1, 1] range.
/// Final value: `base + mod_val * depth * (max - min)`,
/// clamped to [min, max].
Modulation {
/// Modulation depth (0.0 — no modulation, 1.0 — full range)
depth: f64,
},
}
/// Conflict resolution strategy between UI and automaton
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ConflictStrategy {
/// UI touch freezes the automaton for this port.
///
/// On `UiValue`, the automaton stops affecting the parameter.
/// On `UiRelease`, the automaton resumes control.
TouchOverride,
/// UI sets the base value, the automaton modulates around it.
///
/// The final value is computed using the control strategy formula
/// combining the UI base value and automaton modulation.
BasePlusModulation,
/// The last writer to the queue wins.
///
/// UI and automaton write to the queue independently. The order of
/// application is determined by the message order in the MpscQueue.
LastWriteWins,
}