pub enum Message {
Show 32 variants
Sandboxed {
mechanism: String,
},
Hello {
magic: [u8; 4],
major: u16,
minor: u16,
},
Load {
path: String,
format: PluginFormat,
class_id: Option<[u8; 16]>,
},
Configure {
rate: u32,
max_frames: u32,
in_channels: u16,
out_channels: u16,
},
Editor(EditorAction),
EditorStatus(EditorStatus),
EditorImage(EditorImage),
Prepare(ProcessingSetup),
Describe,
Features(Capabilities),
Activate,
SetState {
blob: Vec<u8>,
},
GetState,
OpenEditor {
scaling: EditorScaling,
},
OpenEditorIn {
parent: ParentWindow,
scaling: EditorScaling,
},
CloseEditor,
ListParameters {
start: u32,
count: u16,
},
Parameters {
total: u32,
entries: Vec<Parameter>,
},
SetParameter {
id: u32,
value: f64,
},
RequestError {
code: u32,
text: String,
},
Shutdown,
Scan {
path: String,
},
Loaded {
name: String,
vendor: String,
latency_frames: u32,
inputs: Vec<BusInfo>,
outputs: Vec<BusInfo>,
},
Classes {
entries: Vec<ClassInfo>,
},
LatencyChanged {
frames: u32,
},
State {
blob: Vec<u8>,
},
ParamsChanged,
Fault {
code: u32,
text: String,
},
Ack,
EditorClosed,
EditorResized {
width: u32,
height: u32,
},
ParameterEdit {
id: u32,
phase: EditPhase,
value: f64,
},
}Variants§
Sandboxed
Sent before Hello only when an OS sandbox was requested and installed.
Hello
Load
Configure
Editor(EditorAction)
EditorStatus(EditorStatus)
EditorImage(EditorImage)
Prepare(ProcessingSetup)
Describe
Features(Capabilities)
Activate
SetState
GetState
OpenEditor
Fields
§
scaling: EditorScalingOpenEditorIn
CloseEditor
ListParameters
Parameters
SetParameter
RequestError
Shutdown
Scan
Loaded
Classes
LatencyChanged
State
ParamsChanged
Fault
Ack
The reply to a request that returns no data (Configure, Activate,
SetState, OpenEditor). It carries the request’s number.
EditorClosed
The editor window was closed by the user.
EditorResized
ParameterEdit
Implementations§
Source§impl Message
impl Message
Sourcepub fn hello() -> Self
pub fn hello() -> Self
Examples found in repository?
examples/control_seeds.rs (line 13)
11fn messages() -> Vec<(&'static str, Message)> {
12 vec![
13 ("hello", Message::hello()),
14 (
15 "load",
16 Message::Load {
17 path: "plugin.vst3".into(),
18 format: PluginFormat::Vst3,
19 class_id: None,
20 },
21 ),
22 (
23 "configure",
24 Message::Configure {
25 rate: 48_000,
26 max_frames: 512,
27 in_channels: 2,
28 out_channels: 2,
29 },
30 ),
31 ("activate", Message::Activate),
32 (
33 "set-state",
34 Message::SetState {
35 blob: b"state".to_vec(),
36 },
37 ),
38 ("get-state", Message::GetState),
39 (
40 "open-editor",
41 Message::OpenEditor {
42 scaling: EditorScaling::Auto,
43 },
44 ),
45 ("shutdown", Message::Shutdown),
46 (
47 "scan",
48 Message::Scan {
49 path: "plugin.vst3".into(),
50 },
51 ),
52 (
53 "loaded",
54 Message::Loaded {
55 name: "plugin".into(),
56 vendor: "vendor".into(),
57 latency_frames: 0,
58 inputs: vec![],
59 outputs: vec![],
60 },
61 ),
62 ("classes", Message::Classes { entries: vec![] }),
63 ("latency-changed", Message::LatencyChanged { frames: 64 }),
64 (
65 "state",
66 Message::State {
67 blob: b"state".to_vec(),
68 },
69 ),
70 ("params-changed", Message::ParamsChanged),
71 (
72 "fault",
73 Message::Fault {
74 code: 1,
75 text: "fault".into(),
76 },
77 ),
78 ("ack", Message::Ack),
79 ("editor-closed", Message::EditorClosed),
80 ("close-editor", Message::CloseEditor),
81 (
82 "list-parameters",
83 Message::ListParameters { start: 0, count: 1 },
84 ),
85 (
86 "parameters",
87 Message::Parameters {
88 total: 0,
89 entries: vec![],
90 },
91 ),
92 ("set-parameter", Message::SetParameter { id: 1, value: 0.5 }),
93 (
94 "request-error",
95 Message::RequestError {
96 code: 1,
97 text: "error".into(),
98 },
99 ),
100 (
101 "prepare",
102 Message::Prepare(ProcessingSetup {
103 sample_rate: 48_000,
104 quantum: 512,
105 sample_format: SampleFormat::F32,
106 offline: false,
107 inputs: vec![],
108 outputs: vec![],
109 }),
110 ),
111 ("describe", Message::Describe),
112 ("features", Message::Features(Capabilities::default())),
113 ("editor", Message::Editor(EditorAction::Show)),
114 (
115 "editor-status",
116 Message::EditorStatus(EditorStatus {
117 platform: EditorPlatform::X11,
118 scaling: EditorScaling::Auto,
119 visible: true,
120 embedded: false,
121 width: 640,
122 height: 480,
123 scale: 1.0,
124 resize_supported: true,
125 scale_supported: true,
126 }),
127 ),
128 (
129 "editor-image",
130 Message::EditorImage(EditorImage {
131 width: 1,
132 height: 1,
133 rgba: vec![32, 64, 128, 255],
134 }),
135 ),
136 (
137 "sandboxed",
138 Message::Sandboxed {
139 mechanism: "test".into(),
140 },
141 ),
142 (
143 "open-editor-in",
144 Message::OpenEditorIn {
145 parent: ParentWindow::X11 { window: 1 },
146 scaling: EditorScaling::Auto,
147 },
148 ),
149 (
150 "editor-resized",
151 Message::EditorResized {
152 width: 640,
153 height: 480,
154 },
155 ),
156 (
157 "parameter-edit",
158 Message::ParameterEdit {
159 id: 1,
160 phase: EditPhase::Perform,
161 value: 0.5,
162 },
163 ),
164 ]
165}Sourcepub fn kind(&self) -> u16
pub fn kind(&self) -> u16
The wire kind number, for diagnostics.
Examples found in repository?
examples/control_seeds.rs (line 187)
167fn verify(directory: &Path) {
168 let mut kinds = Vec::new();
169 for entry in fs::read_dir(directory)
170 .expect("read corpus")
171 .map(Result::unwrap)
172 {
173 let path = entry.path();
174 if path.extension().and_then(|value| value.to_str()) != Some("bin") {
175 continue;
176 }
177 let bytes = fs::read(&path).expect("read seed");
178 let DecodedFrame::Known(frame) = decode_frame(&bytes).expect("seed must decode") else {
179 panic!("{} decoded as Unknown", path.display());
180 };
181 assert_eq!(
182 encode_frame(&frame).expect("re-encode seed"),
183 bytes,
184 "{}",
185 path.display()
186 );
187 kinds.push(frame.message.kind());
188 }
189 kinds.sort_unstable();
190 assert_eq!(kinds, (1_u16..=32).collect::<Vec<_>>());
191 println!(
192 "verified {} Known control seeds (kinds 1..=32)",
193 kinds.len()
194 );
195}
196
197fn main() {
198 let mut args = env::args_os().skip(1);
199 let mode = args.next().expect("mode");
200 let directory = args.next().expect("directory");
201 assert!(args.next().is_none(), "unexpected argument");
202 let directory = Path::new(&directory);
203 if mode == "generate" {
204 fs::create_dir_all(directory).expect("create output");
205 let messages = messages();
206 assert_eq!(messages.len(), 32);
207 for (expected_kind, (name, message)) in (1_u16..=32).zip(messages) {
208 assert_eq!(message.kind(), expected_kind, "{name}");
209 let bytes = encode_frame(&Frame {
210 flags: 0,
211 request: u32::from(expected_kind),
212 message,
213 })
214 .expect("encode seed");
215 assert!(
216 matches!(decode_frame(&bytes), Ok(DecodedFrame::Known(_))),
217 "{name}"
218 );
219 fs::write(
220 directory.join(format!("known-{expected_kind:02}-{name}.bin")),
221 bytes,
222 )
223 .expect("write seed");
224 }
225 } else if mode != "verify" {
226 panic!("mode must be generate or verify");
227 }
228 verify(directory);
229}Trait Implementations§
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more