pub struct SamplePanel {
pub attack: Level,
pub decay_release: Level,
pub number: u8,
pub id: SampleRef,
pub dynamics: RangedU8<3>,
pub filter: bool,
/* private fields */
}Expand description
The sample panel: which sample plays, its envelope, and its level.
Unclaimed bits, kept verbatim through a re-encode: 57..=63.
The body’s map, in offset order:
| bytes | bits | field | type |
|---|---|---|---|
0x00 bits 7..1 | 0..=6 | attack | Level |
0x00 bit 0; 0x01 bits 7..2 | 7..=13 | decay_release | Level |
0x01 bits 1..0; 0x02 bits 7..2 | 14..=21 | number | u8 |
0x02 bits 1..0; 0x03 bits 7..0; 0x04 bits 7..0; 0x05 bits 7..0; 0x06 bits 7..2 | 22..=53 | id | SampleRef |
0x06 bits 1..0 | 54..=55 | dynamics | RangedU8<3> |
0x07 bit 7 | 56..=56 | filter | bool |
0x07 bits 6..0 | 57..=63 | — | unclaimed |
Fields§
§attack: LevelBits 0..=6 (byte 0x00, bits 7..1).
decay_release: LevelBits 7..=13 (byte 0x00, bit 0; byte 0x01, bits 7..2).
number: u8Zero-based slot in the instrument’s Samp Lib — the panel number minus one. A
position, not an identity: adding or deleting samples renumbers it. Use
id to resolve the dependency.
Bits 14..=21 (byte 0x01, bits 1..0; byte 0x02, bits 7..2).
id: SampleRefThe sample (.nsmp) this program depends on, laid out exactly as
[PianoPanel::id].
Bits 22..=53 (byte 0x02, bits 1..0; byte 0x03, bits 7..0; byte 0x04, bits 7..0; byte 0x05, bits 7..0; byte 0x06, bits 7..2).
dynamics: RangedU8<3>Bits 54..=55 (byte 0x06, bits 1..0).
filter: boolBits 56..=56 (byte 0x07, bit 7).
Implementations§
Source§impl SamplePanel
impl SamplePanel
Sourcepub fn field_values(&self) -> Vec<FieldValue>
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.
pub fn field_specs() -> Vec<FieldSpec>
Trait Implementations§
Source§impl Body for SamplePanel
impl Body for SamplePanel
Source§fn read<R: Read + Seek>(
r: &mut BodyReader<'_, R>,
_: &Header,
) -> Result<Self, Error>
fn read<R: Read + Seek>( r: &mut BodyReader<'_, R>, _: &Header, ) -> Result<Self, Error>
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§impl BodyLayout for SamplePanel
impl BodyLayout for SamplePanel
Source§fn layout() -> &'static [LayoutField]
fn layout() -> &'static [LayoutField]
Source§impl Debug for SamplePanel
The decoded values; the backing bytes are not printed.
impl Debug for SamplePanel
The decoded values; the backing bytes are not printed.