Skip to main content

nord_format/formats/ns4/
piano_layers.rs

1//! One piano layer's stored state: model, keyboard zone, octave, timbre and the
2//! acoustic options.
3//!
4//! ⚠️ A layer's **enable and volume are not in here** — the file packs those with
5//! the other layers', a bit and 31 bits apart respectively, so they stay on the
6//! owning body. This block is the part that repeats at a whole-byte stride.
7
8use crate::components::{KbZone4, OctaveShiftNibble, PianoRef, Selector};
9#[nord_bits_derive::bitbody(9)]
10pub struct PianoLayer {
11    #[bits(0..=3)]
12    pub kb_zones: KbZone4,
13    #[bits(4..=7)]
14    pub octave_shift: OctaveShiftNibble,
15    #[bits(8..=8)]
16    pub pitch_stick_enabled: bool,
17    #[bits(9..=9)]
18    pub sustain_pedal_enabled: bool,
19    #[bits(10..=12)]
20    pub piano_type: Selector<3>,
21    #[bits(13..=17)]
22    pub model_slot: Selector<5>,
23    #[bits(18..=19)]
24    pub model_variation: Selector<2>,
25    #[bits(20..=51)]
26    pub model_id: PianoRef,
27    #[bits(52..=52)]
28    pub soft_rel_enabled: bool,
29    #[bits(53..=53)]
30    pub string_res_enabled: bool,
31    #[bits(54..=54)]
32    pub pedal_noise_enabled: bool,
33    #[bits(55..=56)]
34    pub touch: Selector<2>,
35    #[bits(57..=58)]
36    pub unison_level: Selector<2>,
37    #[bits(59..=60)]
38    pub dyn_comp: Selector<2>,
39    #[bits(62..=64)]
40    pub timbre: Selector<3>,
41}