pub enum ControlKind {
Toggle,
Selector,
Knob(Unit),
Bipolar(Unit),
Drawbar {
bars: u8,
rank: Option<u8>,
bits_per_bar: u8,
order: PackedOrder,
},
Morph {
of: Option<&'static str>,
},
Pattern {
steps: u8,
bits_per_step: u8,
order: PackedOrder,
},
Reference(Library),
Shift(Unit),
Number,
}Expand description
What the panel puts under a reader’s finger.
The registry already says where a field sits and which values it takes; this says what
kind of thing it is, so a caller can choose a widget without a table of field names
beside it. It comes from the field’s type, so a field gets it right by being declared
with the type that matches the control — a bool is a button, a Level is a knob.
Variants§
Toggle
A two-state button. Its two states may have names — see the field’s legal values.
Selector
A selector over a fixed set of named values.
Knob(Unit)
A continuous knob or slider, reading in unit.
Bipolar(Unit)
A knob whose musical zero is its centre, reading in unit either side.
Drawbar
One or more drawbars, each 0..=8, drawn as bars rather than numbers.
Fields
bars: u8How many bars the field holds, in register order. The Stage models give each bar its own field and the Electro 5 packs a whole register into one, so this is what tells a caller which it is holding.
rank: Option<u8>Where the field’s first bar sits in the register: 1 is the leftmost bar, 9 the rightmost of a nine-bar manual. A whole register starts at 1 and a single Stage bar carries its own position.
⚠️ A position, not a pitch. Which harmonic each position draws is the organ model’s business — the B3’s 16’/5⅓’/8’ series is not the Vox’s or the Farfisa’s, and the same nine positions serve all of them here — so labelling them is for a caller that knows which model the field belongs to.
None where the declaration does not place the bar in a register at all: the
Electro 5’s bass manual, whose two bars nothing establishes the position of.
order: PackedOrderWhich end of the field the first bar sits at. Only meaningful above one bar, and the reason it is here: the Electro 5 packs its nine nibbles high-first while the arpeggiator packs its steps low-first, so a caller reading one by the other’s convention draws the register mirrored.
Morph
The value a performance control morphs its parent parameter to. Belongs on that parent’s control, not on one of its own.
Fields
of: Option<&'static str>The parent parameter’s field name, as a sibling of this field — the full path
is this field’s path with its last segment replaced, which is what
FieldSpec::morph_parent does.
None where the body declares no parameter under the name this slot’s own
name implies, so the slot stands alone until one is placed beside it.
Pattern
A per-step pattern grid: steps steps of bits_per_step bits, the first step at
the order end.
Reference(Library)
An opaque id into one of the instrument’s libraries.
Shift(Unit)
A signed shift, reading in unit.
Number
An integer nothing has been claimed about — the default, and a standing invitation to give the field a type that says more.
Implementations§
Source§impl ControlKind
impl ControlKind
Sourcepub const fn morphing(self, parent: &'static str) -> ControlKind
pub const fn morphing(self, parent: &'static str) -> ControlKind
Name the parent a morph slot morphs — the sibling field, not a path.
#[bitbody] applies this from the field’s own name, and only where the body
really declares that sibling. Every other kind is returned unchanged, so a field
named like a morph slot but typed as something else keeps what its type said.
Sourcepub const fn ranked(self, rank: u8) -> ControlKind
pub const fn ranked(self, rank: u8) -> ControlKind
Place a drawbar in its register: rank 1 is the leftmost bar.
Applied by #[bitbody] from a …_N field name, and ignored by every other kind
— a field whose name happens to end in a digit is not a drawbar unless its type
says so.
Trait Implementations§
Source§impl Clone for ControlKind
impl Clone for ControlKind
Source§fn clone(&self) -> ControlKind
fn clone(&self) -> ControlKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ControlKind
Source§impl Debug for ControlKind
impl Debug for ControlKind
impl Eq for ControlKind
Source§impl Hash for ControlKind
impl Hash for ControlKind
Source§impl PartialEq for ControlKind
impl PartialEq for ControlKind
impl StructuralPartialEq for ControlKind
Auto Trait Implementations§
impl Freeze for ControlKind
impl RefUnwindSafe for ControlKind
impl Send for ControlKind
impl Sync for ControlKind
impl Unpin for ControlKind
impl UnsafeUnpin for ControlKind
impl UnwindSafe for ControlKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.