beamer_core/config.rs
1//! Shared plugin configuration.
2//!
3//! This module provides format-agnostic plugin metadata that is shared
4//! across all plugin formats (VST3, AU, CLAP, etc.).
5//!
6//! Format-specific configurations (UIDs, FourCC codes, etc.) are defined
7//! in their respective crates.
8//!
9//! # Example
10//!
11//! ```ignore
12//! use beamer_core::Config;
13//!
14//! pub static CONFIG: Config = Config::new("My Plugin")
15//! .with_vendor("My Company")
16//! .with_version("1.0.0");
17//! ```
18
19/// Format-agnostic plugin configuration.
20///
21/// Contains metadata shared across all plugin formats. Format-specific
22/// configurations (like VST3 UIDs or AU FourCC codes) are defined separately.
23#[derive(Debug, Clone)]
24pub struct Config {
25 /// Plugin name displayed in the DAW.
26 pub name: &'static str,
27
28 /// Vendor/company name.
29 pub vendor: &'static str,
30
31 /// Vendor URL.
32 pub url: &'static str,
33
34 /// Vendor email.
35 pub email: &'static str,
36
37 /// Plugin version string.
38 pub version: &'static str,
39
40 /// Whether this plugin has an editor/GUI.
41 pub has_editor: bool,
42}
43
44impl Config {
45 /// Create a new plugin configuration with default values.
46 ///
47 /// # Example
48 ///
49 /// ```ignore
50 /// pub static CONFIG: Config = Config::new("My Plugin")
51 /// .with_vendor("My Company")
52 /// .with_version(env!("CARGO_PKG_VERSION"));
53 /// ```
54 pub const fn new(name: &'static str) -> Self {
55 Self {
56 name,
57 vendor: "Unknown Vendor",
58 url: "",
59 email: "",
60 version: "1.0.0",
61 has_editor: false,
62 }
63 }
64
65 /// Set the vendor name.
66 pub const fn with_vendor(mut self, vendor: &'static str) -> Self {
67 self.vendor = vendor;
68 self
69 }
70
71 /// Set the vendor URL.
72 pub const fn with_url(mut self, url: &'static str) -> Self {
73 self.url = url;
74 self
75 }
76
77 /// Set the vendor email.
78 pub const fn with_email(mut self, email: &'static str) -> Self {
79 self.email = email;
80 self
81 }
82
83 /// Set the version string.
84 pub const fn with_version(mut self, version: &'static str) -> Self {
85 self.version = version;
86 self
87 }
88
89 /// Enable the editor/GUI.
90 pub const fn with_editor(mut self) -> Self {
91 self.has_editor = true;
92 self
93 }
94}