Skip to main content

deepmind_midi/program/
generated.rs

1//! The program layer's value types and typed accessors, generated from `spec/`.
2//!
3//! Do not edit. `cargo xtask codegen` rewrites this file, and `cargo test` fails
4//! when it does not match the specification it came from. [`Program`] itself,
5//! and everything that is not one parameter or one value table, is in the parent
6//! module.
7
8// A value table lands here as one match arm per value, and the largest has 133
9// of them. Chunking those to satisfy a length lint would only hide what they
10// are, and two values a firmware does not have are two arms answering `None`.
11#![expect(
12    clippy::too_many_lines,
13    clippy::match_same_arms,
14    reason = "generated tables, not logic"
15)]
16
17use core::fmt;
18
19use super::Program;
20use crate::param::{DEFAULT_FIRMWARE, ParamId, TableId};
21use crate::sysex::inquiry::Version;
22
23/// Offset of the first byte of the program's name.
24pub const NAME_OFFSET: u8 = 223;
25
26/// Bytes the name occupies. It holds sixteen characters and a terminator.
27pub const NAME_LEN: usize = 17;
28
29/// The parameters the program's name is stored in, in the order they print.
30///
31/// The instrument stores a name one character to a parameter, which is the
32/// truth about the wire and a lie about what a person is editing. A host
33/// drawing the parameter table needs to know which of its slots are the name,
34/// so that seventeen faders become the one field the display shows; this is
35/// that answer, and it moves with the field rather than being counted again.
36///
37/// Typing a letter still costs one message to the one parameter it moved:
38/// [`Program::set_name`] writes the field and
39/// [`Program::changes`](super::Program::changes) works out what that cost.
40pub static NAME_PARAMETERS: [ParamId; NAME_LEN] = [
41    ParamId::ProgramNameChar1,
42    ParamId::ProgramNameChar2,
43    ParamId::ProgramNameChar3,
44    ParamId::ProgramNameChar4,
45    ParamId::ProgramNameChar5,
46    ParamId::ProgramNameChar6,
47    ParamId::ProgramNameChar7,
48    ParamId::ProgramNameChar8,
49    ParamId::ProgramNameChar9,
50    ParamId::ProgramNameChar10,
51    ParamId::ProgramNameChar11,
52    ParamId::ProgramNameChar12,
53    ParamId::ProgramNameChar13,
54    ParamId::ProgramNameChar14,
55    ParamId::ProgramNameChar15,
56    ParamId::ProgramNameChar16,
57    ParamId::ProgramNameChar17,
58];
59
60/// Arpeggiator Mode.
61///
62/// Every value the synthesizer has a name for. A byte outside the table is not
63/// one of these: [`ArpMode::from_raw`] answers `None` for it, and the byte stays
64/// in the program either way.
65#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
66#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
67#[non_exhaustive]
68pub enum ArpMode {
69    /// Up.
70    Up,
71    /// Down.
72    Down,
73    /// Up & Down.
74    UpAndDown,
75    /// Up Inv.
76    UpInv,
77    /// Down Inv.
78    DownInv,
79    /// Up & Down Inv.
80    UpAndDownInv,
81    /// Up Alt.
82    UpAlt,
83    /// Down Alt.
84    DownAlt,
85    /// Random.
86    Random,
87    /// As Played.
88    AsPlayed,
89    /// Chord.
90    Chord,
91}
92
93impl ArpMode {
94    /// The value table this type lists.
95    pub const TABLE: TableId = TableId::ArpMode;
96
97    /// Every value, in the order the newest firmware numbers them.
98    pub const ALL: &'static [Self] = &[
99        Self::Up,
100        Self::Down,
101        Self::UpAndDown,
102        Self::UpInv,
103        Self::DownInv,
104        Self::UpAndDownInv,
105        Self::UpAlt,
106        Self::DownAlt,
107        Self::Random,
108        Self::AsPlayed,
109        Self::Chord,
110    ];
111
112    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
113    ///
114    /// `None` when the table does not list the byte.
115    #[must_use]
116    pub const fn from_raw(raw: u8) -> Option<Self> {
117        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
118    }
119
120    /// Returns the value this byte selects on the firmware a device inquiry
121    /// reported.
122    ///
123    /// Every firmware numbers this table the same way, so the version makes no
124    /// difference here; it is taken so that every value type reads alike.
125    #[must_use]
126    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
127        match raw {
128            0 => Some(Self::Up),
129            1 => Some(Self::Down),
130            2 => Some(Self::UpAndDown),
131            3 => Some(Self::UpInv),
132            4 => Some(Self::DownInv),
133            5 => Some(Self::UpAndDownInv),
134            6 => Some(Self::UpAlt),
135            7 => Some(Self::DownAlt),
136            8 => Some(Self::Random),
137            9 => Some(Self::AsPlayed),
138            10 => Some(Self::Chord),
139            _ => None,
140        }
141    }
142
143    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
144    #[must_use]
145    pub const fn raw(self) -> u8 {
146        match self {
147            Self::Up => 0,
148            Self::Down => 1,
149            Self::UpAndDown => 2,
150            Self::UpInv => 3,
151            Self::DownInv => 4,
152            Self::UpAndDownInv => 5,
153            Self::UpAlt => 6,
154            Self::DownAlt => 7,
155            Self::Random => 8,
156            Self::AsPlayed => 9,
157            Self::Chord => 10,
158        }
159    }
160
161    /// Returns the byte that selects this value on the firmware a device inquiry
162    /// reported.
163    ///
164    /// Always `Some` for this table, which every firmware numbers the same way.
165    #[must_use]
166    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
167        Some(self.raw())
168    }
169
170    /// Returns the name the synthesizer's display writes, as of
171    /// [`DEFAULT_FIRMWARE`].
172    #[must_use]
173    pub fn name(self) -> &'static str {
174        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
175    }
176
177    /// Returns the name the synthesizer's display writes on the firmware a
178    /// device inquiry reported.
179    ///
180    /// `None` for a value that firmware does not have. The names live in the
181    /// value table the parameter layer already carries; nothing here holds a
182    /// second copy of them.
183    #[must_use]
184    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
185        let raw = self.raw_for(firmware)?;
186        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
187    }
188}
189
190impl fmt::Display for ArpMode {
191    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
192        f.write_str(self.name())
193    }
194}
195
196/// Envelope Trigger Source.
197///
198/// Every value the synthesizer has a name for. A byte outside the table is not
199/// one of these: [`EnvelopeTrigger::from_raw`] answers `None` for it, and the byte stays
200/// in the program either way.
201#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
202#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
203#[non_exhaustive]
204pub enum EnvelopeTrigger {
205    /// Key.
206    Key,
207    /// LFO 1.
208    Lfo1,
209    /// LFO 2.
210    Lfo2,
211    /// Loop.
212    Loop,
213    /// Control Sequencer Step.
214    ControlSequencerStep,
215}
216
217impl EnvelopeTrigger {
218    /// The value table this type lists.
219    pub const TABLE: TableId = TableId::EnvelopeTrigger;
220
221    /// Every value, in the order the newest firmware numbers them.
222    pub const ALL: &'static [Self] = &[
223        Self::Key,
224        Self::Lfo1,
225        Self::Lfo2,
226        Self::Loop,
227        Self::ControlSequencerStep,
228    ];
229
230    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
231    ///
232    /// `None` when the table does not list the byte.
233    #[must_use]
234    pub const fn from_raw(raw: u8) -> Option<Self> {
235        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
236    }
237
238    /// Returns the value this byte selects on the firmware a device inquiry
239    /// reported.
240    ///
241    /// Every firmware numbers this table the same way, so the version makes no
242    /// difference here; it is taken so that every value type reads alike.
243    #[must_use]
244    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
245        match raw {
246            0 => Some(Self::Key),
247            1 => Some(Self::Lfo1),
248            2 => Some(Self::Lfo2),
249            3 => Some(Self::Loop),
250            4 => Some(Self::ControlSequencerStep),
251            _ => None,
252        }
253    }
254
255    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
256    #[must_use]
257    pub const fn raw(self) -> u8 {
258        match self {
259            Self::Key => 0,
260            Self::Lfo1 => 1,
261            Self::Lfo2 => 2,
262            Self::Loop => 3,
263            Self::ControlSequencerStep => 4,
264        }
265    }
266
267    /// Returns the byte that selects this value on the firmware a device inquiry
268    /// reported.
269    ///
270    /// Always `Some` for this table, which every firmware numbers the same way.
271    #[must_use]
272    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
273        Some(self.raw())
274    }
275
276    /// Returns the name the synthesizer's display writes, as of
277    /// [`DEFAULT_FIRMWARE`].
278    #[must_use]
279    pub fn name(self) -> &'static str {
280        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
281    }
282
283    /// Returns the name the synthesizer's display writes on the firmware a
284    /// device inquiry reported.
285    ///
286    /// `None` for a value that firmware does not have. The names live in the
287    /// value table the parameter layer already carries; nothing here holds a
288    /// second copy of them.
289    #[must_use]
290    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
291        let raw = self.raw_for(firmware)?;
292        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
293    }
294}
295
296impl fmt::Display for EnvelopeTrigger {
297    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
298        f.write_str(self.name())
299    }
300}
301
302/// FX Mode.
303///
304/// Every value the synthesizer has a name for. A byte outside the table is not
305/// one of these: [`FxMode::from_raw`] answers `None` for it, and the byte stays
306/// in the program either way.
307#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
308#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
309#[non_exhaustive]
310pub enum FxMode {
311    /// Insert.
312    Insert,
313    /// Send.
314    Send,
315    /// Bypass.
316    Bypass,
317}
318
319impl FxMode {
320    /// The value table this type lists.
321    pub const TABLE: TableId = TableId::FxMode;
322
323    /// Every value, in the order the newest firmware numbers them.
324    pub const ALL: &'static [Self] = &[Self::Insert, Self::Send, Self::Bypass];
325
326    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
327    ///
328    /// `None` when the table does not list the byte.
329    #[must_use]
330    pub const fn from_raw(raw: u8) -> Option<Self> {
331        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
332    }
333
334    /// Returns the value this byte selects on the firmware a device inquiry
335    /// reported.
336    ///
337    /// Every firmware numbers this table the same way, so the version makes no
338    /// difference here; it is taken so that every value type reads alike.
339    #[must_use]
340    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
341        match raw {
342            0 => Some(Self::Insert),
343            1 => Some(Self::Send),
344            2 => Some(Self::Bypass),
345            _ => None,
346        }
347    }
348
349    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
350    #[must_use]
351    pub const fn raw(self) -> u8 {
352        match self {
353            Self::Insert => 0,
354            Self::Send => 1,
355            Self::Bypass => 2,
356        }
357    }
358
359    /// Returns the byte that selects this value on the firmware a device inquiry
360    /// reported.
361    ///
362    /// Always `Some` for this table, which every firmware numbers the same way.
363    #[must_use]
364    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
365        Some(self.raw())
366    }
367
368    /// Returns the name the synthesizer's display writes, as of
369    /// [`DEFAULT_FIRMWARE`].
370    #[must_use]
371    pub fn name(self) -> &'static str {
372        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
373    }
374
375    /// Returns the name the synthesizer's display writes on the firmware a
376    /// device inquiry reported.
377    ///
378    /// `None` for a value that firmware does not have. The names live in the
379    /// value table the parameter layer already carries; nothing here holds a
380    /// second copy of them.
381    #[must_use]
382    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
383        let raw = self.raw_for(firmware)?;
384        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
385    }
386}
387
388impl fmt::Display for FxMode {
389    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
390        f.write_str(self.name())
391    }
392}
393
394/// FX Connection Mode.
395///
396/// Every value the synthesizer has a name for. A byte outside the table is not
397/// one of these: [`FxRouting::from_raw`] answers `None` for it, and the byte stays
398/// in the program either way.
399#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
400#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
401#[non_exhaustive]
402pub enum FxRouting {
403    /// Serial 1-2-3-4.
404    Serial1234,
405    /// Parallel 1/2, serial 3-4.
406    Parallel12Serial34,
407    /// Parallel 1/2, parallel 3/4.
408    Parallel12Parallel34,
409    /// Parallel 1/2/3/4.
410    Parallel1234,
411    /// Parallel 1/2/3, serial 4.
412    Parallel123Serial4,
413    /// Serial 1-2, parallel 3/4.
414    Serial12Parallel34,
415    /// Serial 1, parallel 2/3/4.
416    Serial1Parallel234,
417    /// Parallel (serial 1-2-3)/4.
418    ParallelSerial1234,
419    /// Serial 3-4 feedback 4(1-2).
420    Serial34Feedback412,
421    /// Serial 4 feedback 4(1-2-3).
422    Serial4Feedback4123,
423}
424
425impl FxRouting {
426    /// The value table this type lists.
427    pub const TABLE: TableId = TableId::FxRouting;
428
429    /// Every value, in the order the newest firmware numbers them.
430    pub const ALL: &'static [Self] = &[
431        Self::Serial1234,
432        Self::Parallel12Serial34,
433        Self::Parallel12Parallel34,
434        Self::Parallel1234,
435        Self::Parallel123Serial4,
436        Self::Serial12Parallel34,
437        Self::Serial1Parallel234,
438        Self::ParallelSerial1234,
439        Self::Serial34Feedback412,
440        Self::Serial4Feedback4123,
441    ];
442
443    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
444    ///
445    /// `None` when the table does not list the byte.
446    #[must_use]
447    pub const fn from_raw(raw: u8) -> Option<Self> {
448        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
449    }
450
451    /// Returns the value this byte selects on the firmware a device inquiry
452    /// reported.
453    ///
454    /// Every firmware numbers this table the same way, so the version makes no
455    /// difference here; it is taken so that every value type reads alike.
456    #[must_use]
457    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
458        match raw {
459            0 => Some(Self::Serial1234),
460            1 => Some(Self::Parallel12Serial34),
461            2 => Some(Self::Parallel12Parallel34),
462            3 => Some(Self::Parallel1234),
463            4 => Some(Self::Parallel123Serial4),
464            5 => Some(Self::Serial12Parallel34),
465            6 => Some(Self::Serial1Parallel234),
466            7 => Some(Self::ParallelSerial1234),
467            8 => Some(Self::Serial34Feedback412),
468            9 => Some(Self::Serial4Feedback4123),
469            _ => None,
470        }
471    }
472
473    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
474    #[must_use]
475    pub const fn raw(self) -> u8 {
476        match self {
477            Self::Serial1234 => 0,
478            Self::Parallel12Serial34 => 1,
479            Self::Parallel12Parallel34 => 2,
480            Self::Parallel1234 => 3,
481            Self::Parallel123Serial4 => 4,
482            Self::Serial12Parallel34 => 5,
483            Self::Serial1Parallel234 => 6,
484            Self::ParallelSerial1234 => 7,
485            Self::Serial34Feedback412 => 8,
486            Self::Serial4Feedback4123 => 9,
487        }
488    }
489
490    /// Returns the byte that selects this value on the firmware a device inquiry
491    /// reported.
492    ///
493    /// Always `Some` for this table, which every firmware numbers the same way.
494    #[must_use]
495    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
496        Some(self.raw())
497    }
498
499    /// Returns the name the synthesizer's display writes, as of
500    /// [`DEFAULT_FIRMWARE`].
501    #[must_use]
502    pub fn name(self) -> &'static str {
503        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
504    }
505
506    /// Returns the name the synthesizer's display writes on the firmware a
507    /// device inquiry reported.
508    ///
509    /// `None` for a value that firmware does not have. The names live in the
510    /// value table the parameter layer already carries; nothing here holds a
511    /// second copy of them.
512    #[must_use]
513    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
514        let raw = self.raw_for(firmware)?;
515        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
516    }
517}
518
519impl fmt::Display for FxRouting {
520    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
521        f.write_str(self.name())
522    }
523}
524
525/// FX Type.
526///
527/// Firmware renumbered this table rather than extending it, so a variant is what
528/// the value means and not the byte it travels as. [`FxType::raw_for`] is that
529/// byte on a given firmware, and [`FxType::raw`] is it on the newest.
530///
531/// Every value the synthesizer has a name for. A byte outside the table is not
532/// one of these: [`FxType::from_raw`] answers `None` for it, and the byte stays
533/// in the program either way.
534#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
535#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
536#[non_exhaustive]
537pub enum FxType {
538    /// `TC-DeepVRB`.
539    TcDeepVrb,
540    /// `AmbVerb`.
541    AmbVerb,
542    /// `RoomRev`.
543    RoomRev,
544    /// `VintageRev`.
545    VintageRev,
546    /// `HallRev`.
547    HallRev,
548    /// `ChamberRev`.
549    ChamberRev,
550    /// `PlateRev`.
551    PlateRev,
552    /// `RichPltRev`.
553    RichPltRev,
554    /// `GatedRev`.
555    GatedRev,
556    /// Reverse.
557    Reverse,
558    /// `ChorusVerb`.
559    ChorusVerb,
560    /// `DelayVerb`.
561    DelayVerb,
562    /// `FlangVerb`.
563    FlangVerb,
564    /// `MidasEQ`.
565    MidasEq,
566    /// Enhancer.
567    Enhancer,
568    /// `FairComp`.
569    FairComp,
570    /// `MulBndDist`.
571    MulBndDist,
572    /// `RackAmp`.
573    RackAmp,
574    /// `EdisonEX1`.
575    EdisonEx1,
576    /// Auto Pan.
577    AutoPan,
578    /// `NoiseGate`.
579    NoiseGate,
580    /// Delay.
581    Delay,
582    /// `3TapDelay`.
583    ThreeTapDelay,
584    /// `4TapDelay`.
585    FourTapDelay,
586    /// `T-RayDelay`.
587    TRayDelay,
588    /// `DecimDelay`.
589    DecimDelay,
590    /// `ModDlyRev`.
591    ModDlyRev,
592    /// Chorus.
593    Chorus,
594    /// `Chorus-D`.
595    ChorusD,
596    /// Flanger.
597    Flanger,
598    /// Phaser.
599    Phaser,
600    /// `MoodFilter`.
601    MoodFilter,
602    /// `DualPitch`.
603    DualPitch,
604    /// Vintage Pitch.
605    VintagePitch,
606    /// `RotarySpkr`.
607    RotarySpkr,
608}
609
610impl FxType {
611    /// The value table this type lists.
612    pub const TABLE: TableId = TableId::FxType;
613
614    /// Every value, in the order the newest firmware numbers them.
615    pub const ALL: &'static [Self] = &[
616        Self::TcDeepVrb,
617        Self::AmbVerb,
618        Self::RoomRev,
619        Self::VintageRev,
620        Self::HallRev,
621        Self::ChamberRev,
622        Self::PlateRev,
623        Self::RichPltRev,
624        Self::GatedRev,
625        Self::Reverse,
626        Self::ChorusVerb,
627        Self::DelayVerb,
628        Self::FlangVerb,
629        Self::MidasEq,
630        Self::Enhancer,
631        Self::FairComp,
632        Self::MulBndDist,
633        Self::RackAmp,
634        Self::EdisonEx1,
635        Self::AutoPan,
636        Self::NoiseGate,
637        Self::Delay,
638        Self::ThreeTapDelay,
639        Self::FourTapDelay,
640        Self::TRayDelay,
641        Self::DecimDelay,
642        Self::ModDlyRev,
643        Self::Chorus,
644        Self::ChorusD,
645        Self::Flanger,
646        Self::Phaser,
647        Self::MoodFilter,
648        Self::DualPitch,
649        Self::VintagePitch,
650        Self::RotarySpkr,
651    ];
652
653    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
654    ///
655    /// `None` when the table does not list the byte.
656    #[must_use]
657    pub const fn from_raw(raw: u8) -> Option<Self> {
658        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
659    }
660
661    /// Returns the value this byte selects on the firmware a device inquiry
662    /// reported.
663    ///
664    /// Worth reaching for whenever the byte came from a stored program: nothing
665    /// in a dump says which firmware wrote it, and this table was renumbered.
666    #[must_use]
667    pub const fn from_raw_for(raw: u8, firmware: Version) -> Option<Self> {
668        if firmware.at_least(1, 1) {
669            match raw {
670                0 => Some(Self::TcDeepVrb),
671                1 => Some(Self::AmbVerb),
672                2 => Some(Self::RoomRev),
673                3 => Some(Self::VintageRev),
674                4 => Some(Self::HallRev),
675                5 => Some(Self::ChamberRev),
676                6 => Some(Self::PlateRev),
677                7 => Some(Self::RichPltRev),
678                8 => Some(Self::GatedRev),
679                9 => Some(Self::Reverse),
680                10 => Some(Self::ChorusVerb),
681                11 => Some(Self::DelayVerb),
682                12 => Some(Self::FlangVerb),
683                13 => Some(Self::MidasEq),
684                14 => Some(Self::Enhancer),
685                15 => Some(Self::FairComp),
686                16 => Some(Self::MulBndDist),
687                17 => Some(Self::RackAmp),
688                18 => Some(Self::EdisonEx1),
689                19 => Some(Self::AutoPan),
690                20 => Some(Self::NoiseGate),
691                21 => Some(Self::Delay),
692                22 => Some(Self::ThreeTapDelay),
693                23 => Some(Self::FourTapDelay),
694                24 => Some(Self::TRayDelay),
695                25 => Some(Self::DecimDelay),
696                26 => Some(Self::ModDlyRev),
697                27 => Some(Self::Chorus),
698                28 => Some(Self::ChorusD),
699                29 => Some(Self::Flanger),
700                30 => Some(Self::Phaser),
701                31 => Some(Self::MoodFilter),
702                32 => Some(Self::DualPitch),
703                33 => Some(Self::VintagePitch),
704                34 => Some(Self::RotarySpkr),
705                _ => None,
706            }
707        } else {
708            match raw {
709                0 => Some(Self::TcDeepVrb),
710                1 => Some(Self::AmbVerb),
711                2 => Some(Self::RoomRev),
712                3 => Some(Self::VintageRev),
713                4 => Some(Self::HallRev),
714                5 => Some(Self::ChamberRev),
715                6 => Some(Self::PlateRev),
716                7 => Some(Self::RichPltRev),
717                8 => Some(Self::GatedRev),
718                9 => Some(Self::Reverse),
719                10 => Some(Self::ChorusVerb),
720                11 => Some(Self::DelayVerb),
721                12 => Some(Self::FlangVerb),
722                13 => Some(Self::MidasEq),
723                14 => Some(Self::Enhancer),
724                15 => Some(Self::FairComp),
725                16 => Some(Self::MulBndDist),
726                17 => Some(Self::RackAmp),
727                18 => Some(Self::EdisonEx1),
728                19 => Some(Self::AutoPan),
729                20 => Some(Self::NoiseGate),
730                21 => Some(Self::Delay),
731                22 => Some(Self::ThreeTapDelay),
732                23 => Some(Self::FourTapDelay),
733                24 => Some(Self::TRayDelay),
734                25 => Some(Self::DecimDelay),
735                26 => Some(Self::ModDlyRev),
736                27 => Some(Self::Chorus),
737                28 => Some(Self::ChorusD),
738                29 => Some(Self::Flanger),
739                30 => Some(Self::Phaser),
740                31 => Some(Self::MoodFilter),
741                32 => Some(Self::DualPitch),
742                33 => Some(Self::RotarySpkr),
743                _ => None,
744            }
745        }
746    }
747
748    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
749    #[must_use]
750    pub const fn raw(self) -> u8 {
751        match self {
752            Self::TcDeepVrb => 0,
753            Self::AmbVerb => 1,
754            Self::RoomRev => 2,
755            Self::VintageRev => 3,
756            Self::HallRev => 4,
757            Self::ChamberRev => 5,
758            Self::PlateRev => 6,
759            Self::RichPltRev => 7,
760            Self::GatedRev => 8,
761            Self::Reverse => 9,
762            Self::ChorusVerb => 10,
763            Self::DelayVerb => 11,
764            Self::FlangVerb => 12,
765            Self::MidasEq => 13,
766            Self::Enhancer => 14,
767            Self::FairComp => 15,
768            Self::MulBndDist => 16,
769            Self::RackAmp => 17,
770            Self::EdisonEx1 => 18,
771            Self::AutoPan => 19,
772            Self::NoiseGate => 20,
773            Self::Delay => 21,
774            Self::ThreeTapDelay => 22,
775            Self::FourTapDelay => 23,
776            Self::TRayDelay => 24,
777            Self::DecimDelay => 25,
778            Self::ModDlyRev => 26,
779            Self::Chorus => 27,
780            Self::ChorusD => 28,
781            Self::Flanger => 29,
782            Self::Phaser => 30,
783            Self::MoodFilter => 31,
784            Self::DualPitch => 32,
785            Self::VintagePitch => 33,
786            Self::RotarySpkr => 34,
787        }
788    }
789
790    /// Returns the byte that selects this value on the firmware a device inquiry
791    /// reported.
792    ///
793    /// `None` for a value that firmware does not have.
794    #[must_use]
795    pub const fn raw_for(self, firmware: Version) -> Option<u8> {
796        if firmware.at_least(1, 1) {
797            match self {
798                Self::TcDeepVrb => Some(0),
799                Self::AmbVerb => Some(1),
800                Self::RoomRev => Some(2),
801                Self::VintageRev => Some(3),
802                Self::HallRev => Some(4),
803                Self::ChamberRev => Some(5),
804                Self::PlateRev => Some(6),
805                Self::RichPltRev => Some(7),
806                Self::GatedRev => Some(8),
807                Self::Reverse => Some(9),
808                Self::ChorusVerb => Some(10),
809                Self::DelayVerb => Some(11),
810                Self::FlangVerb => Some(12),
811                Self::MidasEq => Some(13),
812                Self::Enhancer => Some(14),
813                Self::FairComp => Some(15),
814                Self::MulBndDist => Some(16),
815                Self::RackAmp => Some(17),
816                Self::EdisonEx1 => Some(18),
817                Self::AutoPan => Some(19),
818                Self::NoiseGate => Some(20),
819                Self::Delay => Some(21),
820                Self::ThreeTapDelay => Some(22),
821                Self::FourTapDelay => Some(23),
822                Self::TRayDelay => Some(24),
823                Self::DecimDelay => Some(25),
824                Self::ModDlyRev => Some(26),
825                Self::Chorus => Some(27),
826                Self::ChorusD => Some(28),
827                Self::Flanger => Some(29),
828                Self::Phaser => Some(30),
829                Self::MoodFilter => Some(31),
830                Self::DualPitch => Some(32),
831                Self::VintagePitch => Some(33),
832                Self::RotarySpkr => Some(34),
833            }
834        } else {
835            match self {
836                Self::TcDeepVrb => Some(0),
837                Self::AmbVerb => Some(1),
838                Self::RoomRev => Some(2),
839                Self::VintageRev => Some(3),
840                Self::HallRev => Some(4),
841                Self::ChamberRev => Some(5),
842                Self::PlateRev => Some(6),
843                Self::RichPltRev => Some(7),
844                Self::GatedRev => Some(8),
845                Self::Reverse => Some(9),
846                Self::ChorusVerb => Some(10),
847                Self::DelayVerb => Some(11),
848                Self::FlangVerb => Some(12),
849                Self::MidasEq => Some(13),
850                Self::Enhancer => Some(14),
851                Self::FairComp => Some(15),
852                Self::MulBndDist => Some(16),
853                Self::RackAmp => Some(17),
854                Self::EdisonEx1 => Some(18),
855                Self::AutoPan => Some(19),
856                Self::NoiseGate => Some(20),
857                Self::Delay => Some(21),
858                Self::ThreeTapDelay => Some(22),
859                Self::FourTapDelay => Some(23),
860                Self::TRayDelay => Some(24),
861                Self::DecimDelay => Some(25),
862                Self::ModDlyRev => Some(26),
863                Self::Chorus => Some(27),
864                Self::ChorusD => Some(28),
865                Self::Flanger => Some(29),
866                Self::Phaser => Some(30),
867                Self::MoodFilter => Some(31),
868                Self::DualPitch => Some(32),
869                Self::VintagePitch => None,
870                Self::RotarySpkr => Some(33),
871            }
872        }
873    }
874
875    /// Returns the name the synthesizer's display writes, as of
876    /// [`DEFAULT_FIRMWARE`].
877    #[must_use]
878    pub fn name(self) -> &'static str {
879        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
880    }
881
882    /// Returns the name the synthesizer's display writes on the firmware a
883    /// device inquiry reported.
884    ///
885    /// `None` for a value that firmware does not have. The names live in the
886    /// value table the parameter layer already carries; nothing here holds a
887    /// second copy of them.
888    #[must_use]
889    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
890        let raw = self.raw_for(firmware)?;
891        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
892    }
893}
894
895impl fmt::Display for FxType {
896    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
897        f.write_str(self.name())
898    }
899}
900
901/// Envelope Trigger Mode.
902///
903/// Every value the synthesizer has a name for. A byte outside the table is not
904/// one of these: [`KeyAssignMode::from_raw`] answers `None` for it, and the byte stays
905/// in the program either way.
906#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
907#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
908#[non_exhaustive]
909pub enum KeyAssignMode {
910    /// Mono.
911    Mono,
912    /// `Re-Trigger`.
913    ReTrigger,
914    /// Legato.
915    Legato,
916    /// `One-Shot`.
917    OneShot,
918}
919
920impl KeyAssignMode {
921    /// The value table this type lists.
922    pub const TABLE: TableId = TableId::KeyAssignMode;
923
924    /// Every value, in the order the newest firmware numbers them.
925    pub const ALL: &'static [Self] = &[Self::Mono, Self::ReTrigger, Self::Legato, Self::OneShot];
926
927    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
928    ///
929    /// `None` when the table does not list the byte.
930    #[must_use]
931    pub const fn from_raw(raw: u8) -> Option<Self> {
932        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
933    }
934
935    /// Returns the value this byte selects on the firmware a device inquiry
936    /// reported.
937    ///
938    /// Every firmware numbers this table the same way, so the version makes no
939    /// difference here; it is taken so that every value type reads alike.
940    #[must_use]
941    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
942        match raw {
943            0 => Some(Self::Mono),
944            1 => Some(Self::ReTrigger),
945            2 => Some(Self::Legato),
946            3 => Some(Self::OneShot),
947            _ => None,
948        }
949    }
950
951    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
952    #[must_use]
953    pub const fn raw(self) -> u8 {
954        match self {
955            Self::Mono => 0,
956            Self::ReTrigger => 1,
957            Self::Legato => 2,
958            Self::OneShot => 3,
959        }
960    }
961
962    /// Returns the byte that selects this value on the firmware a device inquiry
963    /// reported.
964    ///
965    /// Always `Some` for this table, which every firmware numbers the same way.
966    #[must_use]
967    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
968        Some(self.raw())
969    }
970
971    /// Returns the name the synthesizer's display writes, as of
972    /// [`DEFAULT_FIRMWARE`].
973    #[must_use]
974    pub fn name(self) -> &'static str {
975        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
976    }
977
978    /// Returns the name the synthesizer's display writes on the firmware a
979    /// device inquiry reported.
980    ///
981    /// `None` for a value that firmware does not have. The names live in the
982    /// value table the parameter layer already carries; nothing here holds a
983    /// second copy of them.
984    #[must_use]
985    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
986        let raw = self.raw_for(firmware)?;
987        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
988    }
989}
990
991impl fmt::Display for KeyAssignMode {
992    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
993        f.write_str(self.name())
994    }
995}
996
997/// LFO Shape.
998///
999/// Every value the synthesizer has a name for. A byte outside the table is not
1000/// one of these: [`LfoShape::from_raw`] answers `None` for it, and the byte stays
1001/// in the program either way.
1002#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1003#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1004#[non_exhaustive]
1005pub enum LfoShape {
1006    /// Sine.
1007    Sine,
1008    /// Triangle.
1009    Triangle,
1010    /// Square.
1011    Square,
1012    /// Ramp Up.
1013    RampUp,
1014    /// Ramp Down.
1015    RampDown,
1016    /// Sample & Hold.
1017    SampleAndHold,
1018    /// Sample & Glide.
1019    SampleAndGlide,
1020}
1021
1022impl LfoShape {
1023    /// The value table this type lists.
1024    pub const TABLE: TableId = TableId::LfoShape;
1025
1026    /// Every value, in the order the newest firmware numbers them.
1027    pub const ALL: &'static [Self] = &[
1028        Self::Sine,
1029        Self::Triangle,
1030        Self::Square,
1031        Self::RampUp,
1032        Self::RampDown,
1033        Self::SampleAndHold,
1034        Self::SampleAndGlide,
1035    ];
1036
1037    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
1038    ///
1039    /// `None` when the table does not list the byte.
1040    #[must_use]
1041    pub const fn from_raw(raw: u8) -> Option<Self> {
1042        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
1043    }
1044
1045    /// Returns the value this byte selects on the firmware a device inquiry
1046    /// reported.
1047    ///
1048    /// Every firmware numbers this table the same way, so the version makes no
1049    /// difference here; it is taken so that every value type reads alike.
1050    #[must_use]
1051    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
1052        match raw {
1053            0 => Some(Self::Sine),
1054            1 => Some(Self::Triangle),
1055            2 => Some(Self::Square),
1056            3 => Some(Self::RampUp),
1057            4 => Some(Self::RampDown),
1058            5 => Some(Self::SampleAndHold),
1059            6 => Some(Self::SampleAndGlide),
1060            _ => None,
1061        }
1062    }
1063
1064    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
1065    #[must_use]
1066    pub const fn raw(self) -> u8 {
1067        match self {
1068            Self::Sine => 0,
1069            Self::Triangle => 1,
1070            Self::Square => 2,
1071            Self::RampUp => 3,
1072            Self::RampDown => 4,
1073            Self::SampleAndHold => 5,
1074            Self::SampleAndGlide => 6,
1075        }
1076    }
1077
1078    /// Returns the byte that selects this value on the firmware a device inquiry
1079    /// reported.
1080    ///
1081    /// Always `Some` for this table, which every firmware numbers the same way.
1082    #[must_use]
1083    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
1084        Some(self.raw())
1085    }
1086
1087    /// Returns the name the synthesizer's display writes, as of
1088    /// [`DEFAULT_FIRMWARE`].
1089    #[must_use]
1090    pub fn name(self) -> &'static str {
1091        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
1092    }
1093
1094    /// Returns the name the synthesizer's display writes on the firmware a
1095    /// device inquiry reported.
1096    ///
1097    /// `None` for a value that firmware does not have. The names live in the
1098    /// value table the parameter layer already carries; nothing here holds a
1099    /// second copy of them.
1100    #[must_use]
1101    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
1102        let raw = self.raw_for(firmware)?;
1103        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
1104    }
1105}
1106
1107impl fmt::Display for LfoShape {
1108    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1109        f.write_str(self.name())
1110    }
1111}
1112
1113/// Modulation Matrix Destination.
1114///
1115/// Firmware renumbered this table rather than extending it, so a variant is what
1116/// the value means and not the byte it travels as. [`ModDestination::raw_for`] is that
1117/// byte on a given firmware, and [`ModDestination::raw`] is it on the newest.
1118///
1119/// Every value the synthesizer has a name for. A byte outside the table is not
1120/// one of these: [`ModDestination::from_raw`] answers `None` for it, and the byte stays
1121/// in the program either way.
1122#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1123#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1124#[non_exhaustive]
1125pub enum ModDestination {
1126    /// Off.
1127    Off,
1128    /// LFO1 Rate.
1129    Lfo1Rate,
1130    /// LFO1 Delay.
1131    Lfo1Delay,
1132    /// LFO1 Slew.
1133    Lfo1Slew,
1134    /// LFO1 Shape.
1135    Lfo1Shape,
1136    /// LFO2 Rate.
1137    Lfo2Rate,
1138    /// LFO2 Delay.
1139    Lfo2Delay,
1140    /// LFO2 Slew.
1141    Lfo2Slew,
1142    /// LFO2 Shape.
1143    Lfo2Shape,
1144    /// OSC1+2 Pit.
1145    Osc12Pit,
1146    /// OSC1+2 Fine.
1147    Osc12Fine,
1148    /// OSC1 Pitch.
1149    Osc1Pitch,
1150    /// OSC1 Fine.
1151    Osc1Fine,
1152    /// OSC2 Pitch.
1153    Osc2Pitch,
1154    /// OSC2 Fine.
1155    Osc2Fine,
1156    /// OSC1 PM Dep.
1157    Osc1PmDep,
1158    /// PWM Depth.
1159    PwmDepth,
1160    /// `TMod` Depth.
1161    TmodDepth,
1162    /// OSC2 PM Dep.
1163    Osc2PmDep,
1164    /// Porta Time.
1165    PortaTime,
1166    /// VCF Freq.
1167    VcfFreq,
1168    /// VCF Res.
1169    VcfRes,
1170    /// VCF Env.
1171    VcfEnv,
1172    /// VCF LFO.
1173    VcfLfo,
1174    /// Env Rates.
1175    EnvRates,
1176    /// All Attack.
1177    AllAttack,
1178    /// All Decay.
1179    AllDecay,
1180    /// All Sus.
1181    AllSus,
1182    /// All Rel.
1183    AllRel,
1184    /// Env1 Rates.
1185    Env1Rates,
1186    /// Env2 Rates.
1187    Env2Rates,
1188    /// Env3 Rates.
1189    Env3Rates,
1190    /// `Env1CurveS`.
1191    Env1CurveS,
1192    /// `Env2CurveS`.
1193    Env2CurveS,
1194    /// `Env3CurveS`.
1195    Env3CurveS,
1196    /// Env1 Attack.
1197    Env1Attack,
1198    /// Env1 Decay.
1199    Env1Decay,
1200    /// Env1 Sus.
1201    Env1Sus,
1202    /// Env1 Rel.
1203    Env1Rel,
1204    /// Env1 `AtCur`.
1205    Env1AtCur,
1206    /// Env1 `DcyCur`.
1207    Env1DcyCur,
1208    /// Env1 `SuSCur`.
1209    Env1SuScur,
1210    /// Env1 `RelCur`.
1211    Env1RelCur,
1212    /// Env2 Attack.
1213    Env2Attack,
1214    /// Env2 Decay.
1215    Env2Decay,
1216    /// Env2 Sus.
1217    Env2Sus,
1218    /// Env2 Rel.
1219    Env2Rel,
1220    /// Env2 `AtCur`.
1221    Env2AtCur,
1222    /// Env2 `DcyCur`.
1223    Env2DcyCur,
1224    /// Env2 `SuSCur`.
1225    Env2SuScur,
1226    /// Env2 `RelCur`.
1227    Env2RelCur,
1228    /// Env3 Attack.
1229    Env3Attack,
1230    /// Env3 Decay.
1231    Env3Decay,
1232    /// Env3 Sus.
1233    Env3Sus,
1234    /// Env3 Rel.
1235    Env3Rel,
1236    /// Env3 `AtCur`.
1237    Env3AtCur,
1238    /// Env3 `DcyCur`.
1239    Env3DcyCur,
1240    /// Env3 `SuSCur`.
1241    Env3SuScur,
1242    /// Env3 `RelCur`.
1243    Env3RelCur,
1244    /// VCA All.
1245    VcaAll,
1246    /// VCA Active.
1247    VcaActive,
1248    /// VCA `EnvDep`.
1249    VcaEnvDep,
1250    /// Pan Spread.
1251    PanSpread,
1252    /// VCA Pan.
1253    VcaPan,
1254    /// OSC2 Lvl.
1255    Osc2Lvl,
1256    /// Noise Lvl.
1257    NoiseLvl,
1258    /// HP Freq.
1259    HpFreq,
1260    /// Uni Detune.
1261    UniDetune,
1262    /// OSC Drift.
1263    OscDrift,
1264    /// Param Drift.
1265    ParamDrift,
1266    /// Drift Rate.
1267    DriftRate,
1268    /// Arp Gate.
1269    ArpGate,
1270    /// Seq Slew.
1271    SeqSlew,
1272    /// Mod 1 Dep.
1273    Mod1Dep,
1274    /// Mod 2 Dep.
1275    Mod2Dep,
1276    /// Mod 3 Dep.
1277    Mod3Dep,
1278    /// Mod 4 Dep.
1279    Mod4Dep,
1280    /// Mod 5 Dep.
1281    Mod5Dep,
1282    /// Mod 6 Dep.
1283    Mod6Dep,
1284    /// Mod 7 Dep.
1285    Mod7Dep,
1286    /// Mod 8 Dep.
1287    Mod8Dep,
1288    /// Fx 1 Param 1.
1289    Fx1Param1,
1290    /// Fx 1 Param 2.
1291    Fx1Param2,
1292    /// Fx 1 Param 3.
1293    Fx1Param3,
1294    /// Fx 1 Param 4.
1295    Fx1Param4,
1296    /// Fx 1 Param 5.
1297    Fx1Param5,
1298    /// Fx 1 Param 6.
1299    Fx1Param6,
1300    /// Fx 1 Param 7.
1301    Fx1Param7,
1302    /// Fx 1 Param 8.
1303    Fx1Param8,
1304    /// Fx 1 Param 9.
1305    Fx1Param9,
1306    /// Fx 1 Param 10.
1307    Fx1Param10,
1308    /// Fx 1 Param 11.
1309    Fx1Param11,
1310    /// Fx 1 Param 12.
1311    Fx1Param12,
1312    /// Fx 2 Param 1.
1313    Fx2Param1,
1314    /// Fx 2 Param 2.
1315    Fx2Param2,
1316    /// Fx 2 Param 3.
1317    Fx2Param3,
1318    /// Fx 2 Param 4.
1319    Fx2Param4,
1320    /// Fx 2 Param 5.
1321    Fx2Param5,
1322    /// Fx 2 Param 6.
1323    Fx2Param6,
1324    /// Fx 2 Param 7.
1325    Fx2Param7,
1326    /// Fx 2 Param 8.
1327    Fx2Param8,
1328    /// Fx 2 Param 9.
1329    Fx2Param9,
1330    /// Fx 2 Param 10.
1331    Fx2Param10,
1332    /// Fx 2 Param 11.
1333    Fx2Param11,
1334    /// Fx 2 Param 12.
1335    Fx2Param12,
1336    /// Fx 3 Param 1.
1337    Fx3Param1,
1338    /// Fx 3 Param 2.
1339    Fx3Param2,
1340    /// Fx 3 Param 3.
1341    Fx3Param3,
1342    /// Fx 3 Param 4.
1343    Fx3Param4,
1344    /// Fx 3 Param 5.
1345    Fx3Param5,
1346    /// Fx 3 Param 6.
1347    Fx3Param6,
1348    /// Fx 3 Param 7.
1349    Fx3Param7,
1350    /// Fx 3 Param 8.
1351    Fx3Param8,
1352    /// Fx 3 Param 9.
1353    Fx3Param9,
1354    /// Fx 3 Param 10.
1355    Fx3Param10,
1356    /// Fx 3 Param 11.
1357    Fx3Param11,
1358    /// Fx 3 Param 12.
1359    Fx3Param12,
1360    /// Fx 4 Param 1.
1361    Fx4Param1,
1362    /// Fx 4 Param 2.
1363    Fx4Param2,
1364    /// Fx 4 Param 3.
1365    Fx4Param3,
1366    /// Fx 4 Param 4.
1367    Fx4Param4,
1368    /// Fx 4 Param 5.
1369    Fx4Param5,
1370    /// Fx 4 Param 6.
1371    Fx4Param6,
1372    /// Fx 4 Param 7.
1373    Fx4Param7,
1374    /// Fx 4 Param 8.
1375    Fx4Param8,
1376    /// Fx 4 Param 9.
1377    Fx4Param9,
1378    /// Fx 4 Param 10.
1379    Fx4Param10,
1380    /// Fx 4 Param 11.
1381    Fx4Param11,
1382    /// Fx 4 Param 12.
1383    Fx4Param12,
1384    /// Fx 1 Level.
1385    Fx1Level,
1386    /// Fx 2 Level.
1387    Fx2Level,
1388    /// Fx 3 Level.
1389    Fx3Level,
1390    /// Fx 4 Level.
1391    Fx4Level,
1392}
1393
1394impl ModDestination {
1395    /// The value table this type lists.
1396    pub const TABLE: TableId = TableId::ModDestination;
1397
1398    /// Every value, in the order the newest firmware numbers them.
1399    pub const ALL: &'static [Self] = &[
1400        Self::Off,
1401        Self::Lfo1Rate,
1402        Self::Lfo1Delay,
1403        Self::Lfo1Slew,
1404        Self::Lfo1Shape,
1405        Self::Lfo2Rate,
1406        Self::Lfo2Delay,
1407        Self::Lfo2Slew,
1408        Self::Lfo2Shape,
1409        Self::Osc12Pit,
1410        Self::Osc12Fine,
1411        Self::Osc1Pitch,
1412        Self::Osc1Fine,
1413        Self::Osc2Pitch,
1414        Self::Osc2Fine,
1415        Self::Osc1PmDep,
1416        Self::PwmDepth,
1417        Self::TmodDepth,
1418        Self::Osc2PmDep,
1419        Self::PortaTime,
1420        Self::VcfFreq,
1421        Self::VcfRes,
1422        Self::VcfEnv,
1423        Self::VcfLfo,
1424        Self::EnvRates,
1425        Self::AllAttack,
1426        Self::AllDecay,
1427        Self::AllSus,
1428        Self::AllRel,
1429        Self::Env1Rates,
1430        Self::Env2Rates,
1431        Self::Env3Rates,
1432        Self::Env1CurveS,
1433        Self::Env2CurveS,
1434        Self::Env3CurveS,
1435        Self::Env1Attack,
1436        Self::Env1Decay,
1437        Self::Env1Sus,
1438        Self::Env1Rel,
1439        Self::Env1AtCur,
1440        Self::Env1DcyCur,
1441        Self::Env1SuScur,
1442        Self::Env1RelCur,
1443        Self::Env2Attack,
1444        Self::Env2Decay,
1445        Self::Env2Sus,
1446        Self::Env2Rel,
1447        Self::Env2AtCur,
1448        Self::Env2DcyCur,
1449        Self::Env2SuScur,
1450        Self::Env2RelCur,
1451        Self::Env3Attack,
1452        Self::Env3Decay,
1453        Self::Env3Sus,
1454        Self::Env3Rel,
1455        Self::Env3AtCur,
1456        Self::Env3DcyCur,
1457        Self::Env3SuScur,
1458        Self::Env3RelCur,
1459        Self::VcaAll,
1460        Self::VcaActive,
1461        Self::VcaEnvDep,
1462        Self::PanSpread,
1463        Self::VcaPan,
1464        Self::Osc2Lvl,
1465        Self::NoiseLvl,
1466        Self::HpFreq,
1467        Self::UniDetune,
1468        Self::OscDrift,
1469        Self::ParamDrift,
1470        Self::DriftRate,
1471        Self::ArpGate,
1472        Self::SeqSlew,
1473        Self::Mod1Dep,
1474        Self::Mod2Dep,
1475        Self::Mod3Dep,
1476        Self::Mod4Dep,
1477        Self::Mod5Dep,
1478        Self::Mod6Dep,
1479        Self::Mod7Dep,
1480        Self::Mod8Dep,
1481        Self::Fx1Param1,
1482        Self::Fx1Param2,
1483        Self::Fx1Param3,
1484        Self::Fx1Param4,
1485        Self::Fx1Param5,
1486        Self::Fx1Param6,
1487        Self::Fx1Param7,
1488        Self::Fx1Param8,
1489        Self::Fx1Param9,
1490        Self::Fx1Param10,
1491        Self::Fx1Param11,
1492        Self::Fx1Param12,
1493        Self::Fx2Param1,
1494        Self::Fx2Param2,
1495        Self::Fx2Param3,
1496        Self::Fx2Param4,
1497        Self::Fx2Param5,
1498        Self::Fx2Param6,
1499        Self::Fx2Param7,
1500        Self::Fx2Param8,
1501        Self::Fx2Param9,
1502        Self::Fx2Param10,
1503        Self::Fx2Param11,
1504        Self::Fx2Param12,
1505        Self::Fx3Param1,
1506        Self::Fx3Param2,
1507        Self::Fx3Param3,
1508        Self::Fx3Param4,
1509        Self::Fx3Param5,
1510        Self::Fx3Param6,
1511        Self::Fx3Param7,
1512        Self::Fx3Param8,
1513        Self::Fx3Param9,
1514        Self::Fx3Param10,
1515        Self::Fx3Param11,
1516        Self::Fx3Param12,
1517        Self::Fx4Param1,
1518        Self::Fx4Param2,
1519        Self::Fx4Param3,
1520        Self::Fx4Param4,
1521        Self::Fx4Param5,
1522        Self::Fx4Param6,
1523        Self::Fx4Param7,
1524        Self::Fx4Param8,
1525        Self::Fx4Param9,
1526        Self::Fx4Param10,
1527        Self::Fx4Param11,
1528        Self::Fx4Param12,
1529        Self::Fx1Level,
1530        Self::Fx2Level,
1531        Self::Fx3Level,
1532        Self::Fx4Level,
1533    ];
1534
1535    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
1536    ///
1537    /// `None` when the table does not list the byte.
1538    #[must_use]
1539    pub const fn from_raw(raw: u8) -> Option<Self> {
1540        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
1541    }
1542
1543    /// Returns the value this byte selects on the firmware a device inquiry
1544    /// reported.
1545    ///
1546    /// Worth reaching for whenever the byte came from a stored program: nothing
1547    /// in a dump says which firmware wrote it, and this table was renumbered.
1548    #[must_use]
1549    pub const fn from_raw_for(raw: u8, firmware: Version) -> Option<Self> {
1550        if firmware.at_least(1, 1) {
1551            match raw {
1552                0 => Some(Self::Off),
1553                1 => Some(Self::Lfo1Rate),
1554                2 => Some(Self::Lfo1Delay),
1555                3 => Some(Self::Lfo1Slew),
1556                4 => Some(Self::Lfo1Shape),
1557                5 => Some(Self::Lfo2Rate),
1558                6 => Some(Self::Lfo2Delay),
1559                7 => Some(Self::Lfo2Slew),
1560                8 => Some(Self::Lfo2Shape),
1561                9 => Some(Self::Osc12Pit),
1562                10 => Some(Self::Osc12Fine),
1563                11 => Some(Self::Osc1Pitch),
1564                12 => Some(Self::Osc1Fine),
1565                13 => Some(Self::Osc2Pitch),
1566                14 => Some(Self::Osc2Fine),
1567                15 => Some(Self::Osc1PmDep),
1568                16 => Some(Self::PwmDepth),
1569                17 => Some(Self::TmodDepth),
1570                18 => Some(Self::Osc2PmDep),
1571                19 => Some(Self::PortaTime),
1572                20 => Some(Self::VcfFreq),
1573                21 => Some(Self::VcfRes),
1574                22 => Some(Self::VcfEnv),
1575                23 => Some(Self::VcfLfo),
1576                24 => Some(Self::EnvRates),
1577                25 => Some(Self::AllAttack),
1578                26 => Some(Self::AllDecay),
1579                27 => Some(Self::AllSus),
1580                28 => Some(Self::AllRel),
1581                29 => Some(Self::Env1Rates),
1582                30 => Some(Self::Env2Rates),
1583                31 => Some(Self::Env3Rates),
1584                32 => Some(Self::Env1CurveS),
1585                33 => Some(Self::Env2CurveS),
1586                34 => Some(Self::Env3CurveS),
1587                35 => Some(Self::Env1Attack),
1588                36 => Some(Self::Env1Decay),
1589                37 => Some(Self::Env1Sus),
1590                38 => Some(Self::Env1Rel),
1591                39 => Some(Self::Env1AtCur),
1592                40 => Some(Self::Env1DcyCur),
1593                41 => Some(Self::Env1SuScur),
1594                42 => Some(Self::Env1RelCur),
1595                43 => Some(Self::Env2Attack),
1596                44 => Some(Self::Env2Decay),
1597                45 => Some(Self::Env2Sus),
1598                46 => Some(Self::Env2Rel),
1599                47 => Some(Self::Env2AtCur),
1600                48 => Some(Self::Env2DcyCur),
1601                49 => Some(Self::Env2SuScur),
1602                50 => Some(Self::Env2RelCur),
1603                51 => Some(Self::Env3Attack),
1604                52 => Some(Self::Env3Decay),
1605                53 => Some(Self::Env3Sus),
1606                54 => Some(Self::Env3Rel),
1607                55 => Some(Self::Env3AtCur),
1608                56 => Some(Self::Env3DcyCur),
1609                57 => Some(Self::Env3SuScur),
1610                58 => Some(Self::Env3RelCur),
1611                59 => Some(Self::VcaAll),
1612                60 => Some(Self::VcaActive),
1613                61 => Some(Self::VcaEnvDep),
1614                62 => Some(Self::PanSpread),
1615                63 => Some(Self::VcaPan),
1616                64 => Some(Self::Osc2Lvl),
1617                65 => Some(Self::NoiseLvl),
1618                66 => Some(Self::HpFreq),
1619                67 => Some(Self::UniDetune),
1620                68 => Some(Self::OscDrift),
1621                69 => Some(Self::ParamDrift),
1622                70 => Some(Self::DriftRate),
1623                71 => Some(Self::ArpGate),
1624                72 => Some(Self::SeqSlew),
1625                73 => Some(Self::Mod1Dep),
1626                74 => Some(Self::Mod2Dep),
1627                75 => Some(Self::Mod3Dep),
1628                76 => Some(Self::Mod4Dep),
1629                77 => Some(Self::Mod5Dep),
1630                78 => Some(Self::Mod6Dep),
1631                79 => Some(Self::Mod7Dep),
1632                80 => Some(Self::Mod8Dep),
1633                81 => Some(Self::Fx1Param1),
1634                82 => Some(Self::Fx1Param2),
1635                83 => Some(Self::Fx1Param3),
1636                84 => Some(Self::Fx1Param4),
1637                85 => Some(Self::Fx1Param5),
1638                86 => Some(Self::Fx1Param6),
1639                87 => Some(Self::Fx1Param7),
1640                88 => Some(Self::Fx1Param8),
1641                89 => Some(Self::Fx1Param9),
1642                90 => Some(Self::Fx1Param10),
1643                91 => Some(Self::Fx1Param11),
1644                92 => Some(Self::Fx1Param12),
1645                93 => Some(Self::Fx2Param1),
1646                94 => Some(Self::Fx2Param2),
1647                95 => Some(Self::Fx2Param3),
1648                96 => Some(Self::Fx2Param4),
1649                97 => Some(Self::Fx2Param5),
1650                98 => Some(Self::Fx2Param6),
1651                99 => Some(Self::Fx2Param7),
1652                100 => Some(Self::Fx2Param8),
1653                101 => Some(Self::Fx2Param9),
1654                102 => Some(Self::Fx2Param10),
1655                103 => Some(Self::Fx2Param11),
1656                104 => Some(Self::Fx2Param12),
1657                105 => Some(Self::Fx3Param1),
1658                106 => Some(Self::Fx3Param2),
1659                107 => Some(Self::Fx3Param3),
1660                108 => Some(Self::Fx3Param4),
1661                109 => Some(Self::Fx3Param5),
1662                110 => Some(Self::Fx3Param6),
1663                111 => Some(Self::Fx3Param7),
1664                112 => Some(Self::Fx3Param8),
1665                113 => Some(Self::Fx3Param9),
1666                114 => Some(Self::Fx3Param10),
1667                115 => Some(Self::Fx3Param11),
1668                116 => Some(Self::Fx3Param12),
1669                117 => Some(Self::Fx4Param1),
1670                118 => Some(Self::Fx4Param2),
1671                119 => Some(Self::Fx4Param3),
1672                120 => Some(Self::Fx4Param4),
1673                121 => Some(Self::Fx4Param5),
1674                122 => Some(Self::Fx4Param6),
1675                123 => Some(Self::Fx4Param7),
1676                124 => Some(Self::Fx4Param8),
1677                125 => Some(Self::Fx4Param9),
1678                126 => Some(Self::Fx4Param10),
1679                127 => Some(Self::Fx4Param11),
1680                128 => Some(Self::Fx4Param12),
1681                129 => Some(Self::Fx1Level),
1682                130 => Some(Self::Fx2Level),
1683                131 => Some(Self::Fx3Level),
1684                132 => Some(Self::Fx4Level),
1685                _ => None,
1686            }
1687        } else {
1688            match raw {
1689                0 => Some(Self::Off),
1690                1 => Some(Self::Lfo1Rate),
1691                2 => Some(Self::Lfo1Delay),
1692                3 => Some(Self::Lfo1Slew),
1693                4 => Some(Self::Lfo1Shape),
1694                5 => Some(Self::Lfo2Rate),
1695                6 => Some(Self::Lfo2Delay),
1696                7 => Some(Self::Lfo2Slew),
1697                8 => Some(Self::Lfo2Shape),
1698                9 => Some(Self::Osc12Pit),
1699                10 => Some(Self::Osc1Pitch),
1700                11 => Some(Self::Osc2Pitch),
1701                12 => Some(Self::Osc1PmDep),
1702                13 => Some(Self::PwmDepth),
1703                14 => Some(Self::TmodDepth),
1704                15 => Some(Self::Osc2PmDep),
1705                16 => Some(Self::PortaTime),
1706                17 => Some(Self::VcfFreq),
1707                18 => Some(Self::VcfRes),
1708                19 => Some(Self::VcfEnv),
1709                20 => Some(Self::VcfLfo),
1710                21 => Some(Self::EnvRates),
1711                22 => Some(Self::AllAttack),
1712                23 => Some(Self::AllDecay),
1713                24 => Some(Self::AllSus),
1714                25 => Some(Self::AllRel),
1715                26 => Some(Self::Env1Rates),
1716                27 => Some(Self::Env2Rates),
1717                28 => Some(Self::Env3Rates),
1718                29 => Some(Self::Env1CurveS),
1719                30 => Some(Self::Env2CurveS),
1720                31 => Some(Self::Env3CurveS),
1721                32 => Some(Self::Env1Attack),
1722                33 => Some(Self::Env1Decay),
1723                34 => Some(Self::Env1Sus),
1724                35 => Some(Self::Env1Rel),
1725                36 => Some(Self::Env1AtCur),
1726                37 => Some(Self::Env1DcyCur),
1727                38 => Some(Self::Env1SuScur),
1728                39 => Some(Self::Env1RelCur),
1729                40 => Some(Self::Env2Attack),
1730                41 => Some(Self::Env2Decay),
1731                42 => Some(Self::Env2Sus),
1732                43 => Some(Self::Env2Rel),
1733                44 => Some(Self::Env2AtCur),
1734                45 => Some(Self::Env2DcyCur),
1735                46 => Some(Self::Env2SuScur),
1736                47 => Some(Self::Env2RelCur),
1737                48 => Some(Self::Env3Attack),
1738                49 => Some(Self::Env3Decay),
1739                50 => Some(Self::Env3Sus),
1740                51 => Some(Self::Env3Rel),
1741                52 => Some(Self::Env3AtCur),
1742                53 => Some(Self::Env3DcyCur),
1743                54 => Some(Self::Env3SuScur),
1744                55 => Some(Self::Env3RelCur),
1745                56 => Some(Self::VcaAll),
1746                57 => Some(Self::VcaActive),
1747                58 => Some(Self::VcaEnvDep),
1748                59 => Some(Self::PanSpread),
1749                60 => Some(Self::VcaPan),
1750                61 => Some(Self::Osc2Lvl),
1751                62 => Some(Self::NoiseLvl),
1752                63 => Some(Self::HpFreq),
1753                64 => Some(Self::UniDetune),
1754                65 => Some(Self::OscDrift),
1755                66 => Some(Self::ParamDrift),
1756                67 => Some(Self::DriftRate),
1757                68 => Some(Self::ArpGate),
1758                69 => Some(Self::SeqSlew),
1759                70 => Some(Self::Mod1Dep),
1760                71 => Some(Self::Mod2Dep),
1761                72 => Some(Self::Mod3Dep),
1762                73 => Some(Self::Mod4Dep),
1763                74 => Some(Self::Mod5Dep),
1764                75 => Some(Self::Mod6Dep),
1765                76 => Some(Self::Mod7Dep),
1766                77 => Some(Self::Mod8Dep),
1767                78 => Some(Self::Fx1Param1),
1768                79 => Some(Self::Fx1Param2),
1769                80 => Some(Self::Fx1Param3),
1770                81 => Some(Self::Fx1Param4),
1771                82 => Some(Self::Fx1Param5),
1772                83 => Some(Self::Fx1Param6),
1773                84 => Some(Self::Fx1Param7),
1774                85 => Some(Self::Fx1Param8),
1775                86 => Some(Self::Fx1Param9),
1776                87 => Some(Self::Fx1Param10),
1777                88 => Some(Self::Fx1Param11),
1778                89 => Some(Self::Fx1Param12),
1779                90 => Some(Self::Fx2Param1),
1780                91 => Some(Self::Fx2Param2),
1781                92 => Some(Self::Fx2Param3),
1782                93 => Some(Self::Fx2Param4),
1783                94 => Some(Self::Fx2Param5),
1784                95 => Some(Self::Fx2Param6),
1785                96 => Some(Self::Fx2Param7),
1786                97 => Some(Self::Fx2Param8),
1787                98 => Some(Self::Fx2Param9),
1788                99 => Some(Self::Fx2Param10),
1789                100 => Some(Self::Fx2Param11),
1790                101 => Some(Self::Fx2Param12),
1791                102 => Some(Self::Fx3Param1),
1792                103 => Some(Self::Fx3Param2),
1793                104 => Some(Self::Fx3Param3),
1794                105 => Some(Self::Fx3Param4),
1795                106 => Some(Self::Fx3Param5),
1796                107 => Some(Self::Fx3Param6),
1797                108 => Some(Self::Fx3Param7),
1798                109 => Some(Self::Fx3Param8),
1799                110 => Some(Self::Fx3Param9),
1800                111 => Some(Self::Fx3Param10),
1801                112 => Some(Self::Fx3Param11),
1802                113 => Some(Self::Fx3Param12),
1803                114 => Some(Self::Fx4Param1),
1804                115 => Some(Self::Fx4Param2),
1805                116 => Some(Self::Fx4Param3),
1806                117 => Some(Self::Fx4Param4),
1807                118 => Some(Self::Fx4Param5),
1808                119 => Some(Self::Fx4Param6),
1809                120 => Some(Self::Fx4Param7),
1810                121 => Some(Self::Fx4Param8),
1811                122 => Some(Self::Fx4Param9),
1812                123 => Some(Self::Fx4Param10),
1813                124 => Some(Self::Fx4Param11),
1814                125 => Some(Self::Fx4Param12),
1815                126 => Some(Self::Fx1Level),
1816                127 => Some(Self::Fx2Level),
1817                128 => Some(Self::Fx3Level),
1818                129 => Some(Self::Fx4Level),
1819                _ => None,
1820            }
1821        }
1822    }
1823
1824    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
1825    #[must_use]
1826    pub const fn raw(self) -> u8 {
1827        match self {
1828            Self::Off => 0,
1829            Self::Lfo1Rate => 1,
1830            Self::Lfo1Delay => 2,
1831            Self::Lfo1Slew => 3,
1832            Self::Lfo1Shape => 4,
1833            Self::Lfo2Rate => 5,
1834            Self::Lfo2Delay => 6,
1835            Self::Lfo2Slew => 7,
1836            Self::Lfo2Shape => 8,
1837            Self::Osc12Pit => 9,
1838            Self::Osc12Fine => 10,
1839            Self::Osc1Pitch => 11,
1840            Self::Osc1Fine => 12,
1841            Self::Osc2Pitch => 13,
1842            Self::Osc2Fine => 14,
1843            Self::Osc1PmDep => 15,
1844            Self::PwmDepth => 16,
1845            Self::TmodDepth => 17,
1846            Self::Osc2PmDep => 18,
1847            Self::PortaTime => 19,
1848            Self::VcfFreq => 20,
1849            Self::VcfRes => 21,
1850            Self::VcfEnv => 22,
1851            Self::VcfLfo => 23,
1852            Self::EnvRates => 24,
1853            Self::AllAttack => 25,
1854            Self::AllDecay => 26,
1855            Self::AllSus => 27,
1856            Self::AllRel => 28,
1857            Self::Env1Rates => 29,
1858            Self::Env2Rates => 30,
1859            Self::Env3Rates => 31,
1860            Self::Env1CurveS => 32,
1861            Self::Env2CurveS => 33,
1862            Self::Env3CurveS => 34,
1863            Self::Env1Attack => 35,
1864            Self::Env1Decay => 36,
1865            Self::Env1Sus => 37,
1866            Self::Env1Rel => 38,
1867            Self::Env1AtCur => 39,
1868            Self::Env1DcyCur => 40,
1869            Self::Env1SuScur => 41,
1870            Self::Env1RelCur => 42,
1871            Self::Env2Attack => 43,
1872            Self::Env2Decay => 44,
1873            Self::Env2Sus => 45,
1874            Self::Env2Rel => 46,
1875            Self::Env2AtCur => 47,
1876            Self::Env2DcyCur => 48,
1877            Self::Env2SuScur => 49,
1878            Self::Env2RelCur => 50,
1879            Self::Env3Attack => 51,
1880            Self::Env3Decay => 52,
1881            Self::Env3Sus => 53,
1882            Self::Env3Rel => 54,
1883            Self::Env3AtCur => 55,
1884            Self::Env3DcyCur => 56,
1885            Self::Env3SuScur => 57,
1886            Self::Env3RelCur => 58,
1887            Self::VcaAll => 59,
1888            Self::VcaActive => 60,
1889            Self::VcaEnvDep => 61,
1890            Self::PanSpread => 62,
1891            Self::VcaPan => 63,
1892            Self::Osc2Lvl => 64,
1893            Self::NoiseLvl => 65,
1894            Self::HpFreq => 66,
1895            Self::UniDetune => 67,
1896            Self::OscDrift => 68,
1897            Self::ParamDrift => 69,
1898            Self::DriftRate => 70,
1899            Self::ArpGate => 71,
1900            Self::SeqSlew => 72,
1901            Self::Mod1Dep => 73,
1902            Self::Mod2Dep => 74,
1903            Self::Mod3Dep => 75,
1904            Self::Mod4Dep => 76,
1905            Self::Mod5Dep => 77,
1906            Self::Mod6Dep => 78,
1907            Self::Mod7Dep => 79,
1908            Self::Mod8Dep => 80,
1909            Self::Fx1Param1 => 81,
1910            Self::Fx1Param2 => 82,
1911            Self::Fx1Param3 => 83,
1912            Self::Fx1Param4 => 84,
1913            Self::Fx1Param5 => 85,
1914            Self::Fx1Param6 => 86,
1915            Self::Fx1Param7 => 87,
1916            Self::Fx1Param8 => 88,
1917            Self::Fx1Param9 => 89,
1918            Self::Fx1Param10 => 90,
1919            Self::Fx1Param11 => 91,
1920            Self::Fx1Param12 => 92,
1921            Self::Fx2Param1 => 93,
1922            Self::Fx2Param2 => 94,
1923            Self::Fx2Param3 => 95,
1924            Self::Fx2Param4 => 96,
1925            Self::Fx2Param5 => 97,
1926            Self::Fx2Param6 => 98,
1927            Self::Fx2Param7 => 99,
1928            Self::Fx2Param8 => 100,
1929            Self::Fx2Param9 => 101,
1930            Self::Fx2Param10 => 102,
1931            Self::Fx2Param11 => 103,
1932            Self::Fx2Param12 => 104,
1933            Self::Fx3Param1 => 105,
1934            Self::Fx3Param2 => 106,
1935            Self::Fx3Param3 => 107,
1936            Self::Fx3Param4 => 108,
1937            Self::Fx3Param5 => 109,
1938            Self::Fx3Param6 => 110,
1939            Self::Fx3Param7 => 111,
1940            Self::Fx3Param8 => 112,
1941            Self::Fx3Param9 => 113,
1942            Self::Fx3Param10 => 114,
1943            Self::Fx3Param11 => 115,
1944            Self::Fx3Param12 => 116,
1945            Self::Fx4Param1 => 117,
1946            Self::Fx4Param2 => 118,
1947            Self::Fx4Param3 => 119,
1948            Self::Fx4Param4 => 120,
1949            Self::Fx4Param5 => 121,
1950            Self::Fx4Param6 => 122,
1951            Self::Fx4Param7 => 123,
1952            Self::Fx4Param8 => 124,
1953            Self::Fx4Param9 => 125,
1954            Self::Fx4Param10 => 126,
1955            Self::Fx4Param11 => 127,
1956            Self::Fx4Param12 => 128,
1957            Self::Fx1Level => 129,
1958            Self::Fx2Level => 130,
1959            Self::Fx3Level => 131,
1960            Self::Fx4Level => 132,
1961        }
1962    }
1963
1964    /// Returns the byte that selects this value on the firmware a device inquiry
1965    /// reported.
1966    ///
1967    /// `None` for a value that firmware does not have.
1968    #[must_use]
1969    pub const fn raw_for(self, firmware: Version) -> Option<u8> {
1970        if firmware.at_least(1, 1) {
1971            match self {
1972                Self::Off => Some(0),
1973                Self::Lfo1Rate => Some(1),
1974                Self::Lfo1Delay => Some(2),
1975                Self::Lfo1Slew => Some(3),
1976                Self::Lfo1Shape => Some(4),
1977                Self::Lfo2Rate => Some(5),
1978                Self::Lfo2Delay => Some(6),
1979                Self::Lfo2Slew => Some(7),
1980                Self::Lfo2Shape => Some(8),
1981                Self::Osc12Pit => Some(9),
1982                Self::Osc12Fine => Some(10),
1983                Self::Osc1Pitch => Some(11),
1984                Self::Osc1Fine => Some(12),
1985                Self::Osc2Pitch => Some(13),
1986                Self::Osc2Fine => Some(14),
1987                Self::Osc1PmDep => Some(15),
1988                Self::PwmDepth => Some(16),
1989                Self::TmodDepth => Some(17),
1990                Self::Osc2PmDep => Some(18),
1991                Self::PortaTime => Some(19),
1992                Self::VcfFreq => Some(20),
1993                Self::VcfRes => Some(21),
1994                Self::VcfEnv => Some(22),
1995                Self::VcfLfo => Some(23),
1996                Self::EnvRates => Some(24),
1997                Self::AllAttack => Some(25),
1998                Self::AllDecay => Some(26),
1999                Self::AllSus => Some(27),
2000                Self::AllRel => Some(28),
2001                Self::Env1Rates => Some(29),
2002                Self::Env2Rates => Some(30),
2003                Self::Env3Rates => Some(31),
2004                Self::Env1CurveS => Some(32),
2005                Self::Env2CurveS => Some(33),
2006                Self::Env3CurveS => Some(34),
2007                Self::Env1Attack => Some(35),
2008                Self::Env1Decay => Some(36),
2009                Self::Env1Sus => Some(37),
2010                Self::Env1Rel => Some(38),
2011                Self::Env1AtCur => Some(39),
2012                Self::Env1DcyCur => Some(40),
2013                Self::Env1SuScur => Some(41),
2014                Self::Env1RelCur => Some(42),
2015                Self::Env2Attack => Some(43),
2016                Self::Env2Decay => Some(44),
2017                Self::Env2Sus => Some(45),
2018                Self::Env2Rel => Some(46),
2019                Self::Env2AtCur => Some(47),
2020                Self::Env2DcyCur => Some(48),
2021                Self::Env2SuScur => Some(49),
2022                Self::Env2RelCur => Some(50),
2023                Self::Env3Attack => Some(51),
2024                Self::Env3Decay => Some(52),
2025                Self::Env3Sus => Some(53),
2026                Self::Env3Rel => Some(54),
2027                Self::Env3AtCur => Some(55),
2028                Self::Env3DcyCur => Some(56),
2029                Self::Env3SuScur => Some(57),
2030                Self::Env3RelCur => Some(58),
2031                Self::VcaAll => Some(59),
2032                Self::VcaActive => Some(60),
2033                Self::VcaEnvDep => Some(61),
2034                Self::PanSpread => Some(62),
2035                Self::VcaPan => Some(63),
2036                Self::Osc2Lvl => Some(64),
2037                Self::NoiseLvl => Some(65),
2038                Self::HpFreq => Some(66),
2039                Self::UniDetune => Some(67),
2040                Self::OscDrift => Some(68),
2041                Self::ParamDrift => Some(69),
2042                Self::DriftRate => Some(70),
2043                Self::ArpGate => Some(71),
2044                Self::SeqSlew => Some(72),
2045                Self::Mod1Dep => Some(73),
2046                Self::Mod2Dep => Some(74),
2047                Self::Mod3Dep => Some(75),
2048                Self::Mod4Dep => Some(76),
2049                Self::Mod5Dep => Some(77),
2050                Self::Mod6Dep => Some(78),
2051                Self::Mod7Dep => Some(79),
2052                Self::Mod8Dep => Some(80),
2053                Self::Fx1Param1 => Some(81),
2054                Self::Fx1Param2 => Some(82),
2055                Self::Fx1Param3 => Some(83),
2056                Self::Fx1Param4 => Some(84),
2057                Self::Fx1Param5 => Some(85),
2058                Self::Fx1Param6 => Some(86),
2059                Self::Fx1Param7 => Some(87),
2060                Self::Fx1Param8 => Some(88),
2061                Self::Fx1Param9 => Some(89),
2062                Self::Fx1Param10 => Some(90),
2063                Self::Fx1Param11 => Some(91),
2064                Self::Fx1Param12 => Some(92),
2065                Self::Fx2Param1 => Some(93),
2066                Self::Fx2Param2 => Some(94),
2067                Self::Fx2Param3 => Some(95),
2068                Self::Fx2Param4 => Some(96),
2069                Self::Fx2Param5 => Some(97),
2070                Self::Fx2Param6 => Some(98),
2071                Self::Fx2Param7 => Some(99),
2072                Self::Fx2Param8 => Some(100),
2073                Self::Fx2Param9 => Some(101),
2074                Self::Fx2Param10 => Some(102),
2075                Self::Fx2Param11 => Some(103),
2076                Self::Fx2Param12 => Some(104),
2077                Self::Fx3Param1 => Some(105),
2078                Self::Fx3Param2 => Some(106),
2079                Self::Fx3Param3 => Some(107),
2080                Self::Fx3Param4 => Some(108),
2081                Self::Fx3Param5 => Some(109),
2082                Self::Fx3Param6 => Some(110),
2083                Self::Fx3Param7 => Some(111),
2084                Self::Fx3Param8 => Some(112),
2085                Self::Fx3Param9 => Some(113),
2086                Self::Fx3Param10 => Some(114),
2087                Self::Fx3Param11 => Some(115),
2088                Self::Fx3Param12 => Some(116),
2089                Self::Fx4Param1 => Some(117),
2090                Self::Fx4Param2 => Some(118),
2091                Self::Fx4Param3 => Some(119),
2092                Self::Fx4Param4 => Some(120),
2093                Self::Fx4Param5 => Some(121),
2094                Self::Fx4Param6 => Some(122),
2095                Self::Fx4Param7 => Some(123),
2096                Self::Fx4Param8 => Some(124),
2097                Self::Fx4Param9 => Some(125),
2098                Self::Fx4Param10 => Some(126),
2099                Self::Fx4Param11 => Some(127),
2100                Self::Fx4Param12 => Some(128),
2101                Self::Fx1Level => Some(129),
2102                Self::Fx2Level => Some(130),
2103                Self::Fx3Level => Some(131),
2104                Self::Fx4Level => Some(132),
2105            }
2106        } else {
2107            match self {
2108                Self::Off => Some(0),
2109                Self::Lfo1Rate => Some(1),
2110                Self::Lfo1Delay => Some(2),
2111                Self::Lfo1Slew => Some(3),
2112                Self::Lfo1Shape => Some(4),
2113                Self::Lfo2Rate => Some(5),
2114                Self::Lfo2Delay => Some(6),
2115                Self::Lfo2Slew => Some(7),
2116                Self::Lfo2Shape => Some(8),
2117                Self::Osc12Pit => Some(9),
2118                Self::Osc12Fine => None,
2119                Self::Osc1Pitch => Some(10),
2120                Self::Osc1Fine => None,
2121                Self::Osc2Pitch => Some(11),
2122                Self::Osc2Fine => None,
2123                Self::Osc1PmDep => Some(12),
2124                Self::PwmDepth => Some(13),
2125                Self::TmodDepth => Some(14),
2126                Self::Osc2PmDep => Some(15),
2127                Self::PortaTime => Some(16),
2128                Self::VcfFreq => Some(17),
2129                Self::VcfRes => Some(18),
2130                Self::VcfEnv => Some(19),
2131                Self::VcfLfo => Some(20),
2132                Self::EnvRates => Some(21),
2133                Self::AllAttack => Some(22),
2134                Self::AllDecay => Some(23),
2135                Self::AllSus => Some(24),
2136                Self::AllRel => Some(25),
2137                Self::Env1Rates => Some(26),
2138                Self::Env2Rates => Some(27),
2139                Self::Env3Rates => Some(28),
2140                Self::Env1CurveS => Some(29),
2141                Self::Env2CurveS => Some(30),
2142                Self::Env3CurveS => Some(31),
2143                Self::Env1Attack => Some(32),
2144                Self::Env1Decay => Some(33),
2145                Self::Env1Sus => Some(34),
2146                Self::Env1Rel => Some(35),
2147                Self::Env1AtCur => Some(36),
2148                Self::Env1DcyCur => Some(37),
2149                Self::Env1SuScur => Some(38),
2150                Self::Env1RelCur => Some(39),
2151                Self::Env2Attack => Some(40),
2152                Self::Env2Decay => Some(41),
2153                Self::Env2Sus => Some(42),
2154                Self::Env2Rel => Some(43),
2155                Self::Env2AtCur => Some(44),
2156                Self::Env2DcyCur => Some(45),
2157                Self::Env2SuScur => Some(46),
2158                Self::Env2RelCur => Some(47),
2159                Self::Env3Attack => Some(48),
2160                Self::Env3Decay => Some(49),
2161                Self::Env3Sus => Some(50),
2162                Self::Env3Rel => Some(51),
2163                Self::Env3AtCur => Some(52),
2164                Self::Env3DcyCur => Some(53),
2165                Self::Env3SuScur => Some(54),
2166                Self::Env3RelCur => Some(55),
2167                Self::VcaAll => Some(56),
2168                Self::VcaActive => Some(57),
2169                Self::VcaEnvDep => Some(58),
2170                Self::PanSpread => Some(59),
2171                Self::VcaPan => Some(60),
2172                Self::Osc2Lvl => Some(61),
2173                Self::NoiseLvl => Some(62),
2174                Self::HpFreq => Some(63),
2175                Self::UniDetune => Some(64),
2176                Self::OscDrift => Some(65),
2177                Self::ParamDrift => Some(66),
2178                Self::DriftRate => Some(67),
2179                Self::ArpGate => Some(68),
2180                Self::SeqSlew => Some(69),
2181                Self::Mod1Dep => Some(70),
2182                Self::Mod2Dep => Some(71),
2183                Self::Mod3Dep => Some(72),
2184                Self::Mod4Dep => Some(73),
2185                Self::Mod5Dep => Some(74),
2186                Self::Mod6Dep => Some(75),
2187                Self::Mod7Dep => Some(76),
2188                Self::Mod8Dep => Some(77),
2189                Self::Fx1Param1 => Some(78),
2190                Self::Fx1Param2 => Some(79),
2191                Self::Fx1Param3 => Some(80),
2192                Self::Fx1Param4 => Some(81),
2193                Self::Fx1Param5 => Some(82),
2194                Self::Fx1Param6 => Some(83),
2195                Self::Fx1Param7 => Some(84),
2196                Self::Fx1Param8 => Some(85),
2197                Self::Fx1Param9 => Some(86),
2198                Self::Fx1Param10 => Some(87),
2199                Self::Fx1Param11 => Some(88),
2200                Self::Fx1Param12 => Some(89),
2201                Self::Fx2Param1 => Some(90),
2202                Self::Fx2Param2 => Some(91),
2203                Self::Fx2Param3 => Some(92),
2204                Self::Fx2Param4 => Some(93),
2205                Self::Fx2Param5 => Some(94),
2206                Self::Fx2Param6 => Some(95),
2207                Self::Fx2Param7 => Some(96),
2208                Self::Fx2Param8 => Some(97),
2209                Self::Fx2Param9 => Some(98),
2210                Self::Fx2Param10 => Some(99),
2211                Self::Fx2Param11 => Some(100),
2212                Self::Fx2Param12 => Some(101),
2213                Self::Fx3Param1 => Some(102),
2214                Self::Fx3Param2 => Some(103),
2215                Self::Fx3Param3 => Some(104),
2216                Self::Fx3Param4 => Some(105),
2217                Self::Fx3Param5 => Some(106),
2218                Self::Fx3Param6 => Some(107),
2219                Self::Fx3Param7 => Some(108),
2220                Self::Fx3Param8 => Some(109),
2221                Self::Fx3Param9 => Some(110),
2222                Self::Fx3Param10 => Some(111),
2223                Self::Fx3Param11 => Some(112),
2224                Self::Fx3Param12 => Some(113),
2225                Self::Fx4Param1 => Some(114),
2226                Self::Fx4Param2 => Some(115),
2227                Self::Fx4Param3 => Some(116),
2228                Self::Fx4Param4 => Some(117),
2229                Self::Fx4Param5 => Some(118),
2230                Self::Fx4Param6 => Some(119),
2231                Self::Fx4Param7 => Some(120),
2232                Self::Fx4Param8 => Some(121),
2233                Self::Fx4Param9 => Some(122),
2234                Self::Fx4Param10 => Some(123),
2235                Self::Fx4Param11 => Some(124),
2236                Self::Fx4Param12 => Some(125),
2237                Self::Fx1Level => Some(126),
2238                Self::Fx2Level => Some(127),
2239                Self::Fx3Level => Some(128),
2240                Self::Fx4Level => Some(129),
2241            }
2242        }
2243    }
2244
2245    /// Returns the name the synthesizer's display writes, as of
2246    /// [`DEFAULT_FIRMWARE`].
2247    #[must_use]
2248    pub fn name(self) -> &'static str {
2249        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
2250    }
2251
2252    /// Returns the name the synthesizer's display writes on the firmware a
2253    /// device inquiry reported.
2254    ///
2255    /// `None` for a value that firmware does not have. The names live in the
2256    /// value table the parameter layer already carries; nothing here holds a
2257    /// second copy of them.
2258    #[must_use]
2259    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
2260        let raw = self.raw_for(firmware)?;
2261        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
2262    }
2263}
2264
2265impl fmt::Display for ModDestination {
2266    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2267        f.write_str(self.name())
2268    }
2269}
2270
2271/// Modulation Matrix Source.
2272///
2273/// Firmware renumbered this table rather than extending it, so a variant is what
2274/// the value means and not the byte it travels as. [`ModSource::raw_for`] is that
2275/// byte on a given firmware, and [`ModSource::raw`] is it on the newest.
2276///
2277/// Every value the synthesizer has a name for. A byte outside the table is not
2278/// one of these: [`ModSource::from_raw`] answers `None` for it, and the byte stays
2279/// in the program either way.
2280#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2281#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2282#[non_exhaustive]
2283pub enum ModSource {
2284    /// Off.
2285    Off,
2286    /// Pitch Bend.
2287    PitchBend,
2288    /// Mod Wheel.
2289    ModWheel,
2290    /// Foot Ctrl.
2291    FootCtrl,
2292    /// `BreathCtrl`.
2293    BreathCtrl,
2294    /// Pressure.
2295    Pressure,
2296    /// Expression.
2297    Expression,
2298    /// LFO1.
2299    Lfo1,
2300    /// LFO2.
2301    Lfo2,
2302    /// Env 1.
2303    Env1,
2304    /// Env 2.
2305    Env2,
2306    /// Env 3.
2307    Env3,
2308    /// Note Num.
2309    NoteNum,
2310    /// Note Vel.
2311    NoteVel,
2312    /// Note Off Vel.
2313    NoteOffVel,
2314    /// Ctrl Seq.
2315    CtrlSeq,
2316    /// LFO1 `(Uni)`.
2317    Lfo1Uni,
2318    /// LFO2 `(Uni)`.
2319    Lfo2Uni,
2320    /// LFO1 `(Fade)`.
2321    Lfo1Fade,
2322    /// LFO2 `(Fade)`.
2323    Lfo2Fade,
2324    /// Voice Num.
2325    VoiceNum,
2326    /// Uni Voice.
2327    UniVoice,
2328    /// CC X (115).
2329    CcX,
2330    /// CC Y (116).
2331    CcY,
2332    /// CC Z (117).
2333    CcZ,
2334}
2335
2336impl ModSource {
2337    /// The value table this type lists.
2338    pub const TABLE: TableId = TableId::ModSource;
2339
2340    /// Every value, in the order the newest firmware numbers them.
2341    pub const ALL: &'static [Self] = &[
2342        Self::Off,
2343        Self::PitchBend,
2344        Self::ModWheel,
2345        Self::FootCtrl,
2346        Self::BreathCtrl,
2347        Self::Pressure,
2348        Self::Expression,
2349        Self::Lfo1,
2350        Self::Lfo2,
2351        Self::Env1,
2352        Self::Env2,
2353        Self::Env3,
2354        Self::NoteNum,
2355        Self::NoteVel,
2356        Self::NoteOffVel,
2357        Self::CtrlSeq,
2358        Self::Lfo1Uni,
2359        Self::Lfo2Uni,
2360        Self::Lfo1Fade,
2361        Self::Lfo2Fade,
2362        Self::VoiceNum,
2363        Self::UniVoice,
2364        Self::CcX,
2365        Self::CcY,
2366        Self::CcZ,
2367    ];
2368
2369    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
2370    ///
2371    /// `None` when the table does not list the byte.
2372    #[must_use]
2373    pub const fn from_raw(raw: u8) -> Option<Self> {
2374        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
2375    }
2376
2377    /// Returns the value this byte selects on the firmware a device inquiry
2378    /// reported.
2379    ///
2380    /// Worth reaching for whenever the byte came from a stored program: nothing
2381    /// in a dump says which firmware wrote it, and this table was renumbered.
2382    #[must_use]
2383    pub const fn from_raw_for(raw: u8, firmware: Version) -> Option<Self> {
2384        if firmware.at_least(1, 1) {
2385            match raw {
2386                0 => Some(Self::Off),
2387                1 => Some(Self::PitchBend),
2388                2 => Some(Self::ModWheel),
2389                3 => Some(Self::FootCtrl),
2390                4 => Some(Self::BreathCtrl),
2391                5 => Some(Self::Pressure),
2392                6 => Some(Self::Expression),
2393                7 => Some(Self::Lfo1),
2394                8 => Some(Self::Lfo2),
2395                9 => Some(Self::Env1),
2396                10 => Some(Self::Env2),
2397                11 => Some(Self::Env3),
2398                12 => Some(Self::NoteNum),
2399                13 => Some(Self::NoteVel),
2400                14 => Some(Self::NoteOffVel),
2401                15 => Some(Self::CtrlSeq),
2402                16 => Some(Self::Lfo1Uni),
2403                17 => Some(Self::Lfo2Uni),
2404                18 => Some(Self::Lfo1Fade),
2405                19 => Some(Self::Lfo2Fade),
2406                20 => Some(Self::VoiceNum),
2407                21 => Some(Self::UniVoice),
2408                22 => Some(Self::CcX),
2409                23 => Some(Self::CcY),
2410                24 => Some(Self::CcZ),
2411                _ => None,
2412            }
2413        } else {
2414            match raw {
2415                0 => Some(Self::Off),
2416                1 => Some(Self::PitchBend),
2417                2 => Some(Self::ModWheel),
2418                3 => Some(Self::FootCtrl),
2419                4 => Some(Self::BreathCtrl),
2420                5 => Some(Self::Pressure),
2421                6 => Some(Self::Lfo1),
2422                7 => Some(Self::Lfo2),
2423                8 => Some(Self::Env1),
2424                9 => Some(Self::Env2),
2425                10 => Some(Self::Env3),
2426                11 => Some(Self::NoteNum),
2427                12 => Some(Self::NoteVel),
2428                13 => Some(Self::CtrlSeq),
2429                14 => Some(Self::Lfo1Uni),
2430                15 => Some(Self::Lfo2Uni),
2431                16 => Some(Self::Lfo1Fade),
2432                17 => Some(Self::Lfo2Fade),
2433                18 => Some(Self::NoteOffVel),
2434                19 => Some(Self::VoiceNum),
2435                20 => Some(Self::CcX),
2436                21 => Some(Self::CcY),
2437                22 => Some(Self::CcZ),
2438                _ => None,
2439            }
2440        }
2441    }
2442
2443    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
2444    #[must_use]
2445    pub const fn raw(self) -> u8 {
2446        match self {
2447            Self::Off => 0,
2448            Self::PitchBend => 1,
2449            Self::ModWheel => 2,
2450            Self::FootCtrl => 3,
2451            Self::BreathCtrl => 4,
2452            Self::Pressure => 5,
2453            Self::Expression => 6,
2454            Self::Lfo1 => 7,
2455            Self::Lfo2 => 8,
2456            Self::Env1 => 9,
2457            Self::Env2 => 10,
2458            Self::Env3 => 11,
2459            Self::NoteNum => 12,
2460            Self::NoteVel => 13,
2461            Self::NoteOffVel => 14,
2462            Self::CtrlSeq => 15,
2463            Self::Lfo1Uni => 16,
2464            Self::Lfo2Uni => 17,
2465            Self::Lfo1Fade => 18,
2466            Self::Lfo2Fade => 19,
2467            Self::VoiceNum => 20,
2468            Self::UniVoice => 21,
2469            Self::CcX => 22,
2470            Self::CcY => 23,
2471            Self::CcZ => 24,
2472        }
2473    }
2474
2475    /// Returns the byte that selects this value on the firmware a device inquiry
2476    /// reported.
2477    ///
2478    /// `None` for a value that firmware does not have.
2479    #[must_use]
2480    pub const fn raw_for(self, firmware: Version) -> Option<u8> {
2481        if firmware.at_least(1, 1) {
2482            match self {
2483                Self::Off => Some(0),
2484                Self::PitchBend => Some(1),
2485                Self::ModWheel => Some(2),
2486                Self::FootCtrl => Some(3),
2487                Self::BreathCtrl => Some(4),
2488                Self::Pressure => Some(5),
2489                Self::Expression => Some(6),
2490                Self::Lfo1 => Some(7),
2491                Self::Lfo2 => Some(8),
2492                Self::Env1 => Some(9),
2493                Self::Env2 => Some(10),
2494                Self::Env3 => Some(11),
2495                Self::NoteNum => Some(12),
2496                Self::NoteVel => Some(13),
2497                Self::NoteOffVel => Some(14),
2498                Self::CtrlSeq => Some(15),
2499                Self::Lfo1Uni => Some(16),
2500                Self::Lfo2Uni => Some(17),
2501                Self::Lfo1Fade => Some(18),
2502                Self::Lfo2Fade => Some(19),
2503                Self::VoiceNum => Some(20),
2504                Self::UniVoice => Some(21),
2505                Self::CcX => Some(22),
2506                Self::CcY => Some(23),
2507                Self::CcZ => Some(24),
2508            }
2509        } else {
2510            match self {
2511                Self::Off => Some(0),
2512                Self::PitchBend => Some(1),
2513                Self::ModWheel => Some(2),
2514                Self::FootCtrl => Some(3),
2515                Self::BreathCtrl => Some(4),
2516                Self::Pressure => Some(5),
2517                Self::Expression => None,
2518                Self::Lfo1 => Some(6),
2519                Self::Lfo2 => Some(7),
2520                Self::Env1 => Some(8),
2521                Self::Env2 => Some(9),
2522                Self::Env3 => Some(10),
2523                Self::NoteNum => Some(11),
2524                Self::NoteVel => Some(12),
2525                Self::NoteOffVel => Some(18),
2526                Self::CtrlSeq => Some(13),
2527                Self::Lfo1Uni => Some(14),
2528                Self::Lfo2Uni => Some(15),
2529                Self::Lfo1Fade => Some(16),
2530                Self::Lfo2Fade => Some(17),
2531                Self::VoiceNum => Some(19),
2532                Self::UniVoice => None,
2533                Self::CcX => Some(20),
2534                Self::CcY => Some(21),
2535                Self::CcZ => Some(22),
2536            }
2537        }
2538    }
2539
2540    /// Returns the name the synthesizer's display writes, as of
2541    /// [`DEFAULT_FIRMWARE`].
2542    #[must_use]
2543    pub fn name(self) -> &'static str {
2544        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
2545    }
2546
2547    /// Returns the name the synthesizer's display writes on the firmware a
2548    /// device inquiry reported.
2549    ///
2550    /// `None` for a value that firmware does not have. The names live in the
2551    /// value table the parameter layer already carries; nothing here holds a
2552    /// second copy of them.
2553    #[must_use]
2554    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
2555        let raw = self.raw_for(firmware)?;
2556        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
2557    }
2558}
2559
2560impl fmt::Display for ModSource {
2561    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2562        f.write_str(self.name())
2563    }
2564}
2565
2566/// OSC 1 Pitch Mod Mode.
2567///
2568/// Every value the synthesizer has a name for. A byte outside the table is not
2569/// one of these: [`Osc1PitchModMode::from_raw`] answers `None` for it, and the byte stays
2570/// in the program either way.
2571#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2572#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2573#[non_exhaustive]
2574pub enum Osc1PitchModMode {
2575    /// OSC 1 + 2.
2576    Osc12,
2577    /// OSC 1 only.
2578    Osc1Only,
2579}
2580
2581impl Osc1PitchModMode {
2582    /// The value table this type lists.
2583    pub const TABLE: TableId = TableId::Osc1PitchModMode;
2584
2585    /// Every value, in the order the newest firmware numbers them.
2586    pub const ALL: &'static [Self] = &[Self::Osc12, Self::Osc1Only];
2587
2588    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
2589    ///
2590    /// `None` when the table does not list the byte.
2591    #[must_use]
2592    pub const fn from_raw(raw: u8) -> Option<Self> {
2593        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
2594    }
2595
2596    /// Returns the value this byte selects on the firmware a device inquiry
2597    /// reported.
2598    ///
2599    /// Every firmware numbers this table the same way, so the version makes no
2600    /// difference here; it is taken so that every value type reads alike.
2601    #[must_use]
2602    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
2603        match raw {
2604            0 => Some(Self::Osc12),
2605            1 => Some(Self::Osc1Only),
2606            _ => None,
2607        }
2608    }
2609
2610    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
2611    #[must_use]
2612    pub const fn raw(self) -> u8 {
2613        match self {
2614            Self::Osc12 => 0,
2615            Self::Osc1Only => 1,
2616        }
2617    }
2618
2619    /// Returns the byte that selects this value on the firmware a device inquiry
2620    /// reported.
2621    ///
2622    /// Always `Some` for this table, which every firmware numbers the same way.
2623    #[must_use]
2624    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
2625        Some(self.raw())
2626    }
2627
2628    /// Returns the name the synthesizer's display writes, as of
2629    /// [`DEFAULT_FIRMWARE`].
2630    #[must_use]
2631    pub fn name(self) -> &'static str {
2632        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
2633    }
2634
2635    /// Returns the name the synthesizer's display writes on the firmware a
2636    /// device inquiry reported.
2637    ///
2638    /// `None` for a value that firmware does not have. The names live in the
2639    /// value table the parameter layer already carries; nothing here holds a
2640    /// second copy of them.
2641    #[must_use]
2642    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
2643        let raw = self.raw_for(firmware)?;
2644        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
2645    }
2646}
2647
2648impl fmt::Display for Osc1PitchModMode {
2649    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2650        f.write_str(self.name())
2651    }
2652}
2653
2654/// Oscillator Range.
2655///
2656/// Every value the synthesizer has a name for. A byte outside the table is not
2657/// one of these: [`OscRange::from_raw`] answers `None` for it, and the byte stays
2658/// in the program either way.
2659#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2660#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2661#[non_exhaustive]
2662pub enum OscRange {
2663    /// 16'.
2664    SixteenFoot,
2665    /// 8'.
2666    EightFoot,
2667    /// 4'.
2668    FourFoot,
2669}
2670
2671impl OscRange {
2672    /// The value table this type lists.
2673    pub const TABLE: TableId = TableId::OscRange;
2674
2675    /// Every value, in the order the newest firmware numbers them.
2676    pub const ALL: &'static [Self] = &[Self::SixteenFoot, Self::EightFoot, Self::FourFoot];
2677
2678    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
2679    ///
2680    /// `None` when the table does not list the byte.
2681    #[must_use]
2682    pub const fn from_raw(raw: u8) -> Option<Self> {
2683        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
2684    }
2685
2686    /// Returns the value this byte selects on the firmware a device inquiry
2687    /// reported.
2688    ///
2689    /// Every firmware numbers this table the same way, so the version makes no
2690    /// difference here; it is taken so that every value type reads alike.
2691    #[must_use]
2692    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
2693        match raw {
2694            0 => Some(Self::SixteenFoot),
2695            1 => Some(Self::EightFoot),
2696            2 => Some(Self::FourFoot),
2697            _ => None,
2698        }
2699    }
2700
2701    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
2702    #[must_use]
2703    pub const fn raw(self) -> u8 {
2704        match self {
2705            Self::SixteenFoot => 0,
2706            Self::EightFoot => 1,
2707            Self::FourFoot => 2,
2708        }
2709    }
2710
2711    /// Returns the byte that selects this value on the firmware a device inquiry
2712    /// reported.
2713    ///
2714    /// Always `Some` for this table, which every firmware numbers the same way.
2715    #[must_use]
2716    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
2717        Some(self.raw())
2718    }
2719
2720    /// Returns the name the synthesizer's display writes, as of
2721    /// [`DEFAULT_FIRMWARE`].
2722    #[must_use]
2723    pub fn name(self) -> &'static str {
2724        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
2725    }
2726
2727    /// Returns the name the synthesizer's display writes on the firmware a
2728    /// device inquiry reported.
2729    ///
2730    /// `None` for a value that firmware does not have. The names live in the
2731    /// value table the parameter layer already carries; nothing here holds a
2732    /// second copy of them.
2733    #[must_use]
2734    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
2735        let raw = self.raw_for(firmware)?;
2736        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
2737    }
2738}
2739
2740impl fmt::Display for OscRange {
2741    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2742        f.write_str(self.name())
2743    }
2744}
2745
2746/// Oscillator Pitch Mod Source.
2747///
2748/// Every value the synthesizer has a name for. A byte outside the table is not
2749/// one of these: [`PitchModSource::from_raw`] answers `None` for it, and the byte stays
2750/// in the program either way.
2751#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2752#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2753#[non_exhaustive]
2754pub enum PitchModSource {
2755    /// LFO 1.
2756    Lfo1,
2757    /// LFO 2.
2758    Lfo2,
2759    /// VCA Env.
2760    VcaEnv,
2761    /// VCF Env.
2762    VcfEnv,
2763    /// Mod Env.
2764    ModEnv,
2765    /// LFO 1 Unipolar.
2766    Lfo1Unipolar,
2767    /// LFO 2 Unipolar.
2768    Lfo2Unipolar,
2769}
2770
2771impl PitchModSource {
2772    /// The value table this type lists.
2773    pub const TABLE: TableId = TableId::PitchModSource;
2774
2775    /// Every value, in the order the newest firmware numbers them.
2776    pub const ALL: &'static [Self] = &[
2777        Self::Lfo1,
2778        Self::Lfo2,
2779        Self::VcaEnv,
2780        Self::VcfEnv,
2781        Self::ModEnv,
2782        Self::Lfo1Unipolar,
2783        Self::Lfo2Unipolar,
2784    ];
2785
2786    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
2787    ///
2788    /// `None` when the table does not list the byte.
2789    #[must_use]
2790    pub const fn from_raw(raw: u8) -> Option<Self> {
2791        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
2792    }
2793
2794    /// Returns the value this byte selects on the firmware a device inquiry
2795    /// reported.
2796    ///
2797    /// Every firmware numbers this table the same way, so the version makes no
2798    /// difference here; it is taken so that every value type reads alike.
2799    #[must_use]
2800    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
2801        match raw {
2802            0 => Some(Self::Lfo1),
2803            1 => Some(Self::Lfo2),
2804            2 => Some(Self::VcaEnv),
2805            3 => Some(Self::VcfEnv),
2806            4 => Some(Self::ModEnv),
2807            5 => Some(Self::Lfo1Unipolar),
2808            6 => Some(Self::Lfo2Unipolar),
2809            _ => None,
2810        }
2811    }
2812
2813    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
2814    #[must_use]
2815    pub const fn raw(self) -> u8 {
2816        match self {
2817            Self::Lfo1 => 0,
2818            Self::Lfo2 => 1,
2819            Self::VcaEnv => 2,
2820            Self::VcfEnv => 3,
2821            Self::ModEnv => 4,
2822            Self::Lfo1Unipolar => 5,
2823            Self::Lfo2Unipolar => 6,
2824        }
2825    }
2826
2827    /// Returns the byte that selects this value on the firmware a device inquiry
2828    /// reported.
2829    ///
2830    /// Always `Some` for this table, which every firmware numbers the same way.
2831    #[must_use]
2832    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
2833        Some(self.raw())
2834    }
2835
2836    /// Returns the name the synthesizer's display writes, as of
2837    /// [`DEFAULT_FIRMWARE`].
2838    #[must_use]
2839    pub fn name(self) -> &'static str {
2840        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
2841    }
2842
2843    /// Returns the name the synthesizer's display writes on the firmware a
2844    /// device inquiry reported.
2845    ///
2846    /// `None` for a value that firmware does not have. The names live in the
2847    /// value table the parameter layer already carries; nothing here holds a
2848    /// second copy of them.
2849    #[must_use]
2850    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
2851        let raw = self.raw_for(firmware)?;
2852        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
2853    }
2854}
2855
2856impl fmt::Display for PitchModSource {
2857    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2858        f.write_str(self.name())
2859    }
2860}
2861
2862/// Polyphony Mode.
2863///
2864/// Every value the synthesizer has a name for. A byte outside the table is not
2865/// one of these: [`PolyphonyMode::from_raw`] answers `None` for it, and the byte stays
2866/// in the program either way.
2867#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2868#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2869#[non_exhaustive]
2870pub enum PolyphonyMode {
2871    /// Poly.
2872    Poly,
2873    /// Unison 2.
2874    Unison2,
2875    /// Unison 3.
2876    Unison3,
2877    /// Unison 4.
2878    Unison4,
2879    /// Unison 6.
2880    Unison6,
2881    /// Unison 12.
2882    Unison12,
2883    /// Mono.
2884    Mono,
2885    /// Mono 2.
2886    Mono2,
2887    /// Mono 3.
2888    Mono3,
2889    /// Mono 4.
2890    Mono4,
2891    /// Mono 6.
2892    Mono6,
2893    /// Poly 6.
2894    Poly6,
2895    /// Poly 8.
2896    Poly8,
2897}
2898
2899impl PolyphonyMode {
2900    /// The value table this type lists.
2901    pub const TABLE: TableId = TableId::PolyphonyMode;
2902
2903    /// Every value, in the order the newest firmware numbers them.
2904    pub const ALL: &'static [Self] = &[
2905        Self::Poly,
2906        Self::Unison2,
2907        Self::Unison3,
2908        Self::Unison4,
2909        Self::Unison6,
2910        Self::Unison12,
2911        Self::Mono,
2912        Self::Mono2,
2913        Self::Mono3,
2914        Self::Mono4,
2915        Self::Mono6,
2916        Self::Poly6,
2917        Self::Poly8,
2918    ];
2919
2920    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
2921    ///
2922    /// `None` when the table does not list the byte.
2923    #[must_use]
2924    pub const fn from_raw(raw: u8) -> Option<Self> {
2925        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
2926    }
2927
2928    /// Returns the value this byte selects on the firmware a device inquiry
2929    /// reported.
2930    ///
2931    /// Every firmware numbers this table the same way, so the version makes no
2932    /// difference here; it is taken so that every value type reads alike.
2933    #[must_use]
2934    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
2935        match raw {
2936            0 => Some(Self::Poly),
2937            1 => Some(Self::Unison2),
2938            2 => Some(Self::Unison3),
2939            3 => Some(Self::Unison4),
2940            4 => Some(Self::Unison6),
2941            5 => Some(Self::Unison12),
2942            6 => Some(Self::Mono),
2943            7 => Some(Self::Mono2),
2944            8 => Some(Self::Mono3),
2945            9 => Some(Self::Mono4),
2946            10 => Some(Self::Mono6),
2947            11 => Some(Self::Poly6),
2948            12 => Some(Self::Poly8),
2949            _ => None,
2950        }
2951    }
2952
2953    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
2954    #[must_use]
2955    pub const fn raw(self) -> u8 {
2956        match self {
2957            Self::Poly => 0,
2958            Self::Unison2 => 1,
2959            Self::Unison3 => 2,
2960            Self::Unison4 => 3,
2961            Self::Unison6 => 4,
2962            Self::Unison12 => 5,
2963            Self::Mono => 6,
2964            Self::Mono2 => 7,
2965            Self::Mono3 => 8,
2966            Self::Mono4 => 9,
2967            Self::Mono6 => 10,
2968            Self::Poly6 => 11,
2969            Self::Poly8 => 12,
2970        }
2971    }
2972
2973    /// Returns the byte that selects this value on the firmware a device inquiry
2974    /// reported.
2975    ///
2976    /// Always `Some` for this table, which every firmware numbers the same way.
2977    #[must_use]
2978    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
2979        Some(self.raw())
2980    }
2981
2982    /// Returns the name the synthesizer's display writes, as of
2983    /// [`DEFAULT_FIRMWARE`].
2984    #[must_use]
2985    pub fn name(self) -> &'static str {
2986        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
2987    }
2988
2989    /// Returns the name the synthesizer's display writes on the firmware a
2990    /// device inquiry reported.
2991    ///
2992    /// `None` for a value that firmware does not have. The names live in the
2993    /// value table the parameter layer already carries; nothing here holds a
2994    /// second copy of them.
2995    #[must_use]
2996    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
2997        let raw = self.raw_for(firmware)?;
2998        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
2999    }
3000}
3001
3002impl fmt::Display for PolyphonyMode {
3003    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3004        f.write_str(self.name())
3005    }
3006}
3007
3008/// Portamento Mode.
3009///
3010/// Every value the synthesizer has a name for. A byte outside the table is not
3011/// one of these: [`PortamentoMode::from_raw`] answers `None` for it, and the byte stays
3012/// in the program either way.
3013#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3014#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3015#[non_exhaustive]
3016pub enum PortamentoMode {
3017    /// Normal.
3018    Normal,
3019    /// Fingered.
3020    Fingered,
3021    /// Fixed Rate.
3022    FixedRate,
3023    /// Fixed Rate Fingered.
3024    FixedRateFingered,
3025    /// Exponential.
3026    Exponential,
3027    /// Exponential Fingered.
3028    ExponentialFingered,
3029    /// Fixed +2.
3030    FixedPlus2,
3031    /// Fixed -2.
3032    FixedMinus2,
3033    /// Fixed +5.
3034    FixedPlus5,
3035    /// Fixed -5.
3036    FixedMinus5,
3037    /// Fixed +12.
3038    FixedPlus12,
3039    /// Fixed -12.
3040    FixedMinus12,
3041    /// Fixed +24.
3042    FixedPlus24,
3043    /// Fixed -24.
3044    FixedMinus24,
3045}
3046
3047impl PortamentoMode {
3048    /// The value table this type lists.
3049    pub const TABLE: TableId = TableId::PortamentoMode;
3050
3051    /// Every value, in the order the newest firmware numbers them.
3052    pub const ALL: &'static [Self] = &[
3053        Self::Normal,
3054        Self::Fingered,
3055        Self::FixedRate,
3056        Self::FixedRateFingered,
3057        Self::Exponential,
3058        Self::ExponentialFingered,
3059        Self::FixedPlus2,
3060        Self::FixedMinus2,
3061        Self::FixedPlus5,
3062        Self::FixedMinus5,
3063        Self::FixedPlus12,
3064        Self::FixedMinus12,
3065        Self::FixedPlus24,
3066        Self::FixedMinus24,
3067    ];
3068
3069    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3070    ///
3071    /// `None` when the table does not list the byte.
3072    #[must_use]
3073    pub const fn from_raw(raw: u8) -> Option<Self> {
3074        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3075    }
3076
3077    /// Returns the value this byte selects on the firmware a device inquiry
3078    /// reported.
3079    ///
3080    /// Every firmware numbers this table the same way, so the version makes no
3081    /// difference here; it is taken so that every value type reads alike.
3082    #[must_use]
3083    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3084        match raw {
3085            0 => Some(Self::Normal),
3086            1 => Some(Self::Fingered),
3087            2 => Some(Self::FixedRate),
3088            3 => Some(Self::FixedRateFingered),
3089            4 => Some(Self::Exponential),
3090            5 => Some(Self::ExponentialFingered),
3091            6 => Some(Self::FixedPlus2),
3092            7 => Some(Self::FixedMinus2),
3093            8 => Some(Self::FixedPlus5),
3094            9 => Some(Self::FixedMinus5),
3095            10 => Some(Self::FixedPlus12),
3096            11 => Some(Self::FixedMinus12),
3097            12 => Some(Self::FixedPlus24),
3098            13 => Some(Self::FixedMinus24),
3099            _ => None,
3100        }
3101    }
3102
3103    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3104    #[must_use]
3105    pub const fn raw(self) -> u8 {
3106        match self {
3107            Self::Normal => 0,
3108            Self::Fingered => 1,
3109            Self::FixedRate => 2,
3110            Self::FixedRateFingered => 3,
3111            Self::Exponential => 4,
3112            Self::ExponentialFingered => 5,
3113            Self::FixedPlus2 => 6,
3114            Self::FixedMinus2 => 7,
3115            Self::FixedPlus5 => 8,
3116            Self::FixedMinus5 => 9,
3117            Self::FixedPlus12 => 10,
3118            Self::FixedMinus12 => 11,
3119            Self::FixedPlus24 => 12,
3120            Self::FixedMinus24 => 13,
3121        }
3122    }
3123
3124    /// Returns the byte that selects this value on the firmware a device inquiry
3125    /// reported.
3126    ///
3127    /// Always `Some` for this table, which every firmware numbers the same way.
3128    #[must_use]
3129    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3130        Some(self.raw())
3131    }
3132
3133    /// Returns the name the synthesizer's display writes, as of
3134    /// [`DEFAULT_FIRMWARE`].
3135    #[must_use]
3136    pub fn name(self) -> &'static str {
3137        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3138    }
3139
3140    /// Returns the name the synthesizer's display writes on the firmware a
3141    /// device inquiry reported.
3142    ///
3143    /// `None` for a value that firmware does not have. The names live in the
3144    /// value table the parameter layer already carries; nothing here holds a
3145    /// second copy of them.
3146    #[must_use]
3147    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3148        let raw = self.raw_for(firmware)?;
3149        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3150    }
3151}
3152
3153impl fmt::Display for PortamentoMode {
3154    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3155        f.write_str(self.name())
3156    }
3157}
3158
3159/// Program Category.
3160///
3161/// Every value the synthesizer has a name for. A byte outside the table is not
3162/// one of these: [`ProgramCategory::from_raw`] answers `None` for it, and the byte stays
3163/// in the program either way.
3164#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3165#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3166#[non_exhaustive]
3167pub enum ProgramCategory {
3168    /// None.
3169    None,
3170    /// Bass.
3171    Bass,
3172    /// Pad.
3173    Pad,
3174    /// Lead.
3175    Lead,
3176    /// Mono.
3177    Mono,
3178    /// Poly.
3179    Poly,
3180    /// Stab.
3181    Stab,
3182    /// SFX.
3183    Sfx,
3184    /// Arp.
3185    Arp,
3186    /// Seq.
3187    Seq,
3188    /// Perc.
3189    Perc,
3190    /// Ambient.
3191    Ambient,
3192    /// Modular.
3193    Modular,
3194    /// User-1.
3195    User1,
3196    /// User-2.
3197    User2,
3198    /// User-3.
3199    User3,
3200    /// User-4.
3201    User4,
3202}
3203
3204impl ProgramCategory {
3205    /// The value table this type lists.
3206    pub const TABLE: TableId = TableId::ProgramCategory;
3207
3208    /// Every value, in the order the newest firmware numbers them.
3209    pub const ALL: &'static [Self] = &[
3210        Self::None,
3211        Self::Bass,
3212        Self::Pad,
3213        Self::Lead,
3214        Self::Mono,
3215        Self::Poly,
3216        Self::Stab,
3217        Self::Sfx,
3218        Self::Arp,
3219        Self::Seq,
3220        Self::Perc,
3221        Self::Ambient,
3222        Self::Modular,
3223        Self::User1,
3224        Self::User2,
3225        Self::User3,
3226        Self::User4,
3227    ];
3228
3229    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3230    ///
3231    /// `None` when the table does not list the byte.
3232    #[must_use]
3233    pub const fn from_raw(raw: u8) -> Option<Self> {
3234        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3235    }
3236
3237    /// Returns the value this byte selects on the firmware a device inquiry
3238    /// reported.
3239    ///
3240    /// Every firmware numbers this table the same way, so the version makes no
3241    /// difference here; it is taken so that every value type reads alike.
3242    #[must_use]
3243    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3244        match raw {
3245            0 => Some(Self::None),
3246            1 => Some(Self::Bass),
3247            2 => Some(Self::Pad),
3248            3 => Some(Self::Lead),
3249            4 => Some(Self::Mono),
3250            5 => Some(Self::Poly),
3251            6 => Some(Self::Stab),
3252            7 => Some(Self::Sfx),
3253            8 => Some(Self::Arp),
3254            9 => Some(Self::Seq),
3255            10 => Some(Self::Perc),
3256            11 => Some(Self::Ambient),
3257            12 => Some(Self::Modular),
3258            13 => Some(Self::User1),
3259            14 => Some(Self::User2),
3260            15 => Some(Self::User3),
3261            16 => Some(Self::User4),
3262            _ => None,
3263        }
3264    }
3265
3266    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3267    #[must_use]
3268    pub const fn raw(self) -> u8 {
3269        match self {
3270            Self::None => 0,
3271            Self::Bass => 1,
3272            Self::Pad => 2,
3273            Self::Lead => 3,
3274            Self::Mono => 4,
3275            Self::Poly => 5,
3276            Self::Stab => 6,
3277            Self::Sfx => 7,
3278            Self::Arp => 8,
3279            Self::Seq => 9,
3280            Self::Perc => 10,
3281            Self::Ambient => 11,
3282            Self::Modular => 12,
3283            Self::User1 => 13,
3284            Self::User2 => 14,
3285            Self::User3 => 15,
3286            Self::User4 => 16,
3287        }
3288    }
3289
3290    /// Returns the byte that selects this value on the firmware a device inquiry
3291    /// reported.
3292    ///
3293    /// Always `Some` for this table, which every firmware numbers the same way.
3294    #[must_use]
3295    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3296        Some(self.raw())
3297    }
3298
3299    /// Returns the name the synthesizer's display writes, as of
3300    /// [`DEFAULT_FIRMWARE`].
3301    #[must_use]
3302    pub fn name(self) -> &'static str {
3303        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3304    }
3305
3306    /// Returns the name the synthesizer's display writes on the firmware a
3307    /// device inquiry reported.
3308    ///
3309    /// `None` for a value that firmware does not have. The names live in the
3310    /// value table the parameter layer already carries; nothing here holds a
3311    /// second copy of them.
3312    #[must_use]
3313    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3314        let raw = self.raw_for(firmware)?;
3315        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3316    }
3317}
3318
3319impl fmt::Display for ProgramCategory {
3320    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3321        f.write_str(self.name())
3322    }
3323}
3324
3325/// OSC 1 PWM Source.
3326///
3327/// Every value the synthesizer has a name for. A byte outside the table is not
3328/// one of these: [`PwmSource::from_raw`] answers `None` for it, and the byte stays
3329/// in the program either way.
3330#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3331#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3332#[non_exhaustive]
3333pub enum PwmSource {
3334    /// Manual.
3335    Manual,
3336    /// LFO 1.
3337    Lfo1,
3338    /// LFO 2.
3339    Lfo2,
3340    /// VCA Env.
3341    VcaEnv,
3342    /// VCF Env.
3343    VcfEnv,
3344    /// Mod Env.
3345    ModEnv,
3346}
3347
3348impl PwmSource {
3349    /// The value table this type lists.
3350    pub const TABLE: TableId = TableId::PwmSource;
3351
3352    /// Every value, in the order the newest firmware numbers them.
3353    pub const ALL: &'static [Self] = &[
3354        Self::Manual,
3355        Self::Lfo1,
3356        Self::Lfo2,
3357        Self::VcaEnv,
3358        Self::VcfEnv,
3359        Self::ModEnv,
3360    ];
3361
3362    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3363    ///
3364    /// `None` when the table does not list the byte.
3365    #[must_use]
3366    pub const fn from_raw(raw: u8) -> Option<Self> {
3367        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3368    }
3369
3370    /// Returns the value this byte selects on the firmware a device inquiry
3371    /// reported.
3372    ///
3373    /// Every firmware numbers this table the same way, so the version makes no
3374    /// difference here; it is taken so that every value type reads alike.
3375    #[must_use]
3376    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3377        match raw {
3378            0 => Some(Self::Manual),
3379            1 => Some(Self::Lfo1),
3380            2 => Some(Self::Lfo2),
3381            3 => Some(Self::VcaEnv),
3382            4 => Some(Self::VcfEnv),
3383            5 => Some(Self::ModEnv),
3384            _ => None,
3385        }
3386    }
3387
3388    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3389    #[must_use]
3390    pub const fn raw(self) -> u8 {
3391        match self {
3392            Self::Manual => 0,
3393            Self::Lfo1 => 1,
3394            Self::Lfo2 => 2,
3395            Self::VcaEnv => 3,
3396            Self::VcfEnv => 4,
3397            Self::ModEnv => 5,
3398        }
3399    }
3400
3401    /// Returns the byte that selects this value on the firmware a device inquiry
3402    /// reported.
3403    ///
3404    /// Always `Some` for this table, which every firmware numbers the same way.
3405    #[must_use]
3406    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3407        Some(self.raw())
3408    }
3409
3410    /// Returns the name the synthesizer's display writes, as of
3411    /// [`DEFAULT_FIRMWARE`].
3412    #[must_use]
3413    pub fn name(self) -> &'static str {
3414        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3415    }
3416
3417    /// Returns the name the synthesizer's display writes on the firmware a
3418    /// device inquiry reported.
3419    ///
3420    /// `None` for a value that firmware does not have. The names live in the
3421    /// value table the parameter layer already carries; nothing here holds a
3422    /// second copy of them.
3423    #[must_use]
3424    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3425        let raw = self.raw_for(firmware)?;
3426        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3427    }
3428}
3429
3430impl fmt::Display for PwmSource {
3431    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3432        f.write_str(self.name())
3433    }
3434}
3435
3436/// Control Sequencer Key Sync and Loop.
3437///
3438/// Every value the synthesizer has a name for. A byte outside the table is not
3439/// one of these: [`SequencerSync::from_raw`] answers `None` for it, and the byte stays
3440/// in the program either way.
3441#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3442#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3443#[non_exhaustive]
3444pub enum SequencerSync {
3445    /// Loop on.
3446    LoopOn,
3447    /// Key sync on.
3448    KeySyncOn,
3449    /// Loop and key sync on.
3450    LoopAndKeySyncOn,
3451}
3452
3453impl SequencerSync {
3454    /// The value table this type lists.
3455    pub const TABLE: TableId = TableId::SequencerSync;
3456
3457    /// Every value, in the order the newest firmware numbers them.
3458    pub const ALL: &'static [Self] = &[Self::LoopOn, Self::KeySyncOn, Self::LoopAndKeySyncOn];
3459
3460    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3461    ///
3462    /// `None` when the table does not list the byte.
3463    #[must_use]
3464    pub const fn from_raw(raw: u8) -> Option<Self> {
3465        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3466    }
3467
3468    /// Returns the value this byte selects on the firmware a device inquiry
3469    /// reported.
3470    ///
3471    /// Every firmware numbers this table the same way, so the version makes no
3472    /// difference here; it is taken so that every value type reads alike.
3473    #[must_use]
3474    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3475        match raw {
3476            0 => Some(Self::LoopOn),
3477            1 => Some(Self::KeySyncOn),
3478            2 => Some(Self::LoopAndKeySyncOn),
3479            _ => None,
3480        }
3481    }
3482
3483    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3484    #[must_use]
3485    pub const fn raw(self) -> u8 {
3486        match self {
3487            Self::LoopOn => 0,
3488            Self::KeySyncOn => 1,
3489            Self::LoopAndKeySyncOn => 2,
3490        }
3491    }
3492
3493    /// Returns the byte that selects this value on the firmware a device inquiry
3494    /// reported.
3495    ///
3496    /// Always `Some` for this table, which every firmware numbers the same way.
3497    #[must_use]
3498    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3499        Some(self.raw())
3500    }
3501
3502    /// Returns the name the synthesizer's display writes, as of
3503    /// [`DEFAULT_FIRMWARE`].
3504    #[must_use]
3505    pub fn name(self) -> &'static str {
3506        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3507    }
3508
3509    /// Returns the name the synthesizer's display writes on the firmware a
3510    /// device inquiry reported.
3511    ///
3512    /// `None` for a value that firmware does not have. The names live in the
3513    /// value table the parameter layer already carries; nothing here holds a
3514    /// second copy of them.
3515    #[must_use]
3516    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3517        let raw = self.raw_for(firmware)?;
3518        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3519    }
3520}
3521
3522impl fmt::Display for SequencerSync {
3523    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3524        f.write_str(self.name())
3525    }
3526}
3527
3528/// OSC 2 Tone Mod Source.
3529///
3530/// Every value the synthesizer has a name for. A byte outside the table is not
3531/// one of these: [`ToneModSource::from_raw`] answers `None` for it, and the byte stays
3532/// in the program either way.
3533#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3534#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3535#[non_exhaustive]
3536pub enum ToneModSource {
3537    /// Manual.
3538    Manual,
3539    /// LFO 1.
3540    Lfo1,
3541    /// LFO 2.
3542    Lfo2,
3543    /// VCA Env.
3544    VcaEnv,
3545    /// VCF Env.
3546    VcfEnv,
3547    /// Mod Env.
3548    ModEnv,
3549}
3550
3551impl ToneModSource {
3552    /// The value table this type lists.
3553    pub const TABLE: TableId = TableId::ToneModSource;
3554
3555    /// Every value, in the order the newest firmware numbers them.
3556    pub const ALL: &'static [Self] = &[
3557        Self::Manual,
3558        Self::Lfo1,
3559        Self::Lfo2,
3560        Self::VcaEnv,
3561        Self::VcfEnv,
3562        Self::ModEnv,
3563    ];
3564
3565    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3566    ///
3567    /// `None` when the table does not list the byte.
3568    #[must_use]
3569    pub const fn from_raw(raw: u8) -> Option<Self> {
3570        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3571    }
3572
3573    /// Returns the value this byte selects on the firmware a device inquiry
3574    /// reported.
3575    ///
3576    /// Every firmware numbers this table the same way, so the version makes no
3577    /// difference here; it is taken so that every value type reads alike.
3578    #[must_use]
3579    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3580        match raw {
3581            0 => Some(Self::Manual),
3582            1 => Some(Self::Lfo1),
3583            2 => Some(Self::Lfo2),
3584            3 => Some(Self::VcaEnv),
3585            4 => Some(Self::VcfEnv),
3586            5 => Some(Self::ModEnv),
3587            _ => None,
3588        }
3589    }
3590
3591    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3592    #[must_use]
3593    pub const fn raw(self) -> u8 {
3594        match self {
3595            Self::Manual => 0,
3596            Self::Lfo1 => 1,
3597            Self::Lfo2 => 2,
3598            Self::VcaEnv => 3,
3599            Self::VcfEnv => 4,
3600            Self::ModEnv => 5,
3601        }
3602    }
3603
3604    /// Returns the byte that selects this value on the firmware a device inquiry
3605    /// reported.
3606    ///
3607    /// Always `Some` for this table, which every firmware numbers the same way.
3608    #[must_use]
3609    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3610        Some(self.raw())
3611    }
3612
3613    /// Returns the name the synthesizer's display writes, as of
3614    /// [`DEFAULT_FIRMWARE`].
3615    #[must_use]
3616    pub fn name(self) -> &'static str {
3617        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3618    }
3619
3620    /// Returns the name the synthesizer's display writes on the firmware a
3621    /// device inquiry reported.
3622    ///
3623    /// `None` for a value that firmware does not have. The names live in the
3624    /// value table the parameter layer already carries; nothing here holds a
3625    /// second copy of them.
3626    #[must_use]
3627    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3628        let raw = self.raw_for(firmware)?;
3629        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3630    }
3631}
3632
3633impl fmt::Display for ToneModSource {
3634    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3635        f.write_str(self.name())
3636    }
3637}
3638
3639/// VCF Envelope Polarity.
3640///
3641/// Every value the synthesizer has a name for. A byte outside the table is not
3642/// one of these: [`VcfEnvelopePolarity::from_raw`] answers `None` for it, and the byte stays
3643/// in the program either way.
3644#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3645#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3646#[non_exhaustive]
3647pub enum VcfEnvelopePolarity {
3648    /// Negative.
3649    Negative,
3650    /// Positive.
3651    Positive,
3652}
3653
3654impl VcfEnvelopePolarity {
3655    /// The value table this type lists.
3656    pub const TABLE: TableId = TableId::VcfEnvelopePolarity;
3657
3658    /// Every value, in the order the newest firmware numbers them.
3659    pub const ALL: &'static [Self] = &[Self::Negative, Self::Positive];
3660
3661    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3662    ///
3663    /// `None` when the table does not list the byte.
3664    #[must_use]
3665    pub const fn from_raw(raw: u8) -> Option<Self> {
3666        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3667    }
3668
3669    /// Returns the value this byte selects on the firmware a device inquiry
3670    /// reported.
3671    ///
3672    /// Every firmware numbers this table the same way, so the version makes no
3673    /// difference here; it is taken so that every value type reads alike.
3674    #[must_use]
3675    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3676        match raw {
3677            0 => Some(Self::Negative),
3678            1 => Some(Self::Positive),
3679            _ => None,
3680        }
3681    }
3682
3683    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3684    #[must_use]
3685    pub const fn raw(self) -> u8 {
3686        match self {
3687            Self::Negative => 0,
3688            Self::Positive => 1,
3689        }
3690    }
3691
3692    /// Returns the byte that selects this value on the firmware a device inquiry
3693    /// reported.
3694    ///
3695    /// Always `Some` for this table, which every firmware numbers the same way.
3696    #[must_use]
3697    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3698        Some(self.raw())
3699    }
3700
3701    /// Returns the name the synthesizer's display writes, as of
3702    /// [`DEFAULT_FIRMWARE`].
3703    #[must_use]
3704    pub fn name(self) -> &'static str {
3705        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3706    }
3707
3708    /// Returns the name the synthesizer's display writes on the firmware a
3709    /// device inquiry reported.
3710    ///
3711    /// `None` for a value that firmware does not have. The names live in the
3712    /// value table the parameter layer already carries; nothing here holds a
3713    /// second copy of them.
3714    #[must_use]
3715    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3716        let raw = self.raw_for(firmware)?;
3717        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3718    }
3719}
3720
3721impl fmt::Display for VcfEnvelopePolarity {
3722    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3723        f.write_str(self.name())
3724    }
3725}
3726
3727/// VCF LFO Select.
3728///
3729/// Every value the synthesizer has a name for. A byte outside the table is not
3730/// one of these: [`VcfLfoSelect::from_raw`] answers `None` for it, and the byte stays
3731/// in the program either way.
3732#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3733#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3734#[non_exhaustive]
3735pub enum VcfLfoSelect {
3736    /// LFO 1.
3737    Lfo1,
3738    /// LFO 2.
3739    Lfo2,
3740}
3741
3742impl VcfLfoSelect {
3743    /// The value table this type lists.
3744    pub const TABLE: TableId = TableId::VcfLfoSelect;
3745
3746    /// Every value, in the order the newest firmware numbers them.
3747    pub const ALL: &'static [Self] = &[Self::Lfo1, Self::Lfo2];
3748
3749    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3750    ///
3751    /// `None` when the table does not list the byte.
3752    #[must_use]
3753    pub const fn from_raw(raw: u8) -> Option<Self> {
3754        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3755    }
3756
3757    /// Returns the value this byte selects on the firmware a device inquiry
3758    /// reported.
3759    ///
3760    /// Every firmware numbers this table the same way, so the version makes no
3761    /// difference here; it is taken so that every value type reads alike.
3762    #[must_use]
3763    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3764        match raw {
3765            0 => Some(Self::Lfo1),
3766            1 => Some(Self::Lfo2),
3767            _ => None,
3768        }
3769    }
3770
3771    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3772    #[must_use]
3773    pub const fn raw(self) -> u8 {
3774        match self {
3775            Self::Lfo1 => 0,
3776            Self::Lfo2 => 1,
3777        }
3778    }
3779
3780    /// Returns the byte that selects this value on the firmware a device inquiry
3781    /// reported.
3782    ///
3783    /// Always `Some` for this table, which every firmware numbers the same way.
3784    #[must_use]
3785    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3786        Some(self.raw())
3787    }
3788
3789    /// Returns the name the synthesizer's display writes, as of
3790    /// [`DEFAULT_FIRMWARE`].
3791    #[must_use]
3792    pub fn name(self) -> &'static str {
3793        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3794    }
3795
3796    /// Returns the name the synthesizer's display writes on the firmware a
3797    /// device inquiry reported.
3798    ///
3799    /// `None` for a value that firmware does not have. The names live in the
3800    /// value table the parameter layer already carries; nothing here holds a
3801    /// second copy of them.
3802    #[must_use]
3803    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3804        let raw = self.raw_for(firmware)?;
3805        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3806    }
3807}
3808
3809impl fmt::Display for VcfLfoSelect {
3810    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3811        f.write_str(self.name())
3812    }
3813}
3814
3815/// VCF Pole Mode.
3816///
3817/// Every value the synthesizer has a name for. A byte outside the table is not
3818/// one of these: [`VcfPoleMode::from_raw`] answers `None` for it, and the byte stays
3819/// in the program either way.
3820#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3821#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3822#[non_exhaustive]
3823pub enum VcfPoleMode {
3824    /// 4 Pole.
3825    FourPole,
3826    /// 2 Pole.
3827    TwoPole,
3828}
3829
3830impl VcfPoleMode {
3831    /// The value table this type lists.
3832    pub const TABLE: TableId = TableId::VcfPoleMode;
3833
3834    /// Every value, in the order the newest firmware numbers them.
3835    pub const ALL: &'static [Self] = &[Self::FourPole, Self::TwoPole];
3836
3837    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3838    ///
3839    /// `None` when the table does not list the byte.
3840    #[must_use]
3841    pub const fn from_raw(raw: u8) -> Option<Self> {
3842        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3843    }
3844
3845    /// Returns the value this byte selects on the firmware a device inquiry
3846    /// reported.
3847    ///
3848    /// Every firmware numbers this table the same way, so the version makes no
3849    /// difference here; it is taken so that every value type reads alike.
3850    #[must_use]
3851    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3852        match raw {
3853            0 => Some(Self::FourPole),
3854            1 => Some(Self::TwoPole),
3855            _ => None,
3856        }
3857    }
3858
3859    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3860    #[must_use]
3861    pub const fn raw(self) -> u8 {
3862        match self {
3863            Self::FourPole => 0,
3864            Self::TwoPole => 1,
3865        }
3866    }
3867
3868    /// Returns the byte that selects this value on the firmware a device inquiry
3869    /// reported.
3870    ///
3871    /// Always `Some` for this table, which every firmware numbers the same way.
3872    #[must_use]
3873    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3874        Some(self.raw())
3875    }
3876
3877    /// Returns the name the synthesizer's display writes, as of
3878    /// [`DEFAULT_FIRMWARE`].
3879    #[must_use]
3880    pub fn name(self) -> &'static str {
3881        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3882    }
3883
3884    /// Returns the name the synthesizer's display writes on the firmware a
3885    /// device inquiry reported.
3886    ///
3887    /// `None` for a value that firmware does not have. The names live in the
3888    /// value table the parameter layer already carries; nothing here holds a
3889    /// second copy of them.
3890    #[must_use]
3891    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3892        let raw = self.raw_for(firmware)?;
3893        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3894    }
3895}
3896
3897impl fmt::Display for VcfPoleMode {
3898    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3899        f.write_str(self.name())
3900    }
3901}
3902
3903/// Voice Priority Mode.
3904///
3905/// Every value the synthesizer has a name for. A byte outside the table is not
3906/// one of these: [`VoicePriority::from_raw`] answers `None` for it, and the byte stays
3907/// in the program either way.
3908#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3909#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3910#[non_exhaustive]
3911pub enum VoicePriority {
3912    /// Lowest.
3913    Lowest,
3914    /// Highest.
3915    Highest,
3916    /// Last.
3917    Last,
3918}
3919
3920impl VoicePriority {
3921    /// The value table this type lists.
3922    pub const TABLE: TableId = TableId::VoicePriority;
3923
3924    /// Every value, in the order the newest firmware numbers them.
3925    pub const ALL: &'static [Self] = &[Self::Lowest, Self::Highest, Self::Last];
3926
3927    /// Returns the value this byte selects on [`DEFAULT_FIRMWARE`].
3928    ///
3929    /// `None` when the table does not list the byte.
3930    #[must_use]
3931    pub const fn from_raw(raw: u8) -> Option<Self> {
3932        Self::from_raw_for(raw, DEFAULT_FIRMWARE)
3933    }
3934
3935    /// Returns the value this byte selects on the firmware a device inquiry
3936    /// reported.
3937    ///
3938    /// Every firmware numbers this table the same way, so the version makes no
3939    /// difference here; it is taken so that every value type reads alike.
3940    #[must_use]
3941    pub const fn from_raw_for(raw: u8, _firmware: Version) -> Option<Self> {
3942        match raw {
3943            0 => Some(Self::Lowest),
3944            1 => Some(Self::Highest),
3945            2 => Some(Self::Last),
3946            _ => None,
3947        }
3948    }
3949
3950    /// Returns the byte that selects this value on [`DEFAULT_FIRMWARE`].
3951    #[must_use]
3952    pub const fn raw(self) -> u8 {
3953        match self {
3954            Self::Lowest => 0,
3955            Self::Highest => 1,
3956            Self::Last => 2,
3957        }
3958    }
3959
3960    /// Returns the byte that selects this value on the firmware a device inquiry
3961    /// reported.
3962    ///
3963    /// Always `Some` for this table, which every firmware numbers the same way.
3964    #[must_use]
3965    pub const fn raw_for(self, _firmware: Version) -> Option<u8> {
3966        Some(self.raw())
3967    }
3968
3969    /// Returns the name the synthesizer's display writes, as of
3970    /// [`DEFAULT_FIRMWARE`].
3971    #[must_use]
3972    pub fn name(self) -> &'static str {
3973        self.name_for(DEFAULT_FIRMWARE).unwrap_or_default()
3974    }
3975
3976    /// Returns the name the synthesizer's display writes on the firmware a
3977    /// device inquiry reported.
3978    ///
3979    /// `None` for a value that firmware does not have. The names live in the
3980    /// value table the parameter layer already carries; nothing here holds a
3981    /// second copy of them.
3982    #[must_use]
3983    pub fn name_for(self, firmware: Version) -> Option<&'static str> {
3984        let raw = self.raw_for(firmware)?;
3985        Self::TABLE.table_for(firmware).name_of(u16::from(raw))
3986    }
3987}
3988
3989impl fmt::Display for VoicePriority {
3990    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3991        f.write_str(self.name())
3992    }
3993}
3994
3995/// The parameters, one pair of accessors each.
3996///
3997/// A getter reads the byte the program holds and a setter writes it. A setter
3998/// that takes a raw byte clamps it to what the parameter accepts, since a `u8`
3999/// reaches values a parameter does not; [`Program::set`] is the checked way in.
4000///
4001/// The parameters that spell the program's name are not here. They are one
4002/// string, and [`Program::name`] is how a string is read.
4003impl Program {
4004    /// LFO 1 Rate.
4005    ///
4006    /// Offset 0, 0 to 255.
4007    #[must_use]
4008    pub fn lfo1_rate(&self) -> u8 {
4009        self.get(ParamId::Lfo1Rate)
4010    }
4011
4012    /// Sets LFO 1 Rate, clamped to 0 to 255.
4013    pub fn set_lfo1_rate(&mut self, value: u8) {
4014        self.set_clamped(ParamId::Lfo1Rate, value);
4015    }
4016
4017    /// LFO 1 Delay / Fade.
4018    ///
4019    /// Offset 1, 0 to 255.
4020    #[must_use]
4021    pub fn lfo1_delay_fade(&self) -> u8 {
4022        self.get(ParamId::Lfo1DelayFade)
4023    }
4024
4025    /// Sets LFO 1 Delay / Fade, clamped to 0 to 255.
4026    pub fn set_lfo1_delay_fade(&mut self, value: u8) {
4027        self.set_clamped(ParamId::Lfo1DelayFade, value);
4028    }
4029
4030    /// LFO 1 Shape.
4031    ///
4032    /// Offset 2. `None` when the byte is one the table does not list,
4033    /// which is also what a program written by an older firmware reads as where
4034    /// that firmware numbered this table differently.
4035    #[must_use]
4036    pub fn lfo1_shape(&self) -> Option<LfoShape> {
4037        LfoShape::from_raw(self.get(ParamId::Lfo1Shape))
4038    }
4039
4040    /// Sets LFO 1 Shape.
4041    pub fn set_lfo1_shape(&mut self, value: LfoShape) {
4042        self.set_clamped(ParamId::Lfo1Shape, value.raw());
4043    }
4044
4045    /// LFO 1 Key Sync.
4046    ///
4047    /// Offset 3. Off is zero and on is one.
4048    #[must_use]
4049    pub fn lfo1_key_sync(&self) -> bool {
4050        self.get(ParamId::Lfo1KeySync) != 0
4051    }
4052
4053    /// Sets LFO 1 Key Sync.
4054    pub fn set_lfo1_key_sync(&mut self, value: bool) {
4055        self.set_clamped(ParamId::Lfo1KeySync, u8::from(value));
4056    }
4057
4058    /// LFO 1 Arp Sync.
4059    ///
4060    /// Offset 4. Off is zero and on is one.
4061    #[must_use]
4062    pub fn lfo1_arp_sync(&self) -> bool {
4063        self.get(ParamId::Lfo1ArpSync) != 0
4064    }
4065
4066    /// Sets LFO 1 Arp Sync.
4067    pub fn set_lfo1_arp_sync(&mut self, value: bool) {
4068        self.set_clamped(ParamId::Lfo1ArpSync, u8::from(value));
4069    }
4070
4071    /// LFO 1 Mono Mode.
4072    ///
4073    /// Offset 5, 0 to 255.
4074    #[must_use]
4075    pub fn lfo1_mono_mode(&self) -> u8 {
4076        self.get(ParamId::Lfo1MonoMode)
4077    }
4078
4079    /// Sets LFO 1 Mono Mode, clamped to 0 to 255.
4080    pub fn set_lfo1_mono_mode(&mut self, value: u8) {
4081        self.set_clamped(ParamId::Lfo1MonoMode, value);
4082    }
4083
4084    /// LFO 1 Slew Rate.
4085    ///
4086    /// Offset 6, 0 to 255.
4087    #[must_use]
4088    pub fn lfo1_slew_rate(&self) -> u8 {
4089        self.get(ParamId::Lfo1SlewRate)
4090    }
4091
4092    /// Sets LFO 1 Slew Rate, clamped to 0 to 255.
4093    pub fn set_lfo1_slew_rate(&mut self, value: u8) {
4094        self.set_clamped(ParamId::Lfo1SlewRate, value);
4095    }
4096
4097    /// LFO 2 Rate.
4098    ///
4099    /// Offset 7, 0 to 255.
4100    #[must_use]
4101    pub fn lfo2_rate(&self) -> u8 {
4102        self.get(ParamId::Lfo2Rate)
4103    }
4104
4105    /// Sets LFO 2 Rate, clamped to 0 to 255.
4106    pub fn set_lfo2_rate(&mut self, value: u8) {
4107        self.set_clamped(ParamId::Lfo2Rate, value);
4108    }
4109
4110    /// LFO 2 Delay / Fade.
4111    ///
4112    /// Offset 8, 0 to 255.
4113    #[must_use]
4114    pub fn lfo2_delay_fade(&self) -> u8 {
4115        self.get(ParamId::Lfo2DelayFade)
4116    }
4117
4118    /// Sets LFO 2 Delay / Fade, clamped to 0 to 255.
4119    pub fn set_lfo2_delay_fade(&mut self, value: u8) {
4120        self.set_clamped(ParamId::Lfo2DelayFade, value);
4121    }
4122
4123    /// LFO 2 Shape.
4124    ///
4125    /// Offset 9. `None` when the byte is one the table does not list,
4126    /// which is also what a program written by an older firmware reads as where
4127    /// that firmware numbered this table differently.
4128    #[must_use]
4129    pub fn lfo2_shape(&self) -> Option<LfoShape> {
4130        LfoShape::from_raw(self.get(ParamId::Lfo2Shape))
4131    }
4132
4133    /// Sets LFO 2 Shape.
4134    pub fn set_lfo2_shape(&mut self, value: LfoShape) {
4135        self.set_clamped(ParamId::Lfo2Shape, value.raw());
4136    }
4137
4138    /// LFO 2 Key Sync.
4139    ///
4140    /// Offset 10. Off is zero and on is one.
4141    #[must_use]
4142    pub fn lfo2_key_sync(&self) -> bool {
4143        self.get(ParamId::Lfo2KeySync) != 0
4144    }
4145
4146    /// Sets LFO 2 Key Sync.
4147    pub fn set_lfo2_key_sync(&mut self, value: bool) {
4148        self.set_clamped(ParamId::Lfo2KeySync, u8::from(value));
4149    }
4150
4151    /// LFO 2 Arp Sync.
4152    ///
4153    /// Offset 11. Off is zero and on is one.
4154    #[must_use]
4155    pub fn lfo2_arp_sync(&self) -> bool {
4156        self.get(ParamId::Lfo2ArpSync) != 0
4157    }
4158
4159    /// Sets LFO 2 Arp Sync.
4160    pub fn set_lfo2_arp_sync(&mut self, value: bool) {
4161        self.set_clamped(ParamId::Lfo2ArpSync, u8::from(value));
4162    }
4163
4164    /// LFO 2 Mono Mode.
4165    ///
4166    /// Offset 12, 0 to 255.
4167    #[must_use]
4168    pub fn lfo2_mono_mode(&self) -> u8 {
4169        self.get(ParamId::Lfo2MonoMode)
4170    }
4171
4172    /// Sets LFO 2 Mono Mode, clamped to 0 to 255.
4173    pub fn set_lfo2_mono_mode(&mut self, value: u8) {
4174        self.set_clamped(ParamId::Lfo2MonoMode, value);
4175    }
4176
4177    /// LFO 2 Slew Rate.
4178    ///
4179    /// Offset 13, 0 to 255.
4180    #[must_use]
4181    pub fn lfo2_slew_rate(&self) -> u8 {
4182        self.get(ParamId::Lfo2SlewRate)
4183    }
4184
4185    /// Sets LFO 2 Slew Rate, clamped to 0 to 255.
4186    pub fn set_lfo2_slew_rate(&mut self, value: u8) {
4187        self.set_clamped(ParamId::Lfo2SlewRate, value);
4188    }
4189
4190    /// OSC 1 Range.
4191    ///
4192    /// Offset 14. `None` when the byte is one the table does not list,
4193    /// which is also what a program written by an older firmware reads as where
4194    /// that firmware numbered this table differently.
4195    #[must_use]
4196    pub fn osc1_range(&self) -> Option<OscRange> {
4197        OscRange::from_raw(self.get(ParamId::Osc1Range))
4198    }
4199
4200    /// Sets OSC 1 Range.
4201    pub fn set_osc1_range(&mut self, value: OscRange) {
4202        self.set_clamped(ParamId::Osc1Range, value.raw());
4203    }
4204
4205    /// OSC 2 Range.
4206    ///
4207    /// Offset 15. `None` when the byte is one the table does not list,
4208    /// which is also what a program written by an older firmware reads as where
4209    /// that firmware numbered this table differently.
4210    #[must_use]
4211    pub fn osc2_range(&self) -> Option<OscRange> {
4212        OscRange::from_raw(self.get(ParamId::Osc2Range))
4213    }
4214
4215    /// Sets OSC 2 Range.
4216    pub fn set_osc2_range(&mut self, value: OscRange) {
4217        self.set_clamped(ParamId::Osc2Range, value.raw());
4218    }
4219
4220    /// OSC 1 PWM Source.
4221    ///
4222    /// Offset 16. `None` when the byte is one the table does not list,
4223    /// which is also what a program written by an older firmware reads as where
4224    /// that firmware numbered this table differently.
4225    #[must_use]
4226    pub fn osc1_pwm_source(&self) -> Option<PwmSource> {
4227        PwmSource::from_raw(self.get(ParamId::Osc1PwmSource))
4228    }
4229
4230    /// Sets OSC 1 PWM Source.
4231    pub fn set_osc1_pwm_source(&mut self, value: PwmSource) {
4232        self.set_clamped(ParamId::Osc1PwmSource, value.raw());
4233    }
4234
4235    /// OSC 2 Tone Mod Source.
4236    ///
4237    /// Offset 17. `None` when the byte is one the table does not list,
4238    /// which is also what a program written by an older firmware reads as where
4239    /// that firmware numbered this table differently.
4240    #[must_use]
4241    pub fn osc2_tone_mod_source(&self) -> Option<ToneModSource> {
4242        ToneModSource::from_raw(self.get(ParamId::Osc2ToneModSource))
4243    }
4244
4245    /// Sets OSC 2 Tone Mod Source.
4246    pub fn set_osc2_tone_mod_source(&mut self, value: ToneModSource) {
4247        self.set_clamped(ParamId::Osc2ToneModSource, value.raw());
4248    }
4249
4250    /// OSC 1 Pulse Enable.
4251    ///
4252    /// Offset 18. Off is zero and on is one.
4253    #[must_use]
4254    pub fn osc1_pulse_enable(&self) -> bool {
4255        self.get(ParamId::Osc1PulseEnable) != 0
4256    }
4257
4258    /// Sets OSC 1 Pulse Enable.
4259    pub fn set_osc1_pulse_enable(&mut self, value: bool) {
4260        self.set_clamped(ParamId::Osc1PulseEnable, u8::from(value));
4261    }
4262
4263    /// OSC 1 Saw Enable.
4264    ///
4265    /// Offset 19. Off is zero and on is one.
4266    #[must_use]
4267    pub fn osc1_saw_enable(&self) -> bool {
4268        self.get(ParamId::Osc1SawEnable) != 0
4269    }
4270
4271    /// Sets OSC 1 Saw Enable.
4272    pub fn set_osc1_saw_enable(&mut self, value: bool) {
4273        self.set_clamped(ParamId::Osc1SawEnable, u8::from(value));
4274    }
4275
4276    /// OSC Sync Enable.
4277    ///
4278    /// Offset 20. Off is zero and on is one.
4279    #[must_use]
4280    pub fn osc_sync_enable(&self) -> bool {
4281        self.get(ParamId::OscSyncEnable) != 0
4282    }
4283
4284    /// Sets OSC Sync Enable.
4285    pub fn set_osc_sync_enable(&mut self, value: bool) {
4286        self.set_clamped(ParamId::OscSyncEnable, u8::from(value));
4287    }
4288
4289    /// OSC 1 Pitch Mod Depth.
4290    ///
4291    /// Offset 21, 0 to 255.
4292    #[must_use]
4293    pub fn osc1_pitch_mod_depth(&self) -> u8 {
4294        self.get(ParamId::Osc1PitchModDepth)
4295    }
4296
4297    /// Sets OSC 1 Pitch Mod Depth, clamped to 0 to 255.
4298    pub fn set_osc1_pitch_mod_depth(&mut self, value: u8) {
4299        self.set_clamped(ParamId::Osc1PitchModDepth, value);
4300    }
4301
4302    /// OSC 1 Pitch Mod Select.
4303    ///
4304    /// Offset 22. `None` when the byte is one the table does not list,
4305    /// which is also what a program written by an older firmware reads as where
4306    /// that firmware numbered this table differently.
4307    #[must_use]
4308    pub fn osc1_pitch_mod_select(&self) -> Option<PitchModSource> {
4309        PitchModSource::from_raw(self.get(ParamId::Osc1PitchModSelect))
4310    }
4311
4312    /// Sets OSC 1 Pitch Mod Select.
4313    pub fn set_osc1_pitch_mod_select(&mut self, value: PitchModSource) {
4314        self.set_clamped(ParamId::Osc1PitchModSelect, value.raw());
4315    }
4316
4317    /// OSC 1 Aftertouch > Pitch Mod Depth.
4318    ///
4319    /// Offset 23, 0 to 255.
4320    #[must_use]
4321    pub fn osc1_aftertouch_to_pitch_mod_depth(&self) -> u8 {
4322        self.get(ParamId::Osc1AftertouchToPitchModDepth)
4323    }
4324
4325    /// Sets OSC 1 Aftertouch > Pitch Mod Depth, clamped to 0 to 255.
4326    pub fn set_osc1_aftertouch_to_pitch_mod_depth(&mut self, value: u8) {
4327        self.set_clamped(ParamId::Osc1AftertouchToPitchModDepth, value);
4328    }
4329
4330    /// OSC 1 Mod Wheel > Pitch Mod Depth.
4331    ///
4332    /// Offset 24, 0 to 255.
4333    #[must_use]
4334    pub fn osc1_mod_wheel_to_pitch_mod_depth(&self) -> u8 {
4335        self.get(ParamId::Osc1ModWheelToPitchModDepth)
4336    }
4337
4338    /// Sets OSC 1 Mod Wheel > Pitch Mod Depth, clamped to 0 to 255.
4339    pub fn set_osc1_mod_wheel_to_pitch_mod_depth(&mut self, value: u8) {
4340        self.set_clamped(ParamId::Osc1ModWheelToPitchModDepth, value);
4341    }
4342
4343    /// OSC 1 PWM Depth.
4344    ///
4345    /// Offset 25, 0 to 255.
4346    #[must_use]
4347    pub fn osc1_pwm_depth(&self) -> u8 {
4348        self.get(ParamId::Osc1PwmDepth)
4349    }
4350
4351    /// Sets OSC 1 PWM Depth, clamped to 0 to 255.
4352    pub fn set_osc1_pwm_depth(&mut self, value: u8) {
4353        self.set_clamped(ParamId::Osc1PwmDepth, value);
4354    }
4355
4356    /// OSC 2 Level.
4357    ///
4358    /// Offset 26, 0 to 255.
4359    #[must_use]
4360    pub fn osc2_level(&self) -> u8 {
4361        self.get(ParamId::Osc2Level)
4362    }
4363
4364    /// Sets OSC 2 Level, clamped to 0 to 255.
4365    pub fn set_osc2_level(&mut self, value: u8) {
4366        self.set_clamped(ParamId::Osc2Level, value);
4367    }
4368
4369    /// OSC 2 Pitch.
4370    ///
4371    /// Offset 27, 0 to 255.
4372    #[must_use]
4373    pub fn osc2_pitch(&self) -> u8 {
4374        self.get(ParamId::Osc2Pitch)
4375    }
4376
4377    /// Sets OSC 2 Pitch, clamped to 0 to 255.
4378    pub fn set_osc2_pitch(&mut self, value: u8) {
4379        self.set_clamped(ParamId::Osc2Pitch, value);
4380    }
4381
4382    /// OSC 2 Tone Mod Depth.
4383    ///
4384    /// Offset 28, 0 to 255.
4385    #[must_use]
4386    pub fn osc2_tone_mod_depth(&self) -> u8 {
4387        self.get(ParamId::Osc2ToneModDepth)
4388    }
4389
4390    /// Sets OSC 2 Tone Mod Depth, clamped to 0 to 255.
4391    pub fn set_osc2_tone_mod_depth(&mut self, value: u8) {
4392        self.set_clamped(ParamId::Osc2ToneModDepth, value);
4393    }
4394
4395    /// OSC 2 Pitch Mod Depth.
4396    ///
4397    /// Offset 29, 0 to 255.
4398    #[must_use]
4399    pub fn osc2_pitch_mod_depth(&self) -> u8 {
4400        self.get(ParamId::Osc2PitchModDepth)
4401    }
4402
4403    /// Sets OSC 2 Pitch Mod Depth, clamped to 0 to 255.
4404    pub fn set_osc2_pitch_mod_depth(&mut self, value: u8) {
4405        self.set_clamped(ParamId::Osc2PitchModDepth, value);
4406    }
4407
4408    /// OSC 2 Aftertouch > Pitch Mod Depth.
4409    ///
4410    /// Offset 30, 0 to 255.
4411    #[must_use]
4412    pub fn osc2_aftertouch_to_pitch_mod_depth(&self) -> u8 {
4413        self.get(ParamId::Osc2AftertouchToPitchModDepth)
4414    }
4415
4416    /// Sets OSC 2 Aftertouch > Pitch Mod Depth, clamped to 0 to 255.
4417    pub fn set_osc2_aftertouch_to_pitch_mod_depth(&mut self, value: u8) {
4418        self.set_clamped(ParamId::Osc2AftertouchToPitchModDepth, value);
4419    }
4420
4421    /// OSC 2 Mod Wheel > Pitch Mod Depth.
4422    ///
4423    /// Offset 31, 0 to 255.
4424    #[must_use]
4425    pub fn osc2_mod_wheel_to_pitch_mod_depth(&self) -> u8 {
4426        self.get(ParamId::Osc2ModWheelToPitchModDepth)
4427    }
4428
4429    /// Sets OSC 2 Mod Wheel > Pitch Mod Depth, clamped to 0 to 255.
4430    pub fn set_osc2_mod_wheel_to_pitch_mod_depth(&mut self, value: u8) {
4431        self.set_clamped(ParamId::Osc2ModWheelToPitchModDepth, value);
4432    }
4433
4434    /// OSC 2 Pitch Mod Select.
4435    ///
4436    /// Offset 32. `None` when the byte is one the table does not list,
4437    /// which is also what a program written by an older firmware reads as where
4438    /// that firmware numbered this table differently.
4439    #[must_use]
4440    pub fn osc2_pitch_mod_select(&self) -> Option<PitchModSource> {
4441        PitchModSource::from_raw(self.get(ParamId::Osc2PitchModSelect))
4442    }
4443
4444    /// Sets OSC 2 Pitch Mod Select.
4445    pub fn set_osc2_pitch_mod_select(&mut self, value: PitchModSource) {
4446        self.set_clamped(ParamId::Osc2PitchModSelect, value.raw());
4447    }
4448
4449    /// Noise Level.
4450    ///
4451    /// Offset 33, 0 to 255.
4452    #[must_use]
4453    pub fn noise_level(&self) -> u8 {
4454        self.get(ParamId::NoiseLevel)
4455    }
4456
4457    /// Sets Noise Level, clamped to 0 to 255.
4458    pub fn set_noise_level(&mut self, value: u8) {
4459        self.set_clamped(ParamId::NoiseLevel, value);
4460    }
4461
4462    /// Portamento time.
4463    ///
4464    /// Offset 34, 0 to 255.
4465    #[must_use]
4466    pub fn portamento_time(&self) -> u8 {
4467        self.get(ParamId::PortamentoTime)
4468    }
4469
4470    /// Sets Portamento time, clamped to 0 to 255.
4471    pub fn set_portamento_time(&mut self, value: u8) {
4472        self.set_clamped(ParamId::PortamentoTime, value);
4473    }
4474
4475    /// Portamento mode.
4476    ///
4477    /// Offset 35. `None` when the byte is one the table does not list,
4478    /// which is also what a program written by an older firmware reads as where
4479    /// that firmware numbered this table differently.
4480    #[must_use]
4481    pub fn portamento_mode(&self) -> Option<PortamentoMode> {
4482        PortamentoMode::from_raw(self.get(ParamId::PortamentoMode))
4483    }
4484
4485    /// Sets Portamento mode.
4486    pub fn set_portamento_mode(&mut self, value: PortamentoMode) {
4487        self.set_clamped(ParamId::PortamentoMode, value.raw());
4488    }
4489
4490    /// Pitch Bend Up Depth.
4491    ///
4492    /// Offset 36, 0 to 48.
4493    #[must_use]
4494    pub fn pitch_bend_up_depth(&self) -> u8 {
4495        self.get(ParamId::PitchBendUpDepth)
4496    }
4497
4498    /// Sets Pitch Bend Up Depth, clamped to 0 to 48.
4499    pub fn set_pitch_bend_up_depth(&mut self, value: u8) {
4500        self.set_clamped(ParamId::PitchBendUpDepth, value);
4501    }
4502
4503    /// Pitch Bend Down Depth.
4504    ///
4505    /// Offset 37, 0 to 48.
4506    #[must_use]
4507    pub fn pitch_bend_down_depth(&self) -> u8 {
4508        self.get(ParamId::PitchBendDownDepth)
4509    }
4510
4511    /// Sets Pitch Bend Down Depth, clamped to 0 to 48.
4512    pub fn set_pitch_bend_down_depth(&mut self, value: u8) {
4513        self.set_clamped(ParamId::PitchBendDownDepth, value);
4514    }
4515
4516    /// OSC 1 Pitch Mod Mode.
4517    ///
4518    /// Offset 38. `None` when the byte is one the table does not list,
4519    /// which is also what a program written by an older firmware reads as where
4520    /// that firmware numbered this table differently.
4521    #[must_use]
4522    pub fn osc1_pitch_mod_mode(&self) -> Option<Osc1PitchModMode> {
4523        Osc1PitchModMode::from_raw(self.get(ParamId::Osc1PitchModMode))
4524    }
4525
4526    /// Sets OSC 1 Pitch Mod Mode.
4527    pub fn set_osc1_pitch_mod_mode(&mut self, value: Osc1PitchModMode) {
4528        self.set_clamped(ParamId::Osc1PitchModMode, value.raw());
4529    }
4530
4531    /// VCF Frequency.
4532    ///
4533    /// Offset 39, 0 to 255.
4534    #[must_use]
4535    pub fn vcf_frequency(&self) -> u8 {
4536        self.get(ParamId::VcfFrequency)
4537    }
4538
4539    /// Sets VCF Frequency, clamped to 0 to 255.
4540    pub fn set_vcf_frequency(&mut self, value: u8) {
4541        self.set_clamped(ParamId::VcfFrequency, value);
4542    }
4543
4544    /// VCF `HighPass` Frequency.
4545    ///
4546    /// Offset 40, 0 to 255.
4547    #[must_use]
4548    pub fn vcf_high_pass_frequency(&self) -> u8 {
4549        self.get(ParamId::VcfHighPassFrequency)
4550    }
4551
4552    /// Sets VCF `HighPass` Frequency, clamped to 0 to 255.
4553    pub fn set_vcf_high_pass_frequency(&mut self, value: u8) {
4554        self.set_clamped(ParamId::VcfHighPassFrequency, value);
4555    }
4556
4557    /// VCF Resonance.
4558    ///
4559    /// Offset 41, 0 to 255.
4560    #[must_use]
4561    pub fn vcf_resonance(&self) -> u8 {
4562        self.get(ParamId::VcfResonance)
4563    }
4564
4565    /// Sets VCF Resonance, clamped to 0 to 255.
4566    pub fn set_vcf_resonance(&mut self, value: u8) {
4567        self.set_clamped(ParamId::VcfResonance, value);
4568    }
4569
4570    /// VCF Envelope Depth.
4571    ///
4572    /// Offset 42, 0 to 255.
4573    #[must_use]
4574    pub fn vcf_envelope_depth(&self) -> u8 {
4575        self.get(ParamId::VcfEnvelopeDepth)
4576    }
4577
4578    /// Sets VCF Envelope Depth, clamped to 0 to 255.
4579    pub fn set_vcf_envelope_depth(&mut self, value: u8) {
4580        self.set_clamped(ParamId::VcfEnvelopeDepth, value);
4581    }
4582
4583    /// VCF Envelope Velocity Sensitivity.
4584    ///
4585    /// Offset 43, 0 to 255.
4586    #[must_use]
4587    pub fn vcf_envelope_velocity_sensitivity(&self) -> u8 {
4588        self.get(ParamId::VcfEnvelopeVelocitySensitivity)
4589    }
4590
4591    /// Sets VCF Envelope Velocity Sensitivity, clamped to 0 to 255.
4592    pub fn set_vcf_envelope_velocity_sensitivity(&mut self, value: u8) {
4593        self.set_clamped(ParamId::VcfEnvelopeVelocitySensitivity, value);
4594    }
4595
4596    /// VCF Pitch Bend to Freq Depth.
4597    ///
4598    /// Offset 44, 0 to 255.
4599    #[must_use]
4600    pub fn vcf_pitch_bend_to_freq_depth(&self) -> u8 {
4601        self.get(ParamId::VcfPitchBendToFreqDepth)
4602    }
4603
4604    /// Sets VCF Pitch Bend to Freq Depth, clamped to 0 to 255.
4605    pub fn set_vcf_pitch_bend_to_freq_depth(&mut self, value: u8) {
4606        self.set_clamped(ParamId::VcfPitchBendToFreqDepth, value);
4607    }
4608
4609    /// VCF LFO Depth.
4610    ///
4611    /// Offset 45, 0 to 255.
4612    #[must_use]
4613    pub fn vcf_lfo_depth(&self) -> u8 {
4614        self.get(ParamId::VcfLfoDepth)
4615    }
4616
4617    /// Sets VCF LFO Depth, clamped to 0 to 255.
4618    pub fn set_vcf_lfo_depth(&mut self, value: u8) {
4619        self.set_clamped(ParamId::VcfLfoDepth, value);
4620    }
4621
4622    /// VCF LFO Select.
4623    ///
4624    /// Offset 46. `None` when the byte is one the table does not list,
4625    /// which is also what a program written by an older firmware reads as where
4626    /// that firmware numbered this table differently.
4627    #[must_use]
4628    pub fn vcf_lfo_select(&self) -> Option<VcfLfoSelect> {
4629        VcfLfoSelect::from_raw(self.get(ParamId::VcfLfoSelect))
4630    }
4631
4632    /// Sets VCF LFO Select.
4633    pub fn set_vcf_lfo_select(&mut self, value: VcfLfoSelect) {
4634        self.set_clamped(ParamId::VcfLfoSelect, value.raw());
4635    }
4636
4637    /// VCF Aftertouch > LFO Depth.
4638    ///
4639    /// Offset 47, 0 to 255.
4640    #[must_use]
4641    pub fn vcf_aftertouch_to_lfo_depth(&self) -> u8 {
4642        self.get(ParamId::VcfAftertouchToLfoDepth)
4643    }
4644
4645    /// Sets VCF Aftertouch > LFO Depth, clamped to 0 to 255.
4646    pub fn set_vcf_aftertouch_to_lfo_depth(&mut self, value: u8) {
4647        self.set_clamped(ParamId::VcfAftertouchToLfoDepth, value);
4648    }
4649
4650    /// VCF Mod Wheel > LFO Depth.
4651    ///
4652    /// Offset 48, 0 to 255.
4653    #[must_use]
4654    pub fn vcf_mod_wheel_to_lfo_depth(&self) -> u8 {
4655        self.get(ParamId::VcfModWheelToLfoDepth)
4656    }
4657
4658    /// Sets VCF Mod Wheel > LFO Depth, clamped to 0 to 255.
4659    pub fn set_vcf_mod_wheel_to_lfo_depth(&mut self, value: u8) {
4660        self.set_clamped(ParamId::VcfModWheelToLfoDepth, value);
4661    }
4662
4663    /// VCF Keyboard Tracking.
4664    ///
4665    /// Offset 49, 0 to 255.
4666    #[must_use]
4667    pub fn vcf_keyboard_tracking(&self) -> u8 {
4668        self.get(ParamId::VcfKeyboardTracking)
4669    }
4670
4671    /// Sets VCF Keyboard Tracking, clamped to 0 to 255.
4672    pub fn set_vcf_keyboard_tracking(&mut self, value: u8) {
4673        self.set_clamped(ParamId::VcfKeyboardTracking, value);
4674    }
4675
4676    /// VCF Envelope Polarity.
4677    ///
4678    /// Offset 50. `None` when the byte is one the table does not list,
4679    /// which is also what a program written by an older firmware reads as where
4680    /// that firmware numbered this table differently.
4681    #[must_use]
4682    pub fn vcf_envelope_polarity(&self) -> Option<VcfEnvelopePolarity> {
4683        VcfEnvelopePolarity::from_raw(self.get(ParamId::VcfEnvelopePolarity))
4684    }
4685
4686    /// Sets VCF Envelope Polarity.
4687    pub fn set_vcf_envelope_polarity(&mut self, value: VcfEnvelopePolarity) {
4688        self.set_clamped(ParamId::VcfEnvelopePolarity, value.raw());
4689    }
4690
4691    /// VCF 2 Pole Mode.
4692    ///
4693    /// Offset 51. `None` when the byte is one the table does not list,
4694    /// which is also what a program written by an older firmware reads as where
4695    /// that firmware numbered this table differently.
4696    #[must_use]
4697    pub fn vcf2_pole_mode(&self) -> Option<VcfPoleMode> {
4698        VcfPoleMode::from_raw(self.get(ParamId::Vcf2PoleMode))
4699    }
4700
4701    /// Sets VCF 2 Pole Mode.
4702    pub fn set_vcf2_pole_mode(&mut self, value: VcfPoleMode) {
4703        self.set_clamped(ParamId::Vcf2PoleMode, value.raw());
4704    }
4705
4706    /// VCF Bass Boost.
4707    ///
4708    /// Offset 52. Off is zero and on is one.
4709    #[must_use]
4710    pub fn vcf_bass_boost(&self) -> bool {
4711        self.get(ParamId::VcfBassBoost) != 0
4712    }
4713
4714    /// Sets VCF Bass Boost.
4715    pub fn set_vcf_bass_boost(&mut self, value: bool) {
4716        self.set_clamped(ParamId::VcfBassBoost, u8::from(value));
4717    }
4718
4719    /// VCA Envelope Attack Time.
4720    ///
4721    /// Offset 53, 0 to 255.
4722    #[must_use]
4723    pub fn vca_envelope_attack_time(&self) -> u8 {
4724        self.get(ParamId::VcaEnvelopeAttackTime)
4725    }
4726
4727    /// Sets VCA Envelope Attack Time, clamped to 0 to 255.
4728    pub fn set_vca_envelope_attack_time(&mut self, value: u8) {
4729        self.set_clamped(ParamId::VcaEnvelopeAttackTime, value);
4730    }
4731
4732    /// VCA Envelope Decay Time.
4733    ///
4734    /// Offset 54, 0 to 255.
4735    #[must_use]
4736    pub fn vca_envelope_decay_time(&self) -> u8 {
4737        self.get(ParamId::VcaEnvelopeDecayTime)
4738    }
4739
4740    /// Sets VCA Envelope Decay Time, clamped to 0 to 255.
4741    pub fn set_vca_envelope_decay_time(&mut self, value: u8) {
4742        self.set_clamped(ParamId::VcaEnvelopeDecayTime, value);
4743    }
4744
4745    /// VCA Envelope Sustain Level.
4746    ///
4747    /// Offset 55, 0 to 255.
4748    #[must_use]
4749    pub fn vca_envelope_sustain_level(&self) -> u8 {
4750        self.get(ParamId::VcaEnvelopeSustainLevel)
4751    }
4752
4753    /// Sets VCA Envelope Sustain Level, clamped to 0 to 255.
4754    pub fn set_vca_envelope_sustain_level(&mut self, value: u8) {
4755        self.set_clamped(ParamId::VcaEnvelopeSustainLevel, value);
4756    }
4757
4758    /// VCA Envelope Release Time.
4759    ///
4760    /// Offset 56, 0 to 255.
4761    #[must_use]
4762    pub fn vca_envelope_release_time(&self) -> u8 {
4763        self.get(ParamId::VcaEnvelopeReleaseTime)
4764    }
4765
4766    /// Sets VCA Envelope Release Time, clamped to 0 to 255.
4767    pub fn set_vca_envelope_release_time(&mut self, value: u8) {
4768        self.set_clamped(ParamId::VcaEnvelopeReleaseTime, value);
4769    }
4770
4771    /// VCA Envelope Trigger Mode.
4772    ///
4773    /// Offset 57. `None` when the byte is one the table does not list,
4774    /// which is also what a program written by an older firmware reads as where
4775    /// that firmware numbered this table differently.
4776    #[must_use]
4777    pub fn vca_envelope_trigger_mode(&self) -> Option<EnvelopeTrigger> {
4778        EnvelopeTrigger::from_raw(self.get(ParamId::VcaEnvelopeTriggerMode))
4779    }
4780
4781    /// Sets VCA Envelope Trigger Mode.
4782    pub fn set_vca_envelope_trigger_mode(&mut self, value: EnvelopeTrigger) {
4783        self.set_clamped(ParamId::VcaEnvelopeTriggerMode, value.raw());
4784    }
4785
4786    /// VCA Envelope Attack Curve.
4787    ///
4788    /// Offset 58, 0 to 255.
4789    #[must_use]
4790    pub fn vca_envelope_attack_curve(&self) -> u8 {
4791        self.get(ParamId::VcaEnvelopeAttackCurve)
4792    }
4793
4794    /// Sets VCA Envelope Attack Curve, clamped to 0 to 255.
4795    pub fn set_vca_envelope_attack_curve(&mut self, value: u8) {
4796        self.set_clamped(ParamId::VcaEnvelopeAttackCurve, value);
4797    }
4798
4799    /// VCA Envelope Decay Curve.
4800    ///
4801    /// Offset 59, 0 to 255.
4802    #[must_use]
4803    pub fn vca_envelope_decay_curve(&self) -> u8 {
4804        self.get(ParamId::VcaEnvelopeDecayCurve)
4805    }
4806
4807    /// Sets VCA Envelope Decay Curve, clamped to 0 to 255.
4808    pub fn set_vca_envelope_decay_curve(&mut self, value: u8) {
4809        self.set_clamped(ParamId::VcaEnvelopeDecayCurve, value);
4810    }
4811
4812    /// VCA Envelope Sustain Curve.
4813    ///
4814    /// Offset 60, 0 to 255.
4815    #[must_use]
4816    pub fn vca_envelope_sustain_curve(&self) -> u8 {
4817        self.get(ParamId::VcaEnvelopeSustainCurve)
4818    }
4819
4820    /// Sets VCA Envelope Sustain Curve, clamped to 0 to 255.
4821    pub fn set_vca_envelope_sustain_curve(&mut self, value: u8) {
4822        self.set_clamped(ParamId::VcaEnvelopeSustainCurve, value);
4823    }
4824
4825    /// VCA Envelope Release Curve.
4826    ///
4827    /// Offset 61, 0 to 255.
4828    #[must_use]
4829    pub fn vca_envelope_release_curve(&self) -> u8 {
4830        self.get(ParamId::VcaEnvelopeReleaseCurve)
4831    }
4832
4833    /// Sets VCA Envelope Release Curve, clamped to 0 to 255.
4834    pub fn set_vca_envelope_release_curve(&mut self, value: u8) {
4835        self.set_clamped(ParamId::VcaEnvelopeReleaseCurve, value);
4836    }
4837
4838    /// VCF Envelope Attack Time.
4839    ///
4840    /// Offset 62, 0 to 255.
4841    #[must_use]
4842    pub fn vcf_envelope_attack_time(&self) -> u8 {
4843        self.get(ParamId::VcfEnvelopeAttackTime)
4844    }
4845
4846    /// Sets VCF Envelope Attack Time, clamped to 0 to 255.
4847    pub fn set_vcf_envelope_attack_time(&mut self, value: u8) {
4848        self.set_clamped(ParamId::VcfEnvelopeAttackTime, value);
4849    }
4850
4851    /// VCF Envelope Decay Time.
4852    ///
4853    /// Offset 63, 0 to 255.
4854    #[must_use]
4855    pub fn vcf_envelope_decay_time(&self) -> u8 {
4856        self.get(ParamId::VcfEnvelopeDecayTime)
4857    }
4858
4859    /// Sets VCF Envelope Decay Time, clamped to 0 to 255.
4860    pub fn set_vcf_envelope_decay_time(&mut self, value: u8) {
4861        self.set_clamped(ParamId::VcfEnvelopeDecayTime, value);
4862    }
4863
4864    /// VCF Envelope Sustain Level.
4865    ///
4866    /// Offset 64, 0 to 255.
4867    #[must_use]
4868    pub fn vcf_envelope_sustain_level(&self) -> u8 {
4869        self.get(ParamId::VcfEnvelopeSustainLevel)
4870    }
4871
4872    /// Sets VCF Envelope Sustain Level, clamped to 0 to 255.
4873    pub fn set_vcf_envelope_sustain_level(&mut self, value: u8) {
4874        self.set_clamped(ParamId::VcfEnvelopeSustainLevel, value);
4875    }
4876
4877    /// VCF Envelope Release Time.
4878    ///
4879    /// Offset 65, 0 to 255.
4880    #[must_use]
4881    pub fn vcf_envelope_release_time(&self) -> u8 {
4882        self.get(ParamId::VcfEnvelopeReleaseTime)
4883    }
4884
4885    /// Sets VCF Envelope Release Time, clamped to 0 to 255.
4886    pub fn set_vcf_envelope_release_time(&mut self, value: u8) {
4887        self.set_clamped(ParamId::VcfEnvelopeReleaseTime, value);
4888    }
4889
4890    /// VCF Envelope Trigger Mode.
4891    ///
4892    /// Offset 66. `None` when the byte is one the table does not list,
4893    /// which is also what a program written by an older firmware reads as where
4894    /// that firmware numbered this table differently.
4895    #[must_use]
4896    pub fn vcf_envelope_trigger_mode(&self) -> Option<EnvelopeTrigger> {
4897        EnvelopeTrigger::from_raw(self.get(ParamId::VcfEnvelopeTriggerMode))
4898    }
4899
4900    /// Sets VCF Envelope Trigger Mode.
4901    pub fn set_vcf_envelope_trigger_mode(&mut self, value: EnvelopeTrigger) {
4902        self.set_clamped(ParamId::VcfEnvelopeTriggerMode, value.raw());
4903    }
4904
4905    /// VCF Envelope Attack Curve.
4906    ///
4907    /// Offset 67, 0 to 255.
4908    #[must_use]
4909    pub fn vcf_envelope_attack_curve(&self) -> u8 {
4910        self.get(ParamId::VcfEnvelopeAttackCurve)
4911    }
4912
4913    /// Sets VCF Envelope Attack Curve, clamped to 0 to 255.
4914    pub fn set_vcf_envelope_attack_curve(&mut self, value: u8) {
4915        self.set_clamped(ParamId::VcfEnvelopeAttackCurve, value);
4916    }
4917
4918    /// VCF Envelope Decay Curve.
4919    ///
4920    /// Offset 68, 0 to 255.
4921    #[must_use]
4922    pub fn vcf_envelope_decay_curve(&self) -> u8 {
4923        self.get(ParamId::VcfEnvelopeDecayCurve)
4924    }
4925
4926    /// Sets VCF Envelope Decay Curve, clamped to 0 to 255.
4927    pub fn set_vcf_envelope_decay_curve(&mut self, value: u8) {
4928        self.set_clamped(ParamId::VcfEnvelopeDecayCurve, value);
4929    }
4930
4931    /// VCF Envelope Sustain Curve.
4932    ///
4933    /// Offset 69, 0 to 255.
4934    #[must_use]
4935    pub fn vcf_envelope_sustain_curve(&self) -> u8 {
4936        self.get(ParamId::VcfEnvelopeSustainCurve)
4937    }
4938
4939    /// Sets VCF Envelope Sustain Curve, clamped to 0 to 255.
4940    pub fn set_vcf_envelope_sustain_curve(&mut self, value: u8) {
4941        self.set_clamped(ParamId::VcfEnvelopeSustainCurve, value);
4942    }
4943
4944    /// VCF Envelope Release Curve.
4945    ///
4946    /// Offset 70, 0 to 255.
4947    #[must_use]
4948    pub fn vcf_envelope_release_curve(&self) -> u8 {
4949        self.get(ParamId::VcfEnvelopeReleaseCurve)
4950    }
4951
4952    /// Sets VCF Envelope Release Curve, clamped to 0 to 255.
4953    pub fn set_vcf_envelope_release_curve(&mut self, value: u8) {
4954        self.set_clamped(ParamId::VcfEnvelopeReleaseCurve, value);
4955    }
4956
4957    /// Mod Envelope Attack Time.
4958    ///
4959    /// Offset 71, 0 to 255.
4960    #[must_use]
4961    pub fn mod_envelope_attack_time(&self) -> u8 {
4962        self.get(ParamId::ModEnvelopeAttackTime)
4963    }
4964
4965    /// Sets Mod Envelope Attack Time, clamped to 0 to 255.
4966    pub fn set_mod_envelope_attack_time(&mut self, value: u8) {
4967        self.set_clamped(ParamId::ModEnvelopeAttackTime, value);
4968    }
4969
4970    /// Mod Envelope Decay Time.
4971    ///
4972    /// Offset 72, 0 to 255.
4973    #[must_use]
4974    pub fn mod_envelope_decay_time(&self) -> u8 {
4975        self.get(ParamId::ModEnvelopeDecayTime)
4976    }
4977
4978    /// Sets Mod Envelope Decay Time, clamped to 0 to 255.
4979    pub fn set_mod_envelope_decay_time(&mut self, value: u8) {
4980        self.set_clamped(ParamId::ModEnvelopeDecayTime, value);
4981    }
4982
4983    /// Mod Envelope Sustain Level.
4984    ///
4985    /// Offset 73, 0 to 255.
4986    #[must_use]
4987    pub fn mod_envelope_sustain_level(&self) -> u8 {
4988        self.get(ParamId::ModEnvelopeSustainLevel)
4989    }
4990
4991    /// Sets Mod Envelope Sustain Level, clamped to 0 to 255.
4992    pub fn set_mod_envelope_sustain_level(&mut self, value: u8) {
4993        self.set_clamped(ParamId::ModEnvelopeSustainLevel, value);
4994    }
4995
4996    /// Mod Envelope Release Time.
4997    ///
4998    /// Offset 74, 0 to 255.
4999    #[must_use]
5000    pub fn mod_envelope_release_time(&self) -> u8 {
5001        self.get(ParamId::ModEnvelopeReleaseTime)
5002    }
5003
5004    /// Sets Mod Envelope Release Time, clamped to 0 to 255.
5005    pub fn set_mod_envelope_release_time(&mut self, value: u8) {
5006        self.set_clamped(ParamId::ModEnvelopeReleaseTime, value);
5007    }
5008
5009    /// Mod Envelope Trigger Mode.
5010    ///
5011    /// Offset 75. `None` when the byte is one the table does not list,
5012    /// which is also what a program written by an older firmware reads as where
5013    /// that firmware numbered this table differently.
5014    #[must_use]
5015    pub fn mod_envelope_trigger_mode(&self) -> Option<EnvelopeTrigger> {
5016        EnvelopeTrigger::from_raw(self.get(ParamId::ModEnvelopeTriggerMode))
5017    }
5018
5019    /// Sets Mod Envelope Trigger Mode.
5020    pub fn set_mod_envelope_trigger_mode(&mut self, value: EnvelopeTrigger) {
5021        self.set_clamped(ParamId::ModEnvelopeTriggerMode, value.raw());
5022    }
5023
5024    /// Mod Envelope Attack Curve.
5025    ///
5026    /// Offset 76, 0 to 255.
5027    #[must_use]
5028    pub fn mod_envelope_attack_curve(&self) -> u8 {
5029        self.get(ParamId::ModEnvelopeAttackCurve)
5030    }
5031
5032    /// Sets Mod Envelope Attack Curve, clamped to 0 to 255.
5033    pub fn set_mod_envelope_attack_curve(&mut self, value: u8) {
5034        self.set_clamped(ParamId::ModEnvelopeAttackCurve, value);
5035    }
5036
5037    /// Mod Envelope Decay Curve.
5038    ///
5039    /// Offset 77, 0 to 255.
5040    #[must_use]
5041    pub fn mod_envelope_decay_curve(&self) -> u8 {
5042        self.get(ParamId::ModEnvelopeDecayCurve)
5043    }
5044
5045    /// Sets Mod Envelope Decay Curve, clamped to 0 to 255.
5046    pub fn set_mod_envelope_decay_curve(&mut self, value: u8) {
5047        self.set_clamped(ParamId::ModEnvelopeDecayCurve, value);
5048    }
5049
5050    /// Mod Envelope Sustain Curve.
5051    ///
5052    /// Offset 78, 0 to 255.
5053    #[must_use]
5054    pub fn mod_envelope_sustain_curve(&self) -> u8 {
5055        self.get(ParamId::ModEnvelopeSustainCurve)
5056    }
5057
5058    /// Sets Mod Envelope Sustain Curve, clamped to 0 to 255.
5059    pub fn set_mod_envelope_sustain_curve(&mut self, value: u8) {
5060        self.set_clamped(ParamId::ModEnvelopeSustainCurve, value);
5061    }
5062
5063    /// Mod Envelope Release Curve.
5064    ///
5065    /// Offset 79, 0 to 255.
5066    #[must_use]
5067    pub fn mod_envelope_release_curve(&self) -> u8 {
5068        self.get(ParamId::ModEnvelopeReleaseCurve)
5069    }
5070
5071    /// Sets Mod Envelope Release Curve, clamped to 0 to 255.
5072    pub fn set_mod_envelope_release_curve(&mut self, value: u8) {
5073        self.set_clamped(ParamId::ModEnvelopeReleaseCurve, value);
5074    }
5075
5076    /// VCA Level.
5077    ///
5078    /// Offset 80, 0 to 255.
5079    #[must_use]
5080    pub fn vca_level(&self) -> u8 {
5081        self.get(ParamId::VcaLevel)
5082    }
5083
5084    /// Sets VCA Level, clamped to 0 to 255.
5085    pub fn set_vca_level(&mut self, value: u8) {
5086        self.set_clamped(ParamId::VcaLevel, value);
5087    }
5088
5089    /// VCA Envelope Depth.
5090    ///
5091    /// Offset 81, 0 to 255.
5092    #[must_use]
5093    pub fn vca_envelope_depth(&self) -> u8 {
5094        self.get(ParamId::VcaEnvelopeDepth)
5095    }
5096
5097    /// Sets VCA Envelope Depth, clamped to 0 to 255.
5098    pub fn set_vca_envelope_depth(&mut self, value: u8) {
5099        self.set_clamped(ParamId::VcaEnvelopeDepth, value);
5100    }
5101
5102    /// VCA Envelope Velocity Sensitivity.
5103    ///
5104    /// Offset 82, 0 to 255.
5105    #[must_use]
5106    pub fn vca_envelope_velocity_sensitivity(&self) -> u8 {
5107        self.get(ParamId::VcaEnvelopeVelocitySensitivity)
5108    }
5109
5110    /// Sets VCA Envelope Velocity Sensitivity, clamped to 0 to 255.
5111    pub fn set_vca_envelope_velocity_sensitivity(&mut self, value: u8) {
5112        self.set_clamped(ParamId::VcaEnvelopeVelocitySensitivity, value);
5113    }
5114
5115    /// VCA Pan Spread.
5116    ///
5117    /// Offset 83, 0 to 255.
5118    #[must_use]
5119    pub fn vca_pan_spread(&self) -> u8 {
5120        self.get(ParamId::VcaPanSpread)
5121    }
5122
5123    /// Sets VCA Pan Spread, clamped to 0 to 255.
5124    pub fn set_vca_pan_spread(&mut self, value: u8) {
5125        self.set_clamped(ParamId::VcaPanSpread, value);
5126    }
5127
5128    /// Voice Priority Mode.
5129    ///
5130    /// Offset 84. `None` when the byte is one the table does not list,
5131    /// which is also what a program written by an older firmware reads as where
5132    /// that firmware numbered this table differently.
5133    #[must_use]
5134    pub fn voice_priority_mode(&self) -> Option<VoicePriority> {
5135        VoicePriority::from_raw(self.get(ParamId::VoicePriorityMode))
5136    }
5137
5138    /// Sets Voice Priority Mode.
5139    pub fn set_voice_priority_mode(&mut self, value: VoicePriority) {
5140        self.set_clamped(ParamId::VoicePriorityMode, value.raw());
5141    }
5142
5143    /// Polyphony Mode.
5144    ///
5145    /// Offset 85. `None` when the byte is one the table does not list,
5146    /// which is also what a program written by an older firmware reads as where
5147    /// that firmware numbered this table differently.
5148    #[must_use]
5149    pub fn polyphony_mode(&self) -> Option<PolyphonyMode> {
5150        PolyphonyMode::from_raw(self.get(ParamId::PolyphonyMode))
5151    }
5152
5153    /// Sets Polyphony Mode.
5154    pub fn set_polyphony_mode(&mut self, value: PolyphonyMode) {
5155        self.set_clamped(ParamId::PolyphonyMode, value.raw());
5156    }
5157
5158    /// Envelope Trigger Mode.
5159    ///
5160    /// Offset 86. `None` when the byte is one the table does not list,
5161    /// which is also what a program written by an older firmware reads as where
5162    /// that firmware numbered this table differently.
5163    #[must_use]
5164    pub fn envelope_trigger_mode(&self) -> Option<KeyAssignMode> {
5165        KeyAssignMode::from_raw(self.get(ParamId::EnvelopeTriggerMode))
5166    }
5167
5168    /// Sets Envelope Trigger Mode.
5169    pub fn set_envelope_trigger_mode(&mut self, value: KeyAssignMode) {
5170        self.set_clamped(ParamId::EnvelopeTriggerMode, value.raw());
5171    }
5172
5173    /// Unison Detune.
5174    ///
5175    /// Offset 87, 0 to 255.
5176    #[must_use]
5177    pub fn unison_detune(&self) -> u8 {
5178        self.get(ParamId::UnisonDetune)
5179    }
5180
5181    /// Sets Unison Detune, clamped to 0 to 255.
5182    pub fn set_unison_detune(&mut self, value: u8) {
5183        self.set_clamped(ParamId::UnisonDetune, value);
5184    }
5185
5186    /// Voice Drift.
5187    ///
5188    /// Offset 88, 0 to 255.
5189    #[must_use]
5190    pub fn voice_drift(&self) -> u8 {
5191        self.get(ParamId::VoiceDrift)
5192    }
5193
5194    /// Sets Voice Drift, clamped to 0 to 255.
5195    pub fn set_voice_drift(&mut self, value: u8) {
5196        self.set_clamped(ParamId::VoiceDrift, value);
5197    }
5198
5199    /// Parameter Drift.
5200    ///
5201    /// Offset 89, 0 to 255.
5202    #[must_use]
5203    pub fn parameter_drift(&self) -> u8 {
5204        self.get(ParamId::ParameterDrift)
5205    }
5206
5207    /// Sets Parameter Drift, clamped to 0 to 255.
5208    pub fn set_parameter_drift(&mut self, value: u8) {
5209        self.set_clamped(ParamId::ParameterDrift, value);
5210    }
5211
5212    /// Drift Rate.
5213    ///
5214    /// Offset 90, 0 to 255.
5215    #[must_use]
5216    pub fn drift_rate(&self) -> u8 {
5217        self.get(ParamId::DriftRate)
5218    }
5219
5220    /// Sets Drift Rate, clamped to 0 to 255.
5221    pub fn set_drift_rate(&mut self, value: u8) {
5222        self.set_clamped(ParamId::DriftRate, value);
5223    }
5224
5225    /// OSC Portamento Balance.
5226    ///
5227    /// Offset 91, 0 to 255.
5228    #[must_use]
5229    pub fn osc_portamento_balance(&self) -> u8 {
5230        self.get(ParamId::OscPortamentoBalance)
5231    }
5232
5233    /// Sets OSC Portamento Balance, clamped to 0 to 255.
5234    pub fn set_osc_portamento_balance(&mut self, value: u8) {
5235        self.set_clamped(ParamId::OscPortamentoBalance, value);
5236    }
5237
5238    /// OSC Key Down Reset.
5239    ///
5240    /// Offset 92. Off is zero and on is one.
5241    #[must_use]
5242    pub fn osc_key_down_reset(&self) -> bool {
5243        self.get(ParamId::OscKeyDownReset) != 0
5244    }
5245
5246    /// Sets OSC Key Down Reset.
5247    pub fn set_osc_key_down_reset(&mut self, value: bool) {
5248        self.set_clamped(ParamId::OscKeyDownReset, u8::from(value));
5249    }
5250
5251    /// Mod 1 Source.
5252    ///
5253    /// Offset 93. `None` when the byte is one the table does not list,
5254    /// which is also what a program written by an older firmware reads as where
5255    /// that firmware numbered this table differently.
5256    #[must_use]
5257    pub fn mod1_source(&self) -> Option<ModSource> {
5258        ModSource::from_raw(self.get(ParamId::Mod1Source))
5259    }
5260
5261    /// Sets Mod 1 Source.
5262    pub fn set_mod1_source(&mut self, value: ModSource) {
5263        self.set_clamped(ParamId::Mod1Source, value.raw());
5264    }
5265
5266    /// Mod 1 Destination.
5267    ///
5268    /// Offset 94. `None` when the byte is one the table does not list,
5269    /// which is also what a program written by an older firmware reads as where
5270    /// that firmware numbered this table differently.
5271    #[must_use]
5272    pub fn mod1_destination(&self) -> Option<ModDestination> {
5273        ModDestination::from_raw(self.get(ParamId::Mod1Destination))
5274    }
5275
5276    /// Sets Mod 1 Destination.
5277    pub fn set_mod1_destination(&mut self, value: ModDestination) {
5278        self.set_clamped(ParamId::Mod1Destination, value.raw());
5279    }
5280
5281    /// Mod 1 Depth.
5282    ///
5283    /// Offset 95, 0 to 255.
5284    #[must_use]
5285    pub fn mod1_depth(&self) -> u8 {
5286        self.get(ParamId::Mod1Depth)
5287    }
5288
5289    /// Sets Mod 1 Depth, clamped to 0 to 255.
5290    pub fn set_mod1_depth(&mut self, value: u8) {
5291        self.set_clamped(ParamId::Mod1Depth, value);
5292    }
5293
5294    /// Mod 2 Source.
5295    ///
5296    /// Offset 96. `None` when the byte is one the table does not list,
5297    /// which is also what a program written by an older firmware reads as where
5298    /// that firmware numbered this table differently.
5299    #[must_use]
5300    pub fn mod2_source(&self) -> Option<ModSource> {
5301        ModSource::from_raw(self.get(ParamId::Mod2Source))
5302    }
5303
5304    /// Sets Mod 2 Source.
5305    pub fn set_mod2_source(&mut self, value: ModSource) {
5306        self.set_clamped(ParamId::Mod2Source, value.raw());
5307    }
5308
5309    /// Mod 2 Destination.
5310    ///
5311    /// Offset 97. `None` when the byte is one the table does not list,
5312    /// which is also what a program written by an older firmware reads as where
5313    /// that firmware numbered this table differently.
5314    #[must_use]
5315    pub fn mod2_destination(&self) -> Option<ModDestination> {
5316        ModDestination::from_raw(self.get(ParamId::Mod2Destination))
5317    }
5318
5319    /// Sets Mod 2 Destination.
5320    pub fn set_mod2_destination(&mut self, value: ModDestination) {
5321        self.set_clamped(ParamId::Mod2Destination, value.raw());
5322    }
5323
5324    /// Mod 2 Depth.
5325    ///
5326    /// Offset 98, 0 to 255.
5327    #[must_use]
5328    pub fn mod2_depth(&self) -> u8 {
5329        self.get(ParamId::Mod2Depth)
5330    }
5331
5332    /// Sets Mod 2 Depth, clamped to 0 to 255.
5333    pub fn set_mod2_depth(&mut self, value: u8) {
5334        self.set_clamped(ParamId::Mod2Depth, value);
5335    }
5336
5337    /// Mod 3 Source.
5338    ///
5339    /// Offset 99. `None` when the byte is one the table does not list,
5340    /// which is also what a program written by an older firmware reads as where
5341    /// that firmware numbered this table differently.
5342    #[must_use]
5343    pub fn mod3_source(&self) -> Option<ModSource> {
5344        ModSource::from_raw(self.get(ParamId::Mod3Source))
5345    }
5346
5347    /// Sets Mod 3 Source.
5348    pub fn set_mod3_source(&mut self, value: ModSource) {
5349        self.set_clamped(ParamId::Mod3Source, value.raw());
5350    }
5351
5352    /// Mod 3 Destination.
5353    ///
5354    /// Offset 100. `None` when the byte is one the table does not list,
5355    /// which is also what a program written by an older firmware reads as where
5356    /// that firmware numbered this table differently.
5357    #[must_use]
5358    pub fn mod3_destination(&self) -> Option<ModDestination> {
5359        ModDestination::from_raw(self.get(ParamId::Mod3Destination))
5360    }
5361
5362    /// Sets Mod 3 Destination.
5363    pub fn set_mod3_destination(&mut self, value: ModDestination) {
5364        self.set_clamped(ParamId::Mod3Destination, value.raw());
5365    }
5366
5367    /// Mod 3 Depth.
5368    ///
5369    /// Offset 101, 0 to 255.
5370    #[must_use]
5371    pub fn mod3_depth(&self) -> u8 {
5372        self.get(ParamId::Mod3Depth)
5373    }
5374
5375    /// Sets Mod 3 Depth, clamped to 0 to 255.
5376    pub fn set_mod3_depth(&mut self, value: u8) {
5377        self.set_clamped(ParamId::Mod3Depth, value);
5378    }
5379
5380    /// Mod 4 Source.
5381    ///
5382    /// Offset 102. `None` when the byte is one the table does not list,
5383    /// which is also what a program written by an older firmware reads as where
5384    /// that firmware numbered this table differently.
5385    #[must_use]
5386    pub fn mod4_source(&self) -> Option<ModSource> {
5387        ModSource::from_raw(self.get(ParamId::Mod4Source))
5388    }
5389
5390    /// Sets Mod 4 Source.
5391    pub fn set_mod4_source(&mut self, value: ModSource) {
5392        self.set_clamped(ParamId::Mod4Source, value.raw());
5393    }
5394
5395    /// Mod 4 Destination.
5396    ///
5397    /// Offset 103. `None` when the byte is one the table does not list,
5398    /// which is also what a program written by an older firmware reads as where
5399    /// that firmware numbered this table differently.
5400    #[must_use]
5401    pub fn mod4_destination(&self) -> Option<ModDestination> {
5402        ModDestination::from_raw(self.get(ParamId::Mod4Destination))
5403    }
5404
5405    /// Sets Mod 4 Destination.
5406    pub fn set_mod4_destination(&mut self, value: ModDestination) {
5407        self.set_clamped(ParamId::Mod4Destination, value.raw());
5408    }
5409
5410    /// Mod 4 Depth.
5411    ///
5412    /// Offset 104, 0 to 255.
5413    #[must_use]
5414    pub fn mod4_depth(&self) -> u8 {
5415        self.get(ParamId::Mod4Depth)
5416    }
5417
5418    /// Sets Mod 4 Depth, clamped to 0 to 255.
5419    pub fn set_mod4_depth(&mut self, value: u8) {
5420        self.set_clamped(ParamId::Mod4Depth, value);
5421    }
5422
5423    /// Mod 5 Source.
5424    ///
5425    /// Offset 105. `None` when the byte is one the table does not list,
5426    /// which is also what a program written by an older firmware reads as where
5427    /// that firmware numbered this table differently.
5428    #[must_use]
5429    pub fn mod5_source(&self) -> Option<ModSource> {
5430        ModSource::from_raw(self.get(ParamId::Mod5Source))
5431    }
5432
5433    /// Sets Mod 5 Source.
5434    pub fn set_mod5_source(&mut self, value: ModSource) {
5435        self.set_clamped(ParamId::Mod5Source, value.raw());
5436    }
5437
5438    /// Mod 5 Destination.
5439    ///
5440    /// Offset 106. `None` when the byte is one the table does not list,
5441    /// which is also what a program written by an older firmware reads as where
5442    /// that firmware numbered this table differently.
5443    #[must_use]
5444    pub fn mod5_destination(&self) -> Option<ModDestination> {
5445        ModDestination::from_raw(self.get(ParamId::Mod5Destination))
5446    }
5447
5448    /// Sets Mod 5 Destination.
5449    pub fn set_mod5_destination(&mut self, value: ModDestination) {
5450        self.set_clamped(ParamId::Mod5Destination, value.raw());
5451    }
5452
5453    /// Mod 5 Depth.
5454    ///
5455    /// Offset 107, 0 to 255.
5456    #[must_use]
5457    pub fn mod5_depth(&self) -> u8 {
5458        self.get(ParamId::Mod5Depth)
5459    }
5460
5461    /// Sets Mod 5 Depth, clamped to 0 to 255.
5462    pub fn set_mod5_depth(&mut self, value: u8) {
5463        self.set_clamped(ParamId::Mod5Depth, value);
5464    }
5465
5466    /// Mod 6 Source.
5467    ///
5468    /// Offset 108. `None` when the byte is one the table does not list,
5469    /// which is also what a program written by an older firmware reads as where
5470    /// that firmware numbered this table differently.
5471    #[must_use]
5472    pub fn mod6_source(&self) -> Option<ModSource> {
5473        ModSource::from_raw(self.get(ParamId::Mod6Source))
5474    }
5475
5476    /// Sets Mod 6 Source.
5477    pub fn set_mod6_source(&mut self, value: ModSource) {
5478        self.set_clamped(ParamId::Mod6Source, value.raw());
5479    }
5480
5481    /// Mod 6 Destination.
5482    ///
5483    /// Offset 109. `None` when the byte is one the table does not list,
5484    /// which is also what a program written by an older firmware reads as where
5485    /// that firmware numbered this table differently.
5486    #[must_use]
5487    pub fn mod6_destination(&self) -> Option<ModDestination> {
5488        ModDestination::from_raw(self.get(ParamId::Mod6Destination))
5489    }
5490
5491    /// Sets Mod 6 Destination.
5492    pub fn set_mod6_destination(&mut self, value: ModDestination) {
5493        self.set_clamped(ParamId::Mod6Destination, value.raw());
5494    }
5495
5496    /// Mod 6 Depth.
5497    ///
5498    /// Offset 110, 0 to 255.
5499    #[must_use]
5500    pub fn mod6_depth(&self) -> u8 {
5501        self.get(ParamId::Mod6Depth)
5502    }
5503
5504    /// Sets Mod 6 Depth, clamped to 0 to 255.
5505    pub fn set_mod6_depth(&mut self, value: u8) {
5506        self.set_clamped(ParamId::Mod6Depth, value);
5507    }
5508
5509    /// Mod 7 Source.
5510    ///
5511    /// Offset 111. `None` when the byte is one the table does not list,
5512    /// which is also what a program written by an older firmware reads as where
5513    /// that firmware numbered this table differently.
5514    #[must_use]
5515    pub fn mod7_source(&self) -> Option<ModSource> {
5516        ModSource::from_raw(self.get(ParamId::Mod7Source))
5517    }
5518
5519    /// Sets Mod 7 Source.
5520    pub fn set_mod7_source(&mut self, value: ModSource) {
5521        self.set_clamped(ParamId::Mod7Source, value.raw());
5522    }
5523
5524    /// Mod 7 Destination.
5525    ///
5526    /// Offset 112. `None` when the byte is one the table does not list,
5527    /// which is also what a program written by an older firmware reads as where
5528    /// that firmware numbered this table differently.
5529    #[must_use]
5530    pub fn mod7_destination(&self) -> Option<ModDestination> {
5531        ModDestination::from_raw(self.get(ParamId::Mod7Destination))
5532    }
5533
5534    /// Sets Mod 7 Destination.
5535    pub fn set_mod7_destination(&mut self, value: ModDestination) {
5536        self.set_clamped(ParamId::Mod7Destination, value.raw());
5537    }
5538
5539    /// Mod 7 Depth.
5540    ///
5541    /// Offset 113, 0 to 255.
5542    #[must_use]
5543    pub fn mod7_depth(&self) -> u8 {
5544        self.get(ParamId::Mod7Depth)
5545    }
5546
5547    /// Sets Mod 7 Depth, clamped to 0 to 255.
5548    pub fn set_mod7_depth(&mut self, value: u8) {
5549        self.set_clamped(ParamId::Mod7Depth, value);
5550    }
5551
5552    /// Mod 8 Source.
5553    ///
5554    /// Offset 114. `None` when the byte is one the table does not list,
5555    /// which is also what a program written by an older firmware reads as where
5556    /// that firmware numbered this table differently.
5557    #[must_use]
5558    pub fn mod8_source(&self) -> Option<ModSource> {
5559        ModSource::from_raw(self.get(ParamId::Mod8Source))
5560    }
5561
5562    /// Sets Mod 8 Source.
5563    pub fn set_mod8_source(&mut self, value: ModSource) {
5564        self.set_clamped(ParamId::Mod8Source, value.raw());
5565    }
5566
5567    /// Mod 8 Destination.
5568    ///
5569    /// Offset 115. `None` when the byte is one the table does not list,
5570    /// which is also what a program written by an older firmware reads as where
5571    /// that firmware numbered this table differently.
5572    #[must_use]
5573    pub fn mod8_destination(&self) -> Option<ModDestination> {
5574        ModDestination::from_raw(self.get(ParamId::Mod8Destination))
5575    }
5576
5577    /// Sets Mod 8 Destination.
5578    pub fn set_mod8_destination(&mut self, value: ModDestination) {
5579        self.set_clamped(ParamId::Mod8Destination, value.raw());
5580    }
5581
5582    /// Mod 8 Depth.
5583    ///
5584    /// Offset 116, 0 to 255.
5585    #[must_use]
5586    pub fn mod8_depth(&self) -> u8 {
5587        self.get(ParamId::Mod8Depth)
5588    }
5589
5590    /// Sets Mod 8 Depth, clamped to 0 to 255.
5591    pub fn set_mod8_depth(&mut self, value: u8) {
5592        self.set_clamped(ParamId::Mod8Depth, value);
5593    }
5594
5595    /// Ctrl Sequencer Enable.
5596    ///
5597    /// Offset 117. Off is zero and on is one.
5598    #[must_use]
5599    pub fn ctrl_sequencer_enable(&self) -> bool {
5600        self.get(ParamId::CtrlSequencerEnable) != 0
5601    }
5602
5603    /// Sets Ctrl Sequencer Enable.
5604    pub fn set_ctrl_sequencer_enable(&mut self, value: bool) {
5605        self.set_clamped(ParamId::CtrlSequencerEnable, u8::from(value));
5606    }
5607
5608    /// Ctrl Sequencer Clock Divider.
5609    ///
5610    /// Offset 118, 0 to 15.
5611    #[must_use]
5612    pub fn ctrl_sequencer_clock_divider(&self) -> u8 {
5613        self.get(ParamId::CtrlSequencerClockDivider)
5614    }
5615
5616    /// Sets Ctrl Sequencer Clock Divider, clamped to 0 to 15.
5617    pub fn set_ctrl_sequencer_clock_divider(&mut self, value: u8) {
5618        self.set_clamped(ParamId::CtrlSequencerClockDivider, value);
5619    }
5620
5621    /// Sequence Length.
5622    ///
5623    /// Offset 119, 0 to 31.
5624    #[must_use]
5625    pub fn sequence_length(&self) -> u8 {
5626        self.get(ParamId::SequenceLength)
5627    }
5628
5629    /// Sets Sequence Length, clamped to 0 to 31.
5630    pub fn set_sequence_length(&mut self, value: u8) {
5631        self.set_clamped(ParamId::SequenceLength, value);
5632    }
5633
5634    /// Sequencer Swing Timing.
5635    ///
5636    /// Offset 120, 0 to 255.
5637    #[must_use]
5638    pub fn sequencer_swing_timing(&self) -> u8 {
5639        self.get(ParamId::SequencerSwingTiming)
5640    }
5641
5642    /// Sets Sequencer Swing Timing, clamped to 0 to 255.
5643    pub fn set_sequencer_swing_timing(&mut self, value: u8) {
5644        self.set_clamped(ParamId::SequencerSwingTiming, value);
5645    }
5646
5647    /// Key Sync & Loop.
5648    ///
5649    /// Offset 121. `None` when the byte is one the table does not list,
5650    /// which is also what a program written by an older firmware reads as where
5651    /// that firmware numbered this table differently.
5652    #[must_use]
5653    pub fn key_sync_and_loop(&self) -> Option<SequencerSync> {
5654        SequencerSync::from_raw(self.get(ParamId::KeySyncAndLoop))
5655    }
5656
5657    /// Sets Key Sync & Loop.
5658    pub fn set_key_sync_and_loop(&mut self, value: SequencerSync) {
5659        self.set_clamped(ParamId::KeySyncAndLoop, value.raw());
5660    }
5661
5662    /// Slew Rate.
5663    ///
5664    /// Offset 122, 0 to 255.
5665    #[must_use]
5666    pub fn slew_rate(&self) -> u8 {
5667        self.get(ParamId::SlewRate)
5668    }
5669
5670    /// Sets Slew Rate, clamped to 0 to 255.
5671    pub fn set_slew_rate(&mut self, value: u8) {
5672        self.set_clamped(ParamId::SlewRate, value);
5673    }
5674
5675    /// Seq Step Value 1.
5676    ///
5677    /// Offset 123, 0 to 255.
5678    #[must_use]
5679    pub fn seq_step_value1(&self) -> u8 {
5680        self.get(ParamId::SeqStepValue1)
5681    }
5682
5683    /// Sets Seq Step Value 1, clamped to 0 to 255.
5684    pub fn set_seq_step_value1(&mut self, value: u8) {
5685        self.set_clamped(ParamId::SeqStepValue1, value);
5686    }
5687
5688    /// Seq Step Value 2.
5689    ///
5690    /// Offset 124, 0 to 255.
5691    #[must_use]
5692    pub fn seq_step_value2(&self) -> u8 {
5693        self.get(ParamId::SeqStepValue2)
5694    }
5695
5696    /// Sets Seq Step Value 2, clamped to 0 to 255.
5697    pub fn set_seq_step_value2(&mut self, value: u8) {
5698        self.set_clamped(ParamId::SeqStepValue2, value);
5699    }
5700
5701    /// Seq Step Value 3.
5702    ///
5703    /// Offset 125, 0 to 255.
5704    #[must_use]
5705    pub fn seq_step_value3(&self) -> u8 {
5706        self.get(ParamId::SeqStepValue3)
5707    }
5708
5709    /// Sets Seq Step Value 3, clamped to 0 to 255.
5710    pub fn set_seq_step_value3(&mut self, value: u8) {
5711        self.set_clamped(ParamId::SeqStepValue3, value);
5712    }
5713
5714    /// Seq Step Value 4.
5715    ///
5716    /// Offset 126, 0 to 255.
5717    #[must_use]
5718    pub fn seq_step_value4(&self) -> u8 {
5719        self.get(ParamId::SeqStepValue4)
5720    }
5721
5722    /// Sets Seq Step Value 4, clamped to 0 to 255.
5723    pub fn set_seq_step_value4(&mut self, value: u8) {
5724        self.set_clamped(ParamId::SeqStepValue4, value);
5725    }
5726
5727    /// Seq Step Value 5.
5728    ///
5729    /// Offset 127, 0 to 255.
5730    #[must_use]
5731    pub fn seq_step_value5(&self) -> u8 {
5732        self.get(ParamId::SeqStepValue5)
5733    }
5734
5735    /// Sets Seq Step Value 5, clamped to 0 to 255.
5736    pub fn set_seq_step_value5(&mut self, value: u8) {
5737        self.set_clamped(ParamId::SeqStepValue5, value);
5738    }
5739
5740    /// Seq Step Value 6.
5741    ///
5742    /// Offset 128, 0 to 255.
5743    #[must_use]
5744    pub fn seq_step_value6(&self) -> u8 {
5745        self.get(ParamId::SeqStepValue6)
5746    }
5747
5748    /// Sets Seq Step Value 6, clamped to 0 to 255.
5749    pub fn set_seq_step_value6(&mut self, value: u8) {
5750        self.set_clamped(ParamId::SeqStepValue6, value);
5751    }
5752
5753    /// Seq Step Value 7.
5754    ///
5755    /// Offset 129, 0 to 255.
5756    #[must_use]
5757    pub fn seq_step_value7(&self) -> u8 {
5758        self.get(ParamId::SeqStepValue7)
5759    }
5760
5761    /// Sets Seq Step Value 7, clamped to 0 to 255.
5762    pub fn set_seq_step_value7(&mut self, value: u8) {
5763        self.set_clamped(ParamId::SeqStepValue7, value);
5764    }
5765
5766    /// Seq Step Value 8.
5767    ///
5768    /// Offset 130, 0 to 255.
5769    #[must_use]
5770    pub fn seq_step_value8(&self) -> u8 {
5771        self.get(ParamId::SeqStepValue8)
5772    }
5773
5774    /// Sets Seq Step Value 8, clamped to 0 to 255.
5775    pub fn set_seq_step_value8(&mut self, value: u8) {
5776        self.set_clamped(ParamId::SeqStepValue8, value);
5777    }
5778
5779    /// Seq Step Value 9.
5780    ///
5781    /// Offset 131, 0 to 255.
5782    #[must_use]
5783    pub fn seq_step_value9(&self) -> u8 {
5784        self.get(ParamId::SeqStepValue9)
5785    }
5786
5787    /// Sets Seq Step Value 9, clamped to 0 to 255.
5788    pub fn set_seq_step_value9(&mut self, value: u8) {
5789        self.set_clamped(ParamId::SeqStepValue9, value);
5790    }
5791
5792    /// Seq Step Value 10.
5793    ///
5794    /// Offset 132, 0 to 255.
5795    #[must_use]
5796    pub fn seq_step_value10(&self) -> u8 {
5797        self.get(ParamId::SeqStepValue10)
5798    }
5799
5800    /// Sets Seq Step Value 10, clamped to 0 to 255.
5801    pub fn set_seq_step_value10(&mut self, value: u8) {
5802        self.set_clamped(ParamId::SeqStepValue10, value);
5803    }
5804
5805    /// Seq Step Value 11.
5806    ///
5807    /// Offset 133, 0 to 255.
5808    #[must_use]
5809    pub fn seq_step_value11(&self) -> u8 {
5810        self.get(ParamId::SeqStepValue11)
5811    }
5812
5813    /// Sets Seq Step Value 11, clamped to 0 to 255.
5814    pub fn set_seq_step_value11(&mut self, value: u8) {
5815        self.set_clamped(ParamId::SeqStepValue11, value);
5816    }
5817
5818    /// Seq Step Value 12.
5819    ///
5820    /// Offset 134, 0 to 255.
5821    #[must_use]
5822    pub fn seq_step_value12(&self) -> u8 {
5823        self.get(ParamId::SeqStepValue12)
5824    }
5825
5826    /// Sets Seq Step Value 12, clamped to 0 to 255.
5827    pub fn set_seq_step_value12(&mut self, value: u8) {
5828        self.set_clamped(ParamId::SeqStepValue12, value);
5829    }
5830
5831    /// Seq Step Value 13.
5832    ///
5833    /// Offset 135, 0 to 255.
5834    #[must_use]
5835    pub fn seq_step_value13(&self) -> u8 {
5836        self.get(ParamId::SeqStepValue13)
5837    }
5838
5839    /// Sets Seq Step Value 13, clamped to 0 to 255.
5840    pub fn set_seq_step_value13(&mut self, value: u8) {
5841        self.set_clamped(ParamId::SeqStepValue13, value);
5842    }
5843
5844    /// Seq Step Value 14.
5845    ///
5846    /// Offset 136, 0 to 255.
5847    #[must_use]
5848    pub fn seq_step_value14(&self) -> u8 {
5849        self.get(ParamId::SeqStepValue14)
5850    }
5851
5852    /// Sets Seq Step Value 14, clamped to 0 to 255.
5853    pub fn set_seq_step_value14(&mut self, value: u8) {
5854        self.set_clamped(ParamId::SeqStepValue14, value);
5855    }
5856
5857    /// Seq Step Value 15.
5858    ///
5859    /// Offset 137, 0 to 255.
5860    #[must_use]
5861    pub fn seq_step_value15(&self) -> u8 {
5862        self.get(ParamId::SeqStepValue15)
5863    }
5864
5865    /// Sets Seq Step Value 15, clamped to 0 to 255.
5866    pub fn set_seq_step_value15(&mut self, value: u8) {
5867        self.set_clamped(ParamId::SeqStepValue15, value);
5868    }
5869
5870    /// Seq Step Value 16.
5871    ///
5872    /// Offset 138, 0 to 255.
5873    #[must_use]
5874    pub fn seq_step_value16(&self) -> u8 {
5875        self.get(ParamId::SeqStepValue16)
5876    }
5877
5878    /// Sets Seq Step Value 16, clamped to 0 to 255.
5879    pub fn set_seq_step_value16(&mut self, value: u8) {
5880        self.set_clamped(ParamId::SeqStepValue16, value);
5881    }
5882
5883    /// Seq Step Value 17.
5884    ///
5885    /// Offset 139, 0 to 255.
5886    #[must_use]
5887    pub fn seq_step_value17(&self) -> u8 {
5888        self.get(ParamId::SeqStepValue17)
5889    }
5890
5891    /// Sets Seq Step Value 17, clamped to 0 to 255.
5892    pub fn set_seq_step_value17(&mut self, value: u8) {
5893        self.set_clamped(ParamId::SeqStepValue17, value);
5894    }
5895
5896    /// Seq Step Value 18.
5897    ///
5898    /// Offset 140, 0 to 255.
5899    #[must_use]
5900    pub fn seq_step_value18(&self) -> u8 {
5901        self.get(ParamId::SeqStepValue18)
5902    }
5903
5904    /// Sets Seq Step Value 18, clamped to 0 to 255.
5905    pub fn set_seq_step_value18(&mut self, value: u8) {
5906        self.set_clamped(ParamId::SeqStepValue18, value);
5907    }
5908
5909    /// Seq Step Value 19.
5910    ///
5911    /// Offset 141, 0 to 255.
5912    #[must_use]
5913    pub fn seq_step_value19(&self) -> u8 {
5914        self.get(ParamId::SeqStepValue19)
5915    }
5916
5917    /// Sets Seq Step Value 19, clamped to 0 to 255.
5918    pub fn set_seq_step_value19(&mut self, value: u8) {
5919        self.set_clamped(ParamId::SeqStepValue19, value);
5920    }
5921
5922    /// Seq Step Value 20.
5923    ///
5924    /// Offset 142, 0 to 255.
5925    #[must_use]
5926    pub fn seq_step_value20(&self) -> u8 {
5927        self.get(ParamId::SeqStepValue20)
5928    }
5929
5930    /// Sets Seq Step Value 20, clamped to 0 to 255.
5931    pub fn set_seq_step_value20(&mut self, value: u8) {
5932        self.set_clamped(ParamId::SeqStepValue20, value);
5933    }
5934
5935    /// Seq Step Value 21.
5936    ///
5937    /// Offset 143, 0 to 255.
5938    #[must_use]
5939    pub fn seq_step_value21(&self) -> u8 {
5940        self.get(ParamId::SeqStepValue21)
5941    }
5942
5943    /// Sets Seq Step Value 21, clamped to 0 to 255.
5944    pub fn set_seq_step_value21(&mut self, value: u8) {
5945        self.set_clamped(ParamId::SeqStepValue21, value);
5946    }
5947
5948    /// Seq Step Value 22.
5949    ///
5950    /// Offset 144, 0 to 255.
5951    #[must_use]
5952    pub fn seq_step_value22(&self) -> u8 {
5953        self.get(ParamId::SeqStepValue22)
5954    }
5955
5956    /// Sets Seq Step Value 22, clamped to 0 to 255.
5957    pub fn set_seq_step_value22(&mut self, value: u8) {
5958        self.set_clamped(ParamId::SeqStepValue22, value);
5959    }
5960
5961    /// Seq Step Value 23.
5962    ///
5963    /// Offset 145, 0 to 255.
5964    #[must_use]
5965    pub fn seq_step_value23(&self) -> u8 {
5966        self.get(ParamId::SeqStepValue23)
5967    }
5968
5969    /// Sets Seq Step Value 23, clamped to 0 to 255.
5970    pub fn set_seq_step_value23(&mut self, value: u8) {
5971        self.set_clamped(ParamId::SeqStepValue23, value);
5972    }
5973
5974    /// Seq Step Value 24.
5975    ///
5976    /// Offset 146, 0 to 255.
5977    #[must_use]
5978    pub fn seq_step_value24(&self) -> u8 {
5979        self.get(ParamId::SeqStepValue24)
5980    }
5981
5982    /// Sets Seq Step Value 24, clamped to 0 to 255.
5983    pub fn set_seq_step_value24(&mut self, value: u8) {
5984        self.set_clamped(ParamId::SeqStepValue24, value);
5985    }
5986
5987    /// Seq Step Value 25.
5988    ///
5989    /// Offset 147, 0 to 255.
5990    #[must_use]
5991    pub fn seq_step_value25(&self) -> u8 {
5992        self.get(ParamId::SeqStepValue25)
5993    }
5994
5995    /// Sets Seq Step Value 25, clamped to 0 to 255.
5996    pub fn set_seq_step_value25(&mut self, value: u8) {
5997        self.set_clamped(ParamId::SeqStepValue25, value);
5998    }
5999
6000    /// Seq Step Value 26.
6001    ///
6002    /// Offset 148, 0 to 255.
6003    #[must_use]
6004    pub fn seq_step_value26(&self) -> u8 {
6005        self.get(ParamId::SeqStepValue26)
6006    }
6007
6008    /// Sets Seq Step Value 26, clamped to 0 to 255.
6009    pub fn set_seq_step_value26(&mut self, value: u8) {
6010        self.set_clamped(ParamId::SeqStepValue26, value);
6011    }
6012
6013    /// Seq Step Value 27.
6014    ///
6015    /// Offset 149, 0 to 255.
6016    #[must_use]
6017    pub fn seq_step_value27(&self) -> u8 {
6018        self.get(ParamId::SeqStepValue27)
6019    }
6020
6021    /// Sets Seq Step Value 27, clamped to 0 to 255.
6022    pub fn set_seq_step_value27(&mut self, value: u8) {
6023        self.set_clamped(ParamId::SeqStepValue27, value);
6024    }
6025
6026    /// Seq Step Value 28.
6027    ///
6028    /// Offset 150, 0 to 255.
6029    #[must_use]
6030    pub fn seq_step_value28(&self) -> u8 {
6031        self.get(ParamId::SeqStepValue28)
6032    }
6033
6034    /// Sets Seq Step Value 28, clamped to 0 to 255.
6035    pub fn set_seq_step_value28(&mut self, value: u8) {
6036        self.set_clamped(ParamId::SeqStepValue28, value);
6037    }
6038
6039    /// Seq Step Value 29.
6040    ///
6041    /// Offset 151, 0 to 255.
6042    #[must_use]
6043    pub fn seq_step_value29(&self) -> u8 {
6044        self.get(ParamId::SeqStepValue29)
6045    }
6046
6047    /// Sets Seq Step Value 29, clamped to 0 to 255.
6048    pub fn set_seq_step_value29(&mut self, value: u8) {
6049        self.set_clamped(ParamId::SeqStepValue29, value);
6050    }
6051
6052    /// Seq Step Value 30.
6053    ///
6054    /// Offset 152, 0 to 255.
6055    #[must_use]
6056    pub fn seq_step_value30(&self) -> u8 {
6057        self.get(ParamId::SeqStepValue30)
6058    }
6059
6060    /// Sets Seq Step Value 30, clamped to 0 to 255.
6061    pub fn set_seq_step_value30(&mut self, value: u8) {
6062        self.set_clamped(ParamId::SeqStepValue30, value);
6063    }
6064
6065    /// Seq Step Value 31.
6066    ///
6067    /// Offset 153, 0 to 255.
6068    #[must_use]
6069    pub fn seq_step_value31(&self) -> u8 {
6070        self.get(ParamId::SeqStepValue31)
6071    }
6072
6073    /// Sets Seq Step Value 31, clamped to 0 to 255.
6074    pub fn set_seq_step_value31(&mut self, value: u8) {
6075        self.set_clamped(ParamId::SeqStepValue31, value);
6076    }
6077
6078    /// Seq Step Value 32.
6079    ///
6080    /// Offset 154, 0 to 255.
6081    #[must_use]
6082    pub fn seq_step_value32(&self) -> u8 {
6083        self.get(ParamId::SeqStepValue32)
6084    }
6085
6086    /// Sets Seq Step Value 32, clamped to 0 to 255.
6087    pub fn set_seq_step_value32(&mut self, value: u8) {
6088        self.set_clamped(ParamId::SeqStepValue32, value);
6089    }
6090
6091    /// Arp `On/Off`.
6092    ///
6093    /// Offset 155. Off is zero and on is one.
6094    #[must_use]
6095    pub fn arp_on_off(&self) -> bool {
6096        self.get(ParamId::ArpOnOff) != 0
6097    }
6098
6099    /// Sets Arp `On/Off`.
6100    pub fn set_arp_on_off(&mut self, value: bool) {
6101        self.set_clamped(ParamId::ArpOnOff, u8::from(value));
6102    }
6103
6104    /// Arp Mode.
6105    ///
6106    /// Offset 156. `None` when the byte is one the table does not list,
6107    /// which is also what a program written by an older firmware reads as where
6108    /// that firmware numbered this table differently.
6109    #[must_use]
6110    pub fn arp_mode(&self) -> Option<ArpMode> {
6111        ArpMode::from_raw(self.get(ParamId::ArpMode))
6112    }
6113
6114    /// Sets Arp Mode.
6115    pub fn set_arp_mode(&mut self, value: ArpMode) {
6116        self.set_clamped(ParamId::ArpMode, value.raw());
6117    }
6118
6119    /// Arp Rate (tempo).
6120    ///
6121    /// Offset 157, 0 to 255.
6122    #[must_use]
6123    pub fn arp_rate_tempo(&self) -> u8 {
6124        self.get(ParamId::ArpRateTempo)
6125    }
6126
6127    /// Sets Arp Rate (tempo), clamped to 0 to 255.
6128    pub fn set_arp_rate_tempo(&mut self, value: u8) {
6129        self.set_clamped(ParamId::ArpRateTempo, value);
6130    }
6131
6132    /// Arp Clock.
6133    ///
6134    /// Offset 158, 0 to 12.
6135    #[must_use]
6136    pub fn arp_clock(&self) -> u8 {
6137        self.get(ParamId::ArpClock)
6138    }
6139
6140    /// Sets Arp Clock, clamped to 0 to 12.
6141    pub fn set_arp_clock(&mut self, value: u8) {
6142        self.set_clamped(ParamId::ArpClock, value);
6143    }
6144
6145    /// Arp Key Sync.
6146    ///
6147    /// Offset 159. Off is zero and on is one.
6148    #[must_use]
6149    pub fn arp_key_sync(&self) -> bool {
6150        self.get(ParamId::ArpKeySync) != 0
6151    }
6152
6153    /// Sets Arp Key Sync.
6154    pub fn set_arp_key_sync(&mut self, value: bool) {
6155        self.set_clamped(ParamId::ArpKeySync, u8::from(value));
6156    }
6157
6158    /// Arp Gate Time.
6159    ///
6160    /// Offset 160, 0 to 255.
6161    #[must_use]
6162    pub fn arp_gate_time(&self) -> u8 {
6163        self.get(ParamId::ArpGateTime)
6164    }
6165
6166    /// Sets Arp Gate Time, clamped to 0 to 255.
6167    pub fn set_arp_gate_time(&mut self, value: u8) {
6168        self.set_clamped(ParamId::ArpGateTime, value);
6169    }
6170
6171    /// Arp Hold.
6172    ///
6173    /// Offset 161. Off is zero and on is one.
6174    #[must_use]
6175    pub fn arp_hold(&self) -> bool {
6176        self.get(ParamId::ArpHold) != 0
6177    }
6178
6179    /// Sets Arp Hold.
6180    pub fn set_arp_hold(&mut self, value: bool) {
6181        self.set_clamped(ParamId::ArpHold, u8::from(value));
6182    }
6183
6184    /// Arp Pattern.
6185    ///
6186    /// Offset 162, 0 to 64.
6187    #[must_use]
6188    pub fn arp_pattern(&self) -> u8 {
6189        self.get(ParamId::ArpPattern)
6190    }
6191
6192    /// Sets Arp Pattern, clamped to 0 to 64.
6193    pub fn set_arp_pattern(&mut self, value: u8) {
6194        self.set_clamped(ParamId::ArpPattern, value);
6195    }
6196
6197    /// Arp Swing.
6198    ///
6199    /// Offset 163, 0 to 255.
6200    #[must_use]
6201    pub fn arp_swing(&self) -> u8 {
6202        self.get(ParamId::ArpSwing)
6203    }
6204
6205    /// Sets Arp Swing, clamped to 0 to 255.
6206    pub fn set_arp_swing(&mut self, value: u8) {
6207        self.set_clamped(ParamId::ArpSwing, value);
6208    }
6209
6210    /// Arp Octaves.
6211    ///
6212    /// Offset 164, 0 to 5.
6213    #[must_use]
6214    pub fn arp_octaves(&self) -> u8 {
6215        self.get(ParamId::ArpOctaves)
6216    }
6217
6218    /// Sets Arp Octaves, clamped to 0 to 5.
6219    pub fn set_arp_octaves(&mut self, value: u8) {
6220        self.set_clamped(ParamId::ArpOctaves, value);
6221    }
6222
6223    /// FX Routing.
6224    ///
6225    /// Offset 165. `None` when the byte is one the table does not list,
6226    /// which is also what a program written by an older firmware reads as where
6227    /// that firmware numbered this table differently.
6228    #[must_use]
6229    pub fn fx_routing(&self) -> Option<FxRouting> {
6230        FxRouting::from_raw(self.get(ParamId::FxRouting))
6231    }
6232
6233    /// Sets FX Routing.
6234    pub fn set_fx_routing(&mut self, value: FxRouting) {
6235        self.set_clamped(ParamId::FxRouting, value.raw());
6236    }
6237
6238    /// FX 1 Type.
6239    ///
6240    /// Offset 166. `None` when the byte is one the table does not list,
6241    /// which is also what a program written by an older firmware reads as where
6242    /// that firmware numbered this table differently.
6243    #[must_use]
6244    pub fn fx1_type(&self) -> Option<FxType> {
6245        FxType::from_raw(self.get(ParamId::Fx1Type))
6246    }
6247
6248    /// Sets FX 1 Type.
6249    pub fn set_fx1_type(&mut self, value: FxType) {
6250        self.set_clamped(ParamId::Fx1Type, value.raw());
6251    }
6252
6253    /// FX 1 Param 1.
6254    ///
6255    /// Offset 167, 0 to 255.
6256    #[must_use]
6257    pub fn fx1_param1(&self) -> u8 {
6258        self.get(ParamId::Fx1Param1)
6259    }
6260
6261    /// Sets FX 1 Param 1, clamped to 0 to 255.
6262    pub fn set_fx1_param1(&mut self, value: u8) {
6263        self.set_clamped(ParamId::Fx1Param1, value);
6264    }
6265
6266    /// FX 1 Param 2.
6267    ///
6268    /// Offset 168, 0 to 255.
6269    #[must_use]
6270    pub fn fx1_param2(&self) -> u8 {
6271        self.get(ParamId::Fx1Param2)
6272    }
6273
6274    /// Sets FX 1 Param 2, clamped to 0 to 255.
6275    pub fn set_fx1_param2(&mut self, value: u8) {
6276        self.set_clamped(ParamId::Fx1Param2, value);
6277    }
6278
6279    /// FX 1 Param 3.
6280    ///
6281    /// Offset 169, 0 to 255.
6282    #[must_use]
6283    pub fn fx1_param3(&self) -> u8 {
6284        self.get(ParamId::Fx1Param3)
6285    }
6286
6287    /// Sets FX 1 Param 3, clamped to 0 to 255.
6288    pub fn set_fx1_param3(&mut self, value: u8) {
6289        self.set_clamped(ParamId::Fx1Param3, value);
6290    }
6291
6292    /// FX 1 Param 4.
6293    ///
6294    /// Offset 170, 0 to 255.
6295    #[must_use]
6296    pub fn fx1_param4(&self) -> u8 {
6297        self.get(ParamId::Fx1Param4)
6298    }
6299
6300    /// Sets FX 1 Param 4, clamped to 0 to 255.
6301    pub fn set_fx1_param4(&mut self, value: u8) {
6302        self.set_clamped(ParamId::Fx1Param4, value);
6303    }
6304
6305    /// FX 1 Param 5.
6306    ///
6307    /// Offset 171, 0 to 255.
6308    #[must_use]
6309    pub fn fx1_param5(&self) -> u8 {
6310        self.get(ParamId::Fx1Param5)
6311    }
6312
6313    /// Sets FX 1 Param 5, clamped to 0 to 255.
6314    pub fn set_fx1_param5(&mut self, value: u8) {
6315        self.set_clamped(ParamId::Fx1Param5, value);
6316    }
6317
6318    /// FX 1 Param 6.
6319    ///
6320    /// Offset 172, 0 to 255.
6321    #[must_use]
6322    pub fn fx1_param6(&self) -> u8 {
6323        self.get(ParamId::Fx1Param6)
6324    }
6325
6326    /// Sets FX 1 Param 6, clamped to 0 to 255.
6327    pub fn set_fx1_param6(&mut self, value: u8) {
6328        self.set_clamped(ParamId::Fx1Param6, value);
6329    }
6330
6331    /// FX 1 Param 7.
6332    ///
6333    /// Offset 173, 0 to 255.
6334    #[must_use]
6335    pub fn fx1_param7(&self) -> u8 {
6336        self.get(ParamId::Fx1Param7)
6337    }
6338
6339    /// Sets FX 1 Param 7, clamped to 0 to 255.
6340    pub fn set_fx1_param7(&mut self, value: u8) {
6341        self.set_clamped(ParamId::Fx1Param7, value);
6342    }
6343
6344    /// FX 1 Param 8.
6345    ///
6346    /// Offset 174, 0 to 255.
6347    #[must_use]
6348    pub fn fx1_param8(&self) -> u8 {
6349        self.get(ParamId::Fx1Param8)
6350    }
6351
6352    /// Sets FX 1 Param 8, clamped to 0 to 255.
6353    pub fn set_fx1_param8(&mut self, value: u8) {
6354        self.set_clamped(ParamId::Fx1Param8, value);
6355    }
6356
6357    /// FX 1 Param 9.
6358    ///
6359    /// Offset 175, 0 to 255.
6360    #[must_use]
6361    pub fn fx1_param9(&self) -> u8 {
6362        self.get(ParamId::Fx1Param9)
6363    }
6364
6365    /// Sets FX 1 Param 9, clamped to 0 to 255.
6366    pub fn set_fx1_param9(&mut self, value: u8) {
6367        self.set_clamped(ParamId::Fx1Param9, value);
6368    }
6369
6370    /// FX 1 Param 10.
6371    ///
6372    /// Offset 176, 0 to 255.
6373    #[must_use]
6374    pub fn fx1_param10(&self) -> u8 {
6375        self.get(ParamId::Fx1Param10)
6376    }
6377
6378    /// Sets FX 1 Param 10, clamped to 0 to 255.
6379    pub fn set_fx1_param10(&mut self, value: u8) {
6380        self.set_clamped(ParamId::Fx1Param10, value);
6381    }
6382
6383    /// FX 1 Param 11.
6384    ///
6385    /// Offset 177, 0 to 255.
6386    #[must_use]
6387    pub fn fx1_param11(&self) -> u8 {
6388        self.get(ParamId::Fx1Param11)
6389    }
6390
6391    /// Sets FX 1 Param 11, clamped to 0 to 255.
6392    pub fn set_fx1_param11(&mut self, value: u8) {
6393        self.set_clamped(ParamId::Fx1Param11, value);
6394    }
6395
6396    /// FX 1 Param 12.
6397    ///
6398    /// Offset 178, 0 to 255.
6399    #[must_use]
6400    pub fn fx1_param12(&self) -> u8 {
6401        self.get(ParamId::Fx1Param12)
6402    }
6403
6404    /// Sets FX 1 Param 12, clamped to 0 to 255.
6405    pub fn set_fx1_param12(&mut self, value: u8) {
6406        self.set_clamped(ParamId::Fx1Param12, value);
6407    }
6408
6409    /// FX 2 Type.
6410    ///
6411    /// Offset 179. `None` when the byte is one the table does not list,
6412    /// which is also what a program written by an older firmware reads as where
6413    /// that firmware numbered this table differently.
6414    #[must_use]
6415    pub fn fx2_type(&self) -> Option<FxType> {
6416        FxType::from_raw(self.get(ParamId::Fx2Type))
6417    }
6418
6419    /// Sets FX 2 Type.
6420    pub fn set_fx2_type(&mut self, value: FxType) {
6421        self.set_clamped(ParamId::Fx2Type, value.raw());
6422    }
6423
6424    /// FX 2 Param 1.
6425    ///
6426    /// Offset 180, 0 to 255.
6427    #[must_use]
6428    pub fn fx2_param1(&self) -> u8 {
6429        self.get(ParamId::Fx2Param1)
6430    }
6431
6432    /// Sets FX 2 Param 1, clamped to 0 to 255.
6433    pub fn set_fx2_param1(&mut self, value: u8) {
6434        self.set_clamped(ParamId::Fx2Param1, value);
6435    }
6436
6437    /// FX 2 Param 2.
6438    ///
6439    /// Offset 181, 0 to 255.
6440    #[must_use]
6441    pub fn fx2_param2(&self) -> u8 {
6442        self.get(ParamId::Fx2Param2)
6443    }
6444
6445    /// Sets FX 2 Param 2, clamped to 0 to 255.
6446    pub fn set_fx2_param2(&mut self, value: u8) {
6447        self.set_clamped(ParamId::Fx2Param2, value);
6448    }
6449
6450    /// FX 2 Param 3.
6451    ///
6452    /// Offset 182, 0 to 255.
6453    #[must_use]
6454    pub fn fx2_param3(&self) -> u8 {
6455        self.get(ParamId::Fx2Param3)
6456    }
6457
6458    /// Sets FX 2 Param 3, clamped to 0 to 255.
6459    pub fn set_fx2_param3(&mut self, value: u8) {
6460        self.set_clamped(ParamId::Fx2Param3, value);
6461    }
6462
6463    /// FX 2 Param 4.
6464    ///
6465    /// Offset 183, 0 to 255.
6466    #[must_use]
6467    pub fn fx2_param4(&self) -> u8 {
6468        self.get(ParamId::Fx2Param4)
6469    }
6470
6471    /// Sets FX 2 Param 4, clamped to 0 to 255.
6472    pub fn set_fx2_param4(&mut self, value: u8) {
6473        self.set_clamped(ParamId::Fx2Param4, value);
6474    }
6475
6476    /// FX 2 Param 5.
6477    ///
6478    /// Offset 184, 0 to 255.
6479    #[must_use]
6480    pub fn fx2_param5(&self) -> u8 {
6481        self.get(ParamId::Fx2Param5)
6482    }
6483
6484    /// Sets FX 2 Param 5, clamped to 0 to 255.
6485    pub fn set_fx2_param5(&mut self, value: u8) {
6486        self.set_clamped(ParamId::Fx2Param5, value);
6487    }
6488
6489    /// FX 2 Param 6.
6490    ///
6491    /// Offset 185, 0 to 255.
6492    #[must_use]
6493    pub fn fx2_param6(&self) -> u8 {
6494        self.get(ParamId::Fx2Param6)
6495    }
6496
6497    /// Sets FX 2 Param 6, clamped to 0 to 255.
6498    pub fn set_fx2_param6(&mut self, value: u8) {
6499        self.set_clamped(ParamId::Fx2Param6, value);
6500    }
6501
6502    /// FX 2 Param 7.
6503    ///
6504    /// Offset 186, 0 to 255.
6505    #[must_use]
6506    pub fn fx2_param7(&self) -> u8 {
6507        self.get(ParamId::Fx2Param7)
6508    }
6509
6510    /// Sets FX 2 Param 7, clamped to 0 to 255.
6511    pub fn set_fx2_param7(&mut self, value: u8) {
6512        self.set_clamped(ParamId::Fx2Param7, value);
6513    }
6514
6515    /// FX 2 Param 8.
6516    ///
6517    /// Offset 187, 0 to 255.
6518    #[must_use]
6519    pub fn fx2_param8(&self) -> u8 {
6520        self.get(ParamId::Fx2Param8)
6521    }
6522
6523    /// Sets FX 2 Param 8, clamped to 0 to 255.
6524    pub fn set_fx2_param8(&mut self, value: u8) {
6525        self.set_clamped(ParamId::Fx2Param8, value);
6526    }
6527
6528    /// FX 2 Param 9.
6529    ///
6530    /// Offset 188, 0 to 255.
6531    #[must_use]
6532    pub fn fx2_param9(&self) -> u8 {
6533        self.get(ParamId::Fx2Param9)
6534    }
6535
6536    /// Sets FX 2 Param 9, clamped to 0 to 255.
6537    pub fn set_fx2_param9(&mut self, value: u8) {
6538        self.set_clamped(ParamId::Fx2Param9, value);
6539    }
6540
6541    /// FX 2 Param 10.
6542    ///
6543    /// Offset 189, 0 to 255.
6544    #[must_use]
6545    pub fn fx2_param10(&self) -> u8 {
6546        self.get(ParamId::Fx2Param10)
6547    }
6548
6549    /// Sets FX 2 Param 10, clamped to 0 to 255.
6550    pub fn set_fx2_param10(&mut self, value: u8) {
6551        self.set_clamped(ParamId::Fx2Param10, value);
6552    }
6553
6554    /// FX 2 Param 11.
6555    ///
6556    /// Offset 190, 0 to 255.
6557    #[must_use]
6558    pub fn fx2_param11(&self) -> u8 {
6559        self.get(ParamId::Fx2Param11)
6560    }
6561
6562    /// Sets FX 2 Param 11, clamped to 0 to 255.
6563    pub fn set_fx2_param11(&mut self, value: u8) {
6564        self.set_clamped(ParamId::Fx2Param11, value);
6565    }
6566
6567    /// FX 2 Param 12.
6568    ///
6569    /// Offset 191, 0 to 255.
6570    #[must_use]
6571    pub fn fx2_param12(&self) -> u8 {
6572        self.get(ParamId::Fx2Param12)
6573    }
6574
6575    /// Sets FX 2 Param 12, clamped to 0 to 255.
6576    pub fn set_fx2_param12(&mut self, value: u8) {
6577        self.set_clamped(ParamId::Fx2Param12, value);
6578    }
6579
6580    /// FX 3 Type.
6581    ///
6582    /// Offset 192. `None` when the byte is one the table does not list,
6583    /// which is also what a program written by an older firmware reads as where
6584    /// that firmware numbered this table differently.
6585    #[must_use]
6586    pub fn fx3_type(&self) -> Option<FxType> {
6587        FxType::from_raw(self.get(ParamId::Fx3Type))
6588    }
6589
6590    /// Sets FX 3 Type.
6591    pub fn set_fx3_type(&mut self, value: FxType) {
6592        self.set_clamped(ParamId::Fx3Type, value.raw());
6593    }
6594
6595    /// FX 3 Param 1.
6596    ///
6597    /// Offset 193, 0 to 255.
6598    #[must_use]
6599    pub fn fx3_param1(&self) -> u8 {
6600        self.get(ParamId::Fx3Param1)
6601    }
6602
6603    /// Sets FX 3 Param 1, clamped to 0 to 255.
6604    pub fn set_fx3_param1(&mut self, value: u8) {
6605        self.set_clamped(ParamId::Fx3Param1, value);
6606    }
6607
6608    /// FX 3 Param 2.
6609    ///
6610    /// Offset 194, 0 to 255.
6611    #[must_use]
6612    pub fn fx3_param2(&self) -> u8 {
6613        self.get(ParamId::Fx3Param2)
6614    }
6615
6616    /// Sets FX 3 Param 2, clamped to 0 to 255.
6617    pub fn set_fx3_param2(&mut self, value: u8) {
6618        self.set_clamped(ParamId::Fx3Param2, value);
6619    }
6620
6621    /// FX 3 Param 3.
6622    ///
6623    /// Offset 195, 0 to 255.
6624    #[must_use]
6625    pub fn fx3_param3(&self) -> u8 {
6626        self.get(ParamId::Fx3Param3)
6627    }
6628
6629    /// Sets FX 3 Param 3, clamped to 0 to 255.
6630    pub fn set_fx3_param3(&mut self, value: u8) {
6631        self.set_clamped(ParamId::Fx3Param3, value);
6632    }
6633
6634    /// FX 3 Param 4.
6635    ///
6636    /// Offset 196, 0 to 255.
6637    #[must_use]
6638    pub fn fx3_param4(&self) -> u8 {
6639        self.get(ParamId::Fx3Param4)
6640    }
6641
6642    /// Sets FX 3 Param 4, clamped to 0 to 255.
6643    pub fn set_fx3_param4(&mut self, value: u8) {
6644        self.set_clamped(ParamId::Fx3Param4, value);
6645    }
6646
6647    /// FX 3 Param 5.
6648    ///
6649    /// Offset 197, 0 to 255.
6650    #[must_use]
6651    pub fn fx3_param5(&self) -> u8 {
6652        self.get(ParamId::Fx3Param5)
6653    }
6654
6655    /// Sets FX 3 Param 5, clamped to 0 to 255.
6656    pub fn set_fx3_param5(&mut self, value: u8) {
6657        self.set_clamped(ParamId::Fx3Param5, value);
6658    }
6659
6660    /// FX 3 Param 6.
6661    ///
6662    /// Offset 198, 0 to 255.
6663    #[must_use]
6664    pub fn fx3_param6(&self) -> u8 {
6665        self.get(ParamId::Fx3Param6)
6666    }
6667
6668    /// Sets FX 3 Param 6, clamped to 0 to 255.
6669    pub fn set_fx3_param6(&mut self, value: u8) {
6670        self.set_clamped(ParamId::Fx3Param6, value);
6671    }
6672
6673    /// FX 3 Param 7.
6674    ///
6675    /// Offset 199, 0 to 255.
6676    #[must_use]
6677    pub fn fx3_param7(&self) -> u8 {
6678        self.get(ParamId::Fx3Param7)
6679    }
6680
6681    /// Sets FX 3 Param 7, clamped to 0 to 255.
6682    pub fn set_fx3_param7(&mut self, value: u8) {
6683        self.set_clamped(ParamId::Fx3Param7, value);
6684    }
6685
6686    /// FX 3 Param 8.
6687    ///
6688    /// Offset 200, 0 to 255.
6689    #[must_use]
6690    pub fn fx3_param8(&self) -> u8 {
6691        self.get(ParamId::Fx3Param8)
6692    }
6693
6694    /// Sets FX 3 Param 8, clamped to 0 to 255.
6695    pub fn set_fx3_param8(&mut self, value: u8) {
6696        self.set_clamped(ParamId::Fx3Param8, value);
6697    }
6698
6699    /// FX 3 Param 9.
6700    ///
6701    /// Offset 201, 0 to 255.
6702    #[must_use]
6703    pub fn fx3_param9(&self) -> u8 {
6704        self.get(ParamId::Fx3Param9)
6705    }
6706
6707    /// Sets FX 3 Param 9, clamped to 0 to 255.
6708    pub fn set_fx3_param9(&mut self, value: u8) {
6709        self.set_clamped(ParamId::Fx3Param9, value);
6710    }
6711
6712    /// FX 3 Param 10.
6713    ///
6714    /// Offset 202, 0 to 255.
6715    #[must_use]
6716    pub fn fx3_param10(&self) -> u8 {
6717        self.get(ParamId::Fx3Param10)
6718    }
6719
6720    /// Sets FX 3 Param 10, clamped to 0 to 255.
6721    pub fn set_fx3_param10(&mut self, value: u8) {
6722        self.set_clamped(ParamId::Fx3Param10, value);
6723    }
6724
6725    /// FX 3 Param 11.
6726    ///
6727    /// Offset 203, 0 to 255.
6728    #[must_use]
6729    pub fn fx3_param11(&self) -> u8 {
6730        self.get(ParamId::Fx3Param11)
6731    }
6732
6733    /// Sets FX 3 Param 11, clamped to 0 to 255.
6734    pub fn set_fx3_param11(&mut self, value: u8) {
6735        self.set_clamped(ParamId::Fx3Param11, value);
6736    }
6737
6738    /// FX 3 Param 12.
6739    ///
6740    /// Offset 204, 0 to 255.
6741    #[must_use]
6742    pub fn fx3_param12(&self) -> u8 {
6743        self.get(ParamId::Fx3Param12)
6744    }
6745
6746    /// Sets FX 3 Param 12, clamped to 0 to 255.
6747    pub fn set_fx3_param12(&mut self, value: u8) {
6748        self.set_clamped(ParamId::Fx3Param12, value);
6749    }
6750
6751    /// FX 4 Type.
6752    ///
6753    /// Offset 205. `None` when the byte is one the table does not list,
6754    /// which is also what a program written by an older firmware reads as where
6755    /// that firmware numbered this table differently.
6756    #[must_use]
6757    pub fn fx4_type(&self) -> Option<FxType> {
6758        FxType::from_raw(self.get(ParamId::Fx4Type))
6759    }
6760
6761    /// Sets FX 4 Type.
6762    pub fn set_fx4_type(&mut self, value: FxType) {
6763        self.set_clamped(ParamId::Fx4Type, value.raw());
6764    }
6765
6766    /// FX 4 Param 1.
6767    ///
6768    /// Offset 206, 0 to 255.
6769    #[must_use]
6770    pub fn fx4_param1(&self) -> u8 {
6771        self.get(ParamId::Fx4Param1)
6772    }
6773
6774    /// Sets FX 4 Param 1, clamped to 0 to 255.
6775    pub fn set_fx4_param1(&mut self, value: u8) {
6776        self.set_clamped(ParamId::Fx4Param1, value);
6777    }
6778
6779    /// FX 4 Param 2.
6780    ///
6781    /// Offset 207, 0 to 255.
6782    #[must_use]
6783    pub fn fx4_param2(&self) -> u8 {
6784        self.get(ParamId::Fx4Param2)
6785    }
6786
6787    /// Sets FX 4 Param 2, clamped to 0 to 255.
6788    pub fn set_fx4_param2(&mut self, value: u8) {
6789        self.set_clamped(ParamId::Fx4Param2, value);
6790    }
6791
6792    /// FX 4 Param 3.
6793    ///
6794    /// Offset 208, 0 to 255.
6795    #[must_use]
6796    pub fn fx4_param3(&self) -> u8 {
6797        self.get(ParamId::Fx4Param3)
6798    }
6799
6800    /// Sets FX 4 Param 3, clamped to 0 to 255.
6801    pub fn set_fx4_param3(&mut self, value: u8) {
6802        self.set_clamped(ParamId::Fx4Param3, value);
6803    }
6804
6805    /// FX 4 Param 4.
6806    ///
6807    /// Offset 209, 0 to 255.
6808    #[must_use]
6809    pub fn fx4_param4(&self) -> u8 {
6810        self.get(ParamId::Fx4Param4)
6811    }
6812
6813    /// Sets FX 4 Param 4, clamped to 0 to 255.
6814    pub fn set_fx4_param4(&mut self, value: u8) {
6815        self.set_clamped(ParamId::Fx4Param4, value);
6816    }
6817
6818    /// FX 4 Param 5.
6819    ///
6820    /// Offset 210, 0 to 255.
6821    #[must_use]
6822    pub fn fx4_param5(&self) -> u8 {
6823        self.get(ParamId::Fx4Param5)
6824    }
6825
6826    /// Sets FX 4 Param 5, clamped to 0 to 255.
6827    pub fn set_fx4_param5(&mut self, value: u8) {
6828        self.set_clamped(ParamId::Fx4Param5, value);
6829    }
6830
6831    /// FX 4 Param 6.
6832    ///
6833    /// Offset 211, 0 to 255.
6834    #[must_use]
6835    pub fn fx4_param6(&self) -> u8 {
6836        self.get(ParamId::Fx4Param6)
6837    }
6838
6839    /// Sets FX 4 Param 6, clamped to 0 to 255.
6840    pub fn set_fx4_param6(&mut self, value: u8) {
6841        self.set_clamped(ParamId::Fx4Param6, value);
6842    }
6843
6844    /// FX 4 Param 7.
6845    ///
6846    /// Offset 212, 0 to 255.
6847    #[must_use]
6848    pub fn fx4_param7(&self) -> u8 {
6849        self.get(ParamId::Fx4Param7)
6850    }
6851
6852    /// Sets FX 4 Param 7, clamped to 0 to 255.
6853    pub fn set_fx4_param7(&mut self, value: u8) {
6854        self.set_clamped(ParamId::Fx4Param7, value);
6855    }
6856
6857    /// FX 4 Param 8.
6858    ///
6859    /// Offset 213, 0 to 255.
6860    #[must_use]
6861    pub fn fx4_param8(&self) -> u8 {
6862        self.get(ParamId::Fx4Param8)
6863    }
6864
6865    /// Sets FX 4 Param 8, clamped to 0 to 255.
6866    pub fn set_fx4_param8(&mut self, value: u8) {
6867        self.set_clamped(ParamId::Fx4Param8, value);
6868    }
6869
6870    /// FX 4 Param 9.
6871    ///
6872    /// Offset 214, 0 to 255.
6873    #[must_use]
6874    pub fn fx4_param9(&self) -> u8 {
6875        self.get(ParamId::Fx4Param9)
6876    }
6877
6878    /// Sets FX 4 Param 9, clamped to 0 to 255.
6879    pub fn set_fx4_param9(&mut self, value: u8) {
6880        self.set_clamped(ParamId::Fx4Param9, value);
6881    }
6882
6883    /// FX 4 Param 10.
6884    ///
6885    /// Offset 215, 0 to 255.
6886    #[must_use]
6887    pub fn fx4_param10(&self) -> u8 {
6888        self.get(ParamId::Fx4Param10)
6889    }
6890
6891    /// Sets FX 4 Param 10, clamped to 0 to 255.
6892    pub fn set_fx4_param10(&mut self, value: u8) {
6893        self.set_clamped(ParamId::Fx4Param10, value);
6894    }
6895
6896    /// FX 4 Param 11.
6897    ///
6898    /// Offset 216, 0 to 255.
6899    #[must_use]
6900    pub fn fx4_param11(&self) -> u8 {
6901        self.get(ParamId::Fx4Param11)
6902    }
6903
6904    /// Sets FX 4 Param 11, clamped to 0 to 255.
6905    pub fn set_fx4_param11(&mut self, value: u8) {
6906        self.set_clamped(ParamId::Fx4Param11, value);
6907    }
6908
6909    /// FX 4 Param 12.
6910    ///
6911    /// Offset 217, 0 to 255.
6912    #[must_use]
6913    pub fn fx4_param12(&self) -> u8 {
6914        self.get(ParamId::Fx4Param12)
6915    }
6916
6917    /// Sets FX 4 Param 12, clamped to 0 to 255.
6918    pub fn set_fx4_param12(&mut self, value: u8) {
6919        self.set_clamped(ParamId::Fx4Param12, value);
6920    }
6921
6922    /// FX 1 Output Gain.
6923    ///
6924    /// Offset 218, 0 to 150.
6925    #[must_use]
6926    pub fn fx1_output_gain(&self) -> u8 {
6927        self.get(ParamId::Fx1OutputGain)
6928    }
6929
6930    /// Sets FX 1 Output Gain, clamped to 0 to 150.
6931    pub fn set_fx1_output_gain(&mut self, value: u8) {
6932        self.set_clamped(ParamId::Fx1OutputGain, value);
6933    }
6934
6935    /// FX 2 Output Gain.
6936    ///
6937    /// Offset 219, 0 to 150.
6938    #[must_use]
6939    pub fn fx2_output_gain(&self) -> u8 {
6940        self.get(ParamId::Fx2OutputGain)
6941    }
6942
6943    /// Sets FX 2 Output Gain, clamped to 0 to 150.
6944    pub fn set_fx2_output_gain(&mut self, value: u8) {
6945        self.set_clamped(ParamId::Fx2OutputGain, value);
6946    }
6947
6948    /// FX 3 Output Gain.
6949    ///
6950    /// Offset 220, 0 to 150.
6951    #[must_use]
6952    pub fn fx3_output_gain(&self) -> u8 {
6953        self.get(ParamId::Fx3OutputGain)
6954    }
6955
6956    /// Sets FX 3 Output Gain, clamped to 0 to 150.
6957    pub fn set_fx3_output_gain(&mut self, value: u8) {
6958        self.set_clamped(ParamId::Fx3OutputGain, value);
6959    }
6960
6961    /// FX 4 Output Gain.
6962    ///
6963    /// Offset 221, 0 to 150.
6964    #[must_use]
6965    pub fn fx4_output_gain(&self) -> u8 {
6966        self.get(ParamId::Fx4OutputGain)
6967    }
6968
6969    /// Sets FX 4 Output Gain, clamped to 0 to 150.
6970    pub fn set_fx4_output_gain(&mut self, value: u8) {
6971        self.set_clamped(ParamId::Fx4OutputGain, value);
6972    }
6973
6974    /// FX Mode.
6975    ///
6976    /// Offset 222. `None` when the byte is one the table does not list,
6977    /// which is also what a program written by an older firmware reads as where
6978    /// that firmware numbered this table differently.
6979    #[must_use]
6980    pub fn fx_mode(&self) -> Option<FxMode> {
6981        FxMode::from_raw(self.get(ParamId::FxMode))
6982    }
6983
6984    /// Sets FX Mode.
6985    pub fn set_fx_mode(&mut self, value: FxMode) {
6986        self.set_clamped(ParamId::FxMode, value.raw());
6987    }
6988
6989    /// Program Category.
6990    ///
6991    /// Offset 240. `None` when the byte is one the table does not list,
6992    /// which is also what a program written by an older firmware reads as where
6993    /// that firmware numbered this table differently.
6994    #[must_use]
6995    pub fn program_category(&self) -> Option<ProgramCategory> {
6996        ProgramCategory::from_raw(self.get(ParamId::ProgramCategory))
6997    }
6998
6999    /// Sets Program Category.
7000    pub fn set_program_category(&mut self, value: ProgramCategory) {
7001        self.set_clamped(ParamId::ProgramCategory, value.raw());
7002    }
7003
7004    /// Program Transpose.
7005    ///
7006    /// Offset 241, 80 to 176.
7007    #[must_use]
7008    pub fn program_transpose(&self) -> u8 {
7009        self.get(ParamId::ProgramTranspose)
7010    }
7011
7012    /// Sets Program Transpose, clamped to 80 to 176.
7013    pub fn set_program_transpose(&mut self, value: u8) {
7014        self.set_clamped(ParamId::ProgramTranspose, value);
7015    }
7016}