Skip to main content

nice_plug/wrapper/vst3/
subcategories.rs

1//! Subcategories for VST3 plugins. This is essentially the same thing as tags, keyword, or
2//! categories. Hosts may use these to organize plugins.
3
4/// A subcategory for a VST3 plugin. See
5/// <https://github.com/steinbergmedia/vst3_pluginterfaces/blob/bc5ff0f87aaa3cd28c114810f4f03c384421ad2c/vst/ivstaudioprocessor.h#L49-L90>
6/// for a list of all predefined subcategories. Multiple subcategories are concatenated to a string
7/// separated by pipe characters, and the total length of this string may not exceed 127 characters.
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum Vst3SubCategory {
10    // These are the main categories, every plugin should have at least one of these, I think
11    Fx,
12    Instrument,
13    Spatial,
14    // These are optional
15    Analyzer,
16    Delay,
17    Distortion,
18    Drum,
19    Dynamics,
20    Eq,
21    External,
22    Filter,
23    Generator,
24    Mastering,
25    Modulation,
26    Network,
27    Piano,
28    PitchShift,
29    Restoration,
30    Reverb,
31    Sampler,
32    Synth,
33    Tools,
34    UpDownmix,
35    // These are used for plugins that _only_ support this channel configuration, they're also
36    // optional
37    Mono,
38    Stereo,
39    Surround,
40    Ambisonics,
41    // There are also a couple special 'Only*' subcategories that convey special information about
42    // the plugin. The framework is responsible for adding these, and they shouldn't be added
43    // manually.
44    /// A non-predefined subcategory. Hosts may display this among its plugin categories.
45    Custom(&'static str),
46}
47
48impl Vst3SubCategory {
49    pub fn as_str(&self) -> &'static str {
50        match self {
51            Vst3SubCategory::Fx => "Fx",
52            Vst3SubCategory::Instrument => "Instrument",
53            Vst3SubCategory::Spatial => "Spatial",
54            Vst3SubCategory::Analyzer => "Analyzer",
55            Vst3SubCategory::Delay => "Delay",
56            Vst3SubCategory::Distortion => "Distortion",
57            Vst3SubCategory::Drum => "Drum",
58            Vst3SubCategory::Dynamics => "Dynamics",
59            Vst3SubCategory::Eq => "EQ",
60            Vst3SubCategory::External => "External",
61            Vst3SubCategory::Filter => "Filter",
62            Vst3SubCategory::Generator => "Generator",
63            Vst3SubCategory::Mastering => "Mastering",
64            Vst3SubCategory::Modulation => "Modulation",
65            Vst3SubCategory::Network => "Network",
66            Vst3SubCategory::Piano => "Piano",
67            Vst3SubCategory::PitchShift => "Pitch Shift",
68            Vst3SubCategory::Restoration => "Restoration",
69            Vst3SubCategory::Reverb => "Reverb",
70            Vst3SubCategory::Sampler => "Sampler",
71            Vst3SubCategory::Synth => "Synth",
72            Vst3SubCategory::Tools => "Tools",
73            Vst3SubCategory::UpDownmix => "Up-Downmix",
74            Vst3SubCategory::Mono => "Mono",
75            Vst3SubCategory::Stereo => "Stereo",
76            Vst3SubCategory::Surround => "Surround",
77            Vst3SubCategory::Ambisonics => "Ambisonics",
78            Vst3SubCategory::Custom(s) => {
79                crate::nice_debug_assert!(
80                    !s.contains('|'),
81                    "'{}' contains a pipe character ('|'), which is not allowed",
82                    s
83                );
84
85                s
86            }
87        }
88    }
89}