1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/// Maximum native factory program catalog returned by one plugin instance.
pub const MAX_FACTORY_PRESETS: usize = 4096;
/// Native factory program identity, scoped to one plugin class.
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum FactoryPresetId {
/// A program belonging to a VST3 unit and program list.
Vst3 {
/// Native unit ID owning the program list.
unit_id: i32,
/// Native program-list ID.
list_id: i32,
/// Zero-based native program index.
program_index: i32,
},
/// An Audio Unit factory preset.
AudioUnit {
/// Native Audio Unit preset number.
number: i64,
},
}
/// A named native factory preset or program.
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct FactoryPreset {
/// Format-specific selection token, scoped to the plugin class.
pub id: FactoryPresetId,
/// Native preset or program name.
pub name: String,
/// Native program-list name when the format groups factory programs.
pub group: Option<String>,
}
impl FactoryPreset {
/// A program outside any group.
#[must_use]
pub fn new(id: FactoryPresetId, name: impl Into<String>) -> FactoryPreset {
FactoryPreset {
id,
name: name.into(),
group: None,
}
}
}