Skip to main content

Program

Struct Program 

Source
pub struct Program {
    pub program_version: u16,
    pub center_panel: CenterPanel,
    pub piano_panel: PianoPanel,
    pub sample_panel: SamplePanel,
    pub organ_panel: OrganPanel,
    pub effects_panel: EffectsPanel,
    /* private fields */
}
Expand description

The 121-byte panel body: five panels behind a version echo. The pads between the panels are unclaimed bits, kept verbatim.

Reads and writes byte-exactly. A read verifies the container checksum, gates on KNOWN_VERSIONS and the aux word, validates the slot, and range-checks every field. Placements are pinned by a change-one-knob specimen corpus written by the instrument; each panel marks its own placements’ provenance.

Unclaimed bits, kept verbatim through a re-encode: 72..=111, 176..=207.

The body’s map, in offset order:

bytesbitsfieldtype
0x00..0x020..=15program_versionu16
0x02..0x0916..=71center_panelCenterPanel
0x09..0x0e72..=111unclaimed
0x0e..0x16112..=175piano_panelPianoPanel
0x16..0x1a176..=207unclaimed
0x1a..0x22208..=271sample_panelSamplePanel
0x22..0x67272..=823organ_panelOrganPanel
0x67..0x79824..=967effects_panelEffectsPanel

Fields§

§program_version: u16

Every specimen echoes the header’s schema version.

Bits 0..=15 (byte 0x00, bits 7..0; byte 0x01, bits 7..0).

§center_panel: CenterPanel

Bytes 0x02..0x09.

§piano_panel: PianoPanel

Bytes 0x0e..0x16.

§sample_panel: SamplePanel

Bytes 0x1a..0x22.

§organ_panel: OrganPanel

Bytes 0x22..0x67.

§effects_panel: EffectsPanel

Bytes 0x67..0x79.

Implementations§

Source§

impl Program

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.

Trait Implementations§

Source§

impl Body for Program

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 Program

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 Program

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 Program

Source§

fn default() -> Program

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

impl From<&Program> for [u8; 121]

Source§

fn from(p: &Program) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<[u8; 121]> for Program

Source§

type Error = ParseError

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

fn try_from(raw: [u8; 121]) -> 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.