Skip to main content

turingmachine/
outputs.rs

1/// Snapshot of all outputs produced by a single step of the Turing Machine.
2///
3/// Each field corresponds to a physical or virtual output jack on the
4/// module.  The struct is marked `#[non_exhaustive]` so that new outputs
5/// can be added in future versions without a breaking change.
6#[derive(Debug, Clone, Default, PartialEq)]
7#[non_exhaustive]
8pub struct StepOutputs {
9    /// Quantized MIDI note number (0--127).
10    pub note: Option<u8>,
11
12    /// Velocity in the range 1--127, or `None` when the step is silent.
13    pub velocity: Option<u8>,
14
15    /// Pulse / gate output for the current step.
16    pub gate: bool,
17
18    /// Independently quantized MIDI note (may use a different scale).
19    pub scale_note: Option<u8>,
20
21    /// Six AND-gate outputs derived from register bits.
22    pub pulses: [bool; 6],
23
24    /// Per-bit gate outputs for the low eight bits of the register.
25    pub gates: [bool; 8],
26
27    /// Clock divided by 2.
28    pub div2: bool,
29
30    /// Clock divided by 4.
31    pub div4: bool,
32
33    /// Random continuous-controller value in the range 0--127.
34    pub noise_cc: u8,
35
36    /// Raw shift-register state.
37    pub register_bits: u16,
38
39    /// Currently active loop length.
40    pub length: usize,
41
42    /// Currently active write probability (0.0 = fully random, 1.0 = locked).
43    pub write_probability: f32,
44}