Skip to main content

OrganPanel

Struct OrganPanel 

Source
pub struct OrganPanel {
Show 27 fields pub b3_vib: B3Vib, pub b3_perc_third: bool, pub b3_perc_speed: B3PercSpeed, pub b3_preset2_selected: bool, pub b3_preset1_drawbars: Drawbars, pub b3_preset1_vib: bool, pub b3_preset1_perc: bool, pub b3_bass_bar1: Drawbar, pub b3_bass_bar2: Drawbar, pub b3_preset2_drawbars: Drawbars, pub b3_preset2_vib: bool, pub b3_preset2_perc: bool, pub vox_vib: VoxVib, pub vox_preset2_selected: bool, pub vox_preset1_drawbars: Drawbars, pub vox_preset1_vib: bool, pub vox_preset2_drawbars: Drawbars, pub vox_preset2_vib: bool, pub farfisa_vib: FarfisaVib, pub farfisa_preset2_selected: bool, pub farfisa_preset1_drawbars: Drawbars, pub farfisa_preset1_vib: bool, pub farfisa_preset2_drawbars: Drawbars, pub farfisa_preset2_vib: bool, pub pipe_preset2_selected: bool, pub pipe_preset1_drawbars: Drawbars, pub pipe_preset2_drawbars: Drawbars, /* private fields */
}
Expand description

The organ panel: drawbar and vib/perc registration for every model and both presets, stored in full so switching either is lossless.

Unclaimed bits, kept verbatim through a re-encode: 0..=23, 30..=40, 42..=55, 102..=111, 150..=167, 171..=184, 186..=199, 237..=247, 285..=295, 299..=312, 314..=327, 365..=375, 413..=440, 442..=455, 492..=503, 540..=551.

The body’s map, in offset order:

bytesbitsfieldtype
0x00..0x030..=23unclaimed
0x03 bits 7..524..=26b3_vibB3Vib
0x03 bit 427..=27b3_perc_thirdbool
0x03 bits 3..228..=29b3_perc_speedB3PercSpeed
0x03 bits 1..0; 0x04 bits 7..0; 0x05 bit 730..=40unclaimed
0x05 bit 641..=41b3_preset2_selectedbool
0x05 bits 5..0; 0x06 bits 7..042..=55unclaimed
0x07 bits 7..0; 0x08 bits 7..0; 0x09 bits 7..0; 0x0a bits 7..0; 0x0b bits 7..456..=91b3_preset1_drawbarsDrawbars
0x0b bit 392..=92b3_preset1_vibbool
0x0b bit 293..=93b3_preset1_percbool
0x0b bits 1..0; 0x0c bits 7..694..=97b3_bass_bar1Drawbar
0x0c bits 5..298..=101b3_bass_bar2Drawbar
0x0c bits 1..0; 0x0d bits 7..0102..=111unclaimed
0x0e bits 7..0; 0x0f bits 7..0; 0x10 bits 7..0; 0x11 bits 7..0; 0x12 bits 7..4112..=147b3_preset2_drawbarsDrawbars
0x12 bit 3148..=148b3_preset2_vibbool
0x12 bit 2149..=149b3_preset2_percbool
0x12 bits 1..0; 0x13 bits 7..0; 0x14 bits 7..0150..=167unclaimed
0x15 bits 7..5168..=170vox_vibVoxVib
0x15 bits 4..0; 0x16 bits 7..0; 0x17 bit 7171..=184unclaimed
0x17 bit 6185..=185vox_preset2_selectedbool
0x17 bits 5..0; 0x18 bits 7..0186..=199unclaimed
0x19 bits 7..0; 0x1a bits 7..0; 0x1b bits 7..0; 0x1c bits 7..0; 0x1d bits 7..4200..=235vox_preset1_drawbarsDrawbars
0x1d bit 3236..=236vox_preset1_vibbool
0x1d bits 2..0; 0x1e bits 7..0237..=247unclaimed
0x1f bits 7..0; 0x20 bits 7..0; 0x21 bits 7..0; 0x22 bits 7..0; 0x23 bits 7..4248..=283vox_preset2_drawbarsDrawbars
0x23 bit 3284..=284vox_preset2_vibbool
0x23 bits 2..0; 0x24 bits 7..0285..=295unclaimed
0x25 bits 7..5296..=298farfisa_vibFarfisaVib
0x25 bits 4..0; 0x26 bits 7..0; 0x27 bit 7299..=312unclaimed
0x27 bit 6313..=313farfisa_preset2_selectedbool
0x27 bits 5..0; 0x28 bits 7..0314..=327unclaimed
0x29 bits 7..0; 0x2a bits 7..0; 0x2b bits 7..0; 0x2c bits 7..0; 0x2d bits 7..4328..=363farfisa_preset1_drawbarsDrawbars
0x2d bit 3364..=364farfisa_preset1_vibbool
0x2d bits 2..0; 0x2e bits 7..0365..=375unclaimed
0x2f bits 7..0; 0x30 bits 7..0; 0x31 bits 7..0; 0x32 bits 7..0; 0x33 bits 7..4376..=411farfisa_preset2_drawbarsDrawbars
0x33 bit 3412..=412farfisa_preset2_vibbool
0x33 bits 2..0; 0x34 bits 7..0; 0x35 bits 7..0; 0x36 bits 7..0; 0x37 bit 7413..=440unclaimed
0x37 bit 6441..=441pipe_preset2_selectedbool
0x37 bits 5..0; 0x38 bits 7..0442..=455unclaimed
0x39 bits 7..0; 0x3a bits 7..0; 0x3b bits 7..0; 0x3c bits 7..0; 0x3d bits 7..4456..=491pipe_preset1_drawbarsDrawbars
0x3d bits 3..0; 0x3e bits 7..0492..=503unclaimed
0x3f bits 7..0; 0x40 bits 7..0; 0x41 bits 7..0; 0x42 bits 7..0; 0x43 bits 7..4504..=539pipe_preset2_drawbarsDrawbars
0x43 bits 3..0; 0x44 bits 7..0540..=551unclaimed

Fields§

§b3_vib: B3Vib

Shared across presets.

Bits 24..=26 (byte 0x03, bits 7..5).

§b3_perc_third: bool

Percussion third harmonic, shared across presets.

Bits 27..=27 (byte 0x03, bit 4).

§b3_perc_speed: B3PercSpeed

Shared across presets.

Bits 28..=29 (byte 0x03, bits 3..2).

§b3_preset2_selected: bool

Bits 41..=41 (byte 0x05, bit 6).

§b3_preset1_drawbars: Drawbars

Bits 56..=91 (byte 0x07, bits 7..0; byte 0x08, bits 7..0; byte 0x09, bits 7..0; byte 0x0a, bits 7..0; byte 0x0b, bits 7..4).

§b3_preset1_vib: bool

Bits 92..=92 (byte 0x0b, bit 3).

§b3_preset1_perc: bool

Bits 93..=93 (byte 0x0b, bit 2).

§b3_bass_bar1: Drawbar

First bass drawbar of b3+bass preset 1 — see OrganPanel::b3_bass_drawbars. It is not in the nine-nibble block, and the two nibbles it shadows there hold stale leftovers.

Bits 94..=97 (byte 0x0b, bits 1..0; byte 0x0c, bits 7..6).

§b3_bass_bar2: Drawbar

Second bass drawbar of b3+bass preset 1. The four bits after it are unused.

Bits 98..=101 (byte 0x0c, bits 5..2).

§b3_preset2_drawbars: Drawbars

Bits 112..=147 (byte 0x0e, bits 7..0; byte 0x0f, bits 7..0; byte 0x10, bits 7..0; byte 0x11, bits 7..0; byte 0x12, bits 7..4).

§b3_preset2_vib: bool

Bits 148..=148 (byte 0x12, bit 3).

§b3_preset2_perc: bool

Bits 149..=149 (byte 0x12, bit 2).

§vox_vib: VoxVib

Shared across presets.

Bits 168..=170 (byte 0x15, bits 7..5).

§vox_preset2_selected: bool

Bits 185..=185 (byte 0x17, bit 6).

§vox_preset1_drawbars: Drawbars

Bits 200..=235 (byte 0x19, bits 7..0; byte 0x1a, bits 7..0; byte 0x1b, bits 7..0; byte 0x1c, bits 7..0; byte 0x1d, bits 7..4).

§vox_preset1_vib: bool

Bits 236..=236 (byte 0x1d, bit 3).

§vox_preset2_drawbars: Drawbars

Bits 248..=283 (byte 0x1f, bits 7..0; byte 0x20, bits 7..0; byte 0x21, bits 7..0; byte 0x22, bits 7..0; byte 0x23, bits 7..4).

§vox_preset2_vib: bool

Bits 284..=284 (byte 0x23, bit 3).

§farfisa_vib: FarfisaVib

Shared across presets.

Bits 296..=298 (byte 0x25, bits 7..5).

§farfisa_preset2_selected: bool

Bits 313..=313 (byte 0x27, bit 6).

§farfisa_preset1_drawbars: Drawbars

Stored as positions, read by the instrument as tabs — see OrganPanel::farfisa_tabs.

Bits 328..=363 (byte 0x29, bits 7..0; byte 0x2a, bits 7..0; byte 0x2b, bits 7..0; byte 0x2c, bits 7..0; byte 0x2d, bits 7..4).

§farfisa_preset1_vib: bool

Bits 364..=364 (byte 0x2d, bit 3).

§farfisa_preset2_drawbars: Drawbars

Bits 376..=411 (byte 0x2f, bits 7..0; byte 0x30, bits 7..0; byte 0x31, bits 7..0; byte 0x32, bits 7..0; byte 0x33, bits 7..4).

§farfisa_preset2_vib: bool

Bits 412..=412 (byte 0x33, bit 3).

§pipe_preset2_selected: bool

Bits 441..=441 (byte 0x37, bit 6).

§pipe_preset1_drawbars: Drawbars

Bits 456..=491 (byte 0x39, bits 7..0; byte 0x3a, bits 7..0; byte 0x3b, bits 7..0; byte 0x3c, bits 7..0; byte 0x3d, bits 7..4).

§pipe_preset2_drawbars: Drawbars

Bits 504..=539 (byte 0x3f, bits 7..0; byte 0x40, bits 7..0; byte 0x41, bits 7..0; byte 0x42, bits 7..0; byte 0x43, bits 7..4).

Implementations§

Source§

impl OrganPanel

Source

pub fn field_values(&self) -> Vec<FieldValue>

Every registered field’s current value, under its full path, in declaration order — nested bodies inline where their field sits. Describes the same fields as Self::field_specs, so callers may zip the two positionally.

Source

pub fn field_specs() -> Vec<FieldSpec>

Source

pub fn fields(&self) -> Vec<Field>

Every settable field, described under its full path.

Source

pub fn set_field(&mut self, path: &str, value: &str) -> Result<(), FieldError>

Set one field by its full path.

Source§

impl OrganPanel

Source

pub fn preset(&self, model: OrganModel) -> Preset

The registration model is playing.

Source

pub fn drawbars(&self, model: OrganModel, preset: Preset) -> [u8; 9]

The nine drawbar positions (physical, 0..=8) stored for model’s preset. This is the on-disk value; per-model display transforms (Farfisa on/off, Vox’s ignored 8th bar, B3-bass bass-bar remap) are not applied.

Source

pub fn b3_bass_drawbars(&self) -> [u8; 2]

The two bass drawbars of B3-with-bass, preset 1 — the bass manual.

These are not in the nine-nibble block. In b3+bass mode preset 1 is the bass manual (only bars 1–2 are live) and preset 2 is the ordinary B3; the bass registration sits in its own four-bit pair after the block, which is why it does not move when the drawbars do.

⚠️ Do not read bars 1–2 from Self::drawbars in this mode — those two nibbles hold stale leftovers, not zero and not the bass values.

Confirmed on hardware. The captures are 1100_400000000 and 1100_040000000.

Source

pub fn farfisa_tabs(&self, preset: Preset) -> [bool; 9]

Farfisa drawbars as the instrument actually treats them: on/off tabs, not continuous positions.

A stored nibble of ≥5 reads as on, anything lower as off. Use this rather than Self::drawbars for Farfisa — the raw 0..=8 value is stored faithfully but has no meaning beyond which side of the threshold it falls.

Source

pub fn vib_on(&self, model: OrganModel, preset: Preset) -> bool

Whether vibrato/chorus is on for model’s preset. Pipe has none.

Source

pub fn vib_type(&self, model: OrganModel) -> Option<VibChorus>

The vibrato/chorus mode selected for model (shared across presets), or None for Pipe and for an index the model does not use. Each model offers a different subset of the six modes at a different index, so the stored value is only meaningful alongside the model.

Source

pub fn b3_perc_on(&self, preset: Preset) -> bool

Whether B3 percussion is on for preset (B3 only).

Source

pub fn b3_perc_third(&self) -> bool

Whether B3 percussion uses the third harmonic (shared across presets).

Source

pub fn b3_perc_speed(&self) -> PercSpeed

B3 percussion decay speed (shared across presets). The on-disk encoding is not monotonic — soft, fast and both store 2, 1 and 3.

Source

pub fn set_preset(&mut self, model: OrganModel, preset: Preset)

Play preset on model.

Source

pub fn set_drawbars( &mut self, model: OrganModel, preset: Preset, bars: [u8; 9], ) -> Result<(), ParseError>

Store nine drawbar positions, 0..=8. A higher one is refused rather than truncated, since two bars share a byte.

Source

pub fn set_farfisa_tabs(&mut self, preset: Preset, tabs: [bool; 9])

Set the Farfisa tabs: on stores 8, off stores 0. Any other stored value is lost — the instrument only reads which side of the ≥5 threshold it falls on, but the byte does change, so this will not round-trip a program you only meant to read.

Source

pub fn set_vib_on(&mut self, model: OrganModel, preset: Preset, on: bool)

Turn vibrato/chorus on or off for model’s preset. No-op for Pipe, which has none.

Source

pub fn set_vib_type( &mut self, model: OrganModel, vib: VibChorus, ) -> Result<(), ParseError>

Select the vibrato/chorus mode for model, shared across presets. Fails for a mode the model does not offer; Pipe has none.

Source

pub fn set_b3_perc_on(&mut self, preset: Preset, on: bool)

Turn B3 percussion on or off for preset.

Source

pub fn set_b3_perc_third(&mut self, on: bool)

Percussion third harmonic (shared across presets).

Source

pub fn set_b3_perc_speed(&mut self, speed: PercSpeed)

Percussion decay speed (shared across presets). Note the encoding is not monotonic — see Self::b3_perc_speed.

Source

pub fn set_b3_bass_drawbars(&mut self, bars: [u8; 2]) -> Result<(), ParseError>

Set the two bass drawbars of b3+bass preset 1, 0..=8.

Trait Implementations§

Source§

impl Body for OrganPanel

Source§

const LEN: Option<u64>

Fixed body length, when the format has one; checked on read and write.
Source§

fn read<R: Read + Seek>( r: &mut BodyReader<'_, R>, _: &Header, ) -> Result<Self, Error>

Decode from r, which is scoped to the body: position 0 is the first body byte and BodyReader::len is known. header is for version gating and location/aux interpretation, not for layout — the container already consumed the header bytes.
Source§

fn write<W: Write + Seek>(&self, w: &mut BodyWriter<'_, W>) -> Result<(), Error>

Encode to w in one forward pass.
Source§

impl BodyLayout for OrganPanel

Source§

fn layout() -> &'static [LayoutField]

Every placed field, in declaration order. Bits no field claims are preserved by the codec but have no entry here — there is no name to report them under.
Source§

impl Debug for OrganPanel

The decoded values; the backing bytes are not printed.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OrganPanel

[u8; 69] has no Default — the std impls stop at 32 — so this one goes through the decode, which every organ field is total over.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&OrganPanel> for [u8; 69]

Source§

fn from(p: &OrganPanel) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<[u8; 69]> for OrganPanel

Source§

type Error = ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: [u8; 69]) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.