Skip to main content

nord_format/formats/ne5/program/
sample.rs

1//! The sample panel.
2
3use crate::components::SampleRef;
4use crate::formats::ne5::Level;
5use crate::types::RangedU8;
6use nord_bits_derive::bitbody;
7
8// 0x46..=0x4d — the sample panel.
9
10/// The sample panel: which sample plays, its envelope, and its level.
11#[bitbody(8)]
12#[derive(Default)]
13pub struct SamplePanel {
14    #[bits(0..=6)]
15    pub attack: Level,
16    #[bits(7..=13)]
17    pub decay_release: Level,
18    /// Zero-based slot in the instrument's Samp Lib — the panel number minus one. A
19    /// position, not an identity: adding or deleting samples renumbers it. Use
20    /// [`id`](Self::id) to resolve the dependency.
21    #[bits(14..=21)]
22    pub number: u8,
23    /// The sample (`.nsmp`) this program depends on, laid out exactly as
24    /// [`PianoPanel::id`].
25    #[bits(22..=53)]
26    pub id: SampleRef,
27    #[bits(54..=55)]
28    pub dynamics: RangedU8<3>,
29    #[bits(56..=56)]
30    pub filter: bool,
31}