comparison DPF-Prymula-audioplugins/dpf/distrho/src/xaymar-vst2/vst.h @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 // This was created from released VST2.x plugins, and is technically under the 2-clause BSD license.
2 // Depending on which country you are in, Steinberg can do fuck all about this. Notable countries for
3 // this are most members of the United States of America, the entirety of Europe, Japan, and Russia.
4 // Consult a lawyer if you don't know if clean room reverse engineering is allowed in your country.
5
6 // See README.md for all information.
7
8 // Known additional information:
9 // - Function call standard seems to be stdcall.
10 // - Everything is aligned to 8 bytes.
11
12 // VST Versioning:
13 // - Base-10, thus can't store many version numbers.
14 // - Always four components, with the major one being able to store the most numbers.
15 // - Format is A...ABCD, so 1.2.3.4 would turn into 1234.
16
17 #pragma once
18 #ifndef VST2SDK_VST_H
19 #define VST2SDK_VST_H
20
21 #define VST_FUNCTION_INTERFACE __cdecl
22 #define VST_ALIGNMENT 8
23 #define VST_MAGICNUMBER 'VstP'
24
25 // Common VST buffer lengths:
26 // 8: OpCodes(GetLabel, GetName, GetValue)
27 #define VST_BUFFER_8 8
28 // 16:
29 #define VST_BUFFER_16 16
30 // 24: OpCodes?
31 #define VST_BUFFER_24 24
32 // 32: OpCodes(EffectName)
33 #define VST_BUFFER_32 32
34 #define VST_EFFECT_BUFFER_SIZE 32
35 // 64: OpCodes(ProductName, VendorName)
36 #define VST_BUFFER_64 64
37 #define VST_VENDOR_BUFFER_SIZE VST_BUFFER_64
38 #define VST_PRODUCT_BUFFER_SIZE VST_BUFFER_64
39 #define VST_NAME_BUFFER_SIZE VST_BUFFER_64
40 // 100:
41 #define VST_BUFFER_100 100
42
43 #define VST_MAX_CHANNELS 32 // Couldn't find any audio editing software which would attempt to add more channels.
44
45 #pragma pack(push, VST_ALIGNMENT)
46
47 #ifdef __cplusplus
48 #ifdef DISTRHO_PROPER_CPP11_SUPPORT
49 #include <cinttypes>
50 #else
51 #include <inttypes.h>
52 #endif
53 extern "C" {
54 #else
55 #include <inttypes.h>
56 #endif
57
58 /*******************************************************************************
59 |* Enumeration
60 |*/
61 enum VST_VERSION {
62 VST_VERSION_1 = 0, // Anything before 2.0, used by official plug-ins.
63 VST_VERSION_1_0_0_0 = 1000, // 1.0, used by some third-party plug-ins.
64 VST_VERSION_1_1_0_0 = 1100, // 1.1, used by some third-party plug-ins.
65 VST_VERSION_2 = 2, // 2.0, used by official plug-ins.
66 VST_VERSION_2_0_0_0 = 2000, // 2.0, used by some third-party plug-ins.
67 VST_VERSION_2_1_0_0 = 2100, // 2.1
68 VST_VERSION_2_2_0_0 = 2200, // 2.2
69 VST_VERSION_2_3_0_0 = 2300, // 2.3
70 VST_VERSION_2_4_0_0 = 2400, // 2.4
71
72 // Pad to force 32-bit number.
73 _VST_VERSION_PAD = 0xFFFFFFFFul,
74 };
75
76 enum VST_CATEGORY {
77 VST_CATEGORY_UNCATEGORIZED = 0x00,
78 VST_CATEGORY_01 = 0x01,
79 VST_CATEGORY_02 = 0x02,
80 VST_CATEGORY_03 = 0x03,
81 VST_CATEGORY_04 = 0x04,
82 VST_CATEGORY_05 = 0x05,
83 VST_CATEGORY_06 = 0x06,
84 VST_CATEGORY_07 = 0x07,
85 VST_CATEGORY_RESTORATION = 0x08, // Denoising and similar effects.
86 VST_CATEGORY_09 = 0x09,
87 VST_CATEGORY_CONTAINER = 0x0A, // Plugin contains more than one Plugin.
88 VST_CATEGORY_0B = 0x0B,
89 VST_CATEGORY_MAX, // Not part of specification, marks maximum category.
90
91 // Pad to force 32-bit number.
92 _VST_CATEGORY_PAD = 0xFFFFFFFFul,
93 };
94
95 enum VST_EFFECT_OPCODE {
96 /* Create/Initialize the effect (if it has not been created already).
97 *
98 * @return Always 0.
99 */
100 VST_EFFECT_OPCODE_00 = 0x00,
101 VST_EFFECT_OPCODE_CREATE = 0x00,
102 VST_EFFECT_OPCODE_INITIALIZE = 0x00,
103
104 /* Destroy the effect (if there is any) and free its memory.
105 *
106 * This should destroy the actual object created by VST_ENTRYPOINT.
107 *
108 * @return Always 0.
109 */
110 VST_EFFECT_OPCODE_01 = 0x01,
111 VST_EFFECT_OPCODE_DESTROY = 0x01,
112
113 /* Set Program
114 *
115 *
116 */
117 VST_EFFECT_OPCODE_02 = 0x02,
118
119 /* Get Program
120 *
121 *
122 */
123 VST_EFFECT_OPCODE_03 = 0x03,
124
125 /* Set Program Name
126 *
127 *
128 */
129 VST_EFFECT_OPCODE_04 = 0x04,
130
131 /* Get Program Name
132 *
133 * "Returns 0. If ptr is valid, sets the first byte of ptr to 0 then returns 0."
134 */
135 VST_EFFECT_OPCODE_05 = 0x05,
136
137 /* Get the value? label for the parameter.
138 *
139 * @param p_int1 Parameter index.
140 * @param p_ptr 'char[8]'
141 * @return 0 on success, 1 on failure.
142 */
143 VST_EFFECT_OPCODE_06 = 0x06,
144 VST_EFFECT_OPCODE_PARAM_GETLABEL = 0x06,
145
146 /* Get the string value for the parameter.
147 *
148 * @param p_int1 Parameter index.
149 * @param p_ptr 'char[8]'
150 * @return 0 on success, 1 on failure.
151 */
152 VST_EFFECT_OPCODE_07 = 0x07,
153 VST_EFFECT_OPCODE_PARAM_GETVALUE = 0x07,
154
155 /* Get the name for the parameter.
156 *
157 * @param p_int1 Parameter index.
158 * @param p_ptr 'char[8]'
159 * @return 0 on success, 1 on failure.
160 */
161 VST_EFFECT_OPCODE_08 = 0x08,
162 VST_EFFECT_OPCODE_PARAM_GETNAME = 0x08,
163
164 /*
165 *
166 *
167 */
168 VST_EFFECT_OPCODE_09 = 0x09,
169
170 /* Set the new sample rate for the plugin to use.
171 *
172 * @param p_float New sample rate as a float (double on 64-bit because register upgrades).
173 */
174 VST_EFFECT_OPCODE_0A = 0x0A,
175 VST_EFFECT_OPCODE_SETSAMPLERATE = 0x0A,
176 VST_EFFECT_OPCODE_SET_SAMPLE_RATE = 0x0A,
177
178 /* Sets the block size, which is the maximum number of samples passed into the effect via process calls.
179 *
180 * @param p_int2 The maximum number of samples to be passed in.
181 */
182 VST_EFFECT_OPCODE_0B = 0x0B,
183 VST_EFFECT_OPCODE_SETBLOCKSIZE = 0x0B,
184 VST_EFFECT_OPCODE_SET_BLOCK_SIZE = 0x0B,
185
186 /* Effect processing should be suspended/paused.
187 *
188 * Unclear if this is should result in a flush of buffers.
189 *
190 * @param p_int2 0 if the effect should suspend processing, 1 if it should resume.
191 */
192 VST_EFFECT_OPCODE_0C = 0x0C,
193 VST_EFFECT_OPCODE_SUSPEND = 0x0C,
194
195 /* Retrieve the client rect size of the plugins window.
196 * If no window has been created, returns the default rect.
197 *
198 * @param p_ptr Pointer of type 'struct vst_rect*'.
199 * @return On success, returns 1 and updates p_ptr to the rect. On failure, returns 0.
200 */
201 VST_EFFECT_OPCODE_0D = 0x0D,
202 VST_EFFECT_OPCODE_WINDOW_GETRECT = 0x0D,
203
204 /* Create the window for the plugin.
205 *
206 * @param p_ptr HWND of the parent window.
207 * @return 0 on failure, or HWND on success.
208 */
209 VST_EFFECT_OPCODE_0E = 0x0E,
210 VST_EFFECT_OPCODE_WINDOW_CREATE = 0x0E,
211
212 /* Destroy the plugins window.
213 *
214 * @return Always 0.
215 */
216 VST_EFFECT_OPCODE_0F = 0x0F,
217 VST_EFFECT_OPCODE_WINDOW_DESTROY = 0x0F,
218
219 /*
220 *
221 *
222 */
223 VST_EFFECT_OPCODE_10 = 0x10,
224
225 /*
226 *
227 *
228 */
229 VST_EFFECT_OPCODE_11 = 0x11,
230
231 /*
232 *
233 *
234 */
235 VST_EFFECT_OPCODE_12 = 0x12,
236
237 /*
238 *
239 *
240 */
241 VST_EFFECT_OPCODE_13 = 0x13,
242
243 /*
244 *
245 *
246 */
247 VST_EFFECT_OPCODE_14 = 0x14,
248
249 /*
250 *
251 *
252 */
253 VST_EFFECT_OPCODE_15 = 0x15,
254
255 /* Always returns the FourCC 'NvEF' (0x4E764566).
256 */
257 VST_EFFECT_OPCODE_16 = 0x16,
258
259 /* Get Chunk
260 *
261 *
262 */
263 VST_EFFECT_OPCODE_17 = 0x17,
264
265 /* Set Chunk
266 *
267 *
268 */
269 VST_EFFECT_OPCODE_18 = 0x18,
270
271 // VST2.x starts here.
272
273 /*
274 *
275 *
276 */
277 VST_EFFECT_OPCODE_19 = 0x19,
278
279 /* Can the parameter be automated?
280 *
281 * @param p_int1 Index of the parameter.
282 * @return 1 if the parameter can be automated, otherwise 0.
283 */
284 VST_EFFECT_OPCODE_1A = 0x1A,
285 VST_EFFECT_OPCODE_PARAM_ISAUTOMATABLE = 0x1A,
286
287 /*
288 *
289 *
290 */
291 VST_EFFECT_OPCODE_1B = 0x1B,
292
293 /*
294 *
295 *
296 */
297 VST_EFFECT_OPCODE_1C = 0x1C,
298
299 /*
300 *
301 *
302 */
303 VST_EFFECT_OPCODE_1D = 0x1D, // See VST_EFFECT_OPCODE_05
304
305 /*
306 *
307 *
308 */
309 VST_EFFECT_OPCODE_1E = 0x1E,
310
311 /* Input connected.
312 *
313 *
314 */
315 VST_EFFECT_OPCODE_1F = 0x1F,
316
317 /* Input disconnected.
318 *
319 *
320 */
321 VST_EFFECT_OPCODE_20 = 0x20,
322
323 /* Retrieve the name of the input channel at the given index.
324 *
325 * @param p_int1 Index of the input to get the name for.
326 * @param p_ptr Pointer to a char* buffer able to hold at minimum 20 characters. Might need to be 32 even.
327 * @return 0 on failure, 1 on success.
328 */
329 VST_EFFECT_OPCODE_21 = 0x21,
330 VST_EFFECT_OPCODE_INPUT_GETCHANNELNAME = 0x21,
331 VST_EFFECT_OPCODE_INPUT_CHANNEL_NAME = 0x21,
332
333 /* Retrieve the name of the output channel at the given index.
334 *
335 * @param p_int1 Index of the output to get the name for.
336 * @param p_ptr Pointer to a char* buffer able to hold at minimum 20 characters. Might need to be 32 even.
337 * @return 0 on failure, 1 on success.
338 */
339 VST_EFFECT_OPCODE_22 = 0x22,
340 VST_EFFECT_OPCODE_OUTPUT_GETCHANNELNAME = 0x22,
341 VST_EFFECT_OPCODE_OUTPUT_CHANNEL_NAME = 0x22,
342
343 /* Retrieve category of this effect.
344 *
345 * @return The category that this effect is in, see VST_CATEGORY.
346 */
347 VST_EFFECT_OPCODE_23 = 0x23,
348 VST_EFFECT_OPCODE_EFFECT_CATEGORY = 0x23,
349
350 /*
351 *
352 *
353 */
354 VST_EFFECT_OPCODE_24 = 0x24,
355
356 /*
357 *
358 *
359 */
360 VST_EFFECT_OPCODE_25 = 0x25,
361
362 /*
363 *
364 *
365 */
366 VST_EFFECT_OPCODE_26 = 0x26,
367
368 /*
369 *
370 *
371 */
372 VST_EFFECT_OPCODE_27 = 0x27,
373
374 /*
375 *
376 *
377 */
378 VST_EFFECT_OPCODE_28 = 0x28,
379
380 /*
381 *
382 *
383 */
384 VST_EFFECT_OPCODE_29 = 0x29,
385
386 /* Set the speaker arrangement
387 *
388 * @param p_int2 (vst_speaker_arrangement*) Pointer to a pointer to the speaker arrangement for the input.
389 * @param p_ptr (vst_speaker_arrangement*) Pointer to a pointer to the speaker arrangement for the output.
390 */
391 VST_EFFECT_OPCODE_2A = 0x2A,
392 VST_EFFECT_OPCODE_SET_SPEAKER_ARRANGEMENT = 0x2A,
393
394 /*
395 *
396 *
397 */
398 VST_EFFECT_OPCODE_2B = 0x2B,
399
400 /* Enable/Disable bypassing the effect.
401 *
402 * @param p_int2 Zero if bypassing the effect is disabled, otherwise 1.
403 */
404 VST_EFFECT_OPCODE_2C = 0x2C,
405 VST_EFFECT_OPCODE_BYPASS = 0x2C,
406
407 /* Retrieve the effect name into the ptr buffer.
408 *
409 * @param p_ptr char[64] Buffer containing a zero-terminated effect information string. May be shorter than 64 bytes on older hosts.
410 * @return Always 0, even on failure.
411 */
412 VST_EFFECT_OPCODE_2D = 0x2D,
413 VST_EFFECT_OPCODE_GETNAME = 0x2D,
414 VST_EFFECT_OPCODE_EFFECT_NAME = 0x2D,
415
416 /* Translate an error code to a string.
417 *
418 * @param p_ptr char[256] Buffer that should contain a zero-terminated error string.
419 */
420 VST_EFFECT_OPCODE_2E = 0x2E,
421 VST_EFFECT_OPCODE_TRANSLATE_ERROR = 0x2E,
422
423 /* Retrieve the vendor name into the ptr buffer.
424 *
425 * @param p_ptr char[64] Buffer containing a zero-terminated vendor information string. May be shorter than 64 bytes on older hosts.
426 * @return Always 0, even on failure.
427 */
428 VST_EFFECT_OPCODE_2F = 0x2F,
429 VST_EFFECT_OPCODE_GETVENDOR = 0x2F,
430 VST_EFFECT_OPCODE_VENDOR_NAME = 0x2F,
431
432 /* See VST_EFFECT_OPCODE_GETNAME
433 *
434 * Rarely used, if at all even supported. Not sure what the purpose of this is even.
435 */
436 VST_EFFECT_OPCODE_30 = 0x30,
437 VST_EFFECT_OPCODE_GETNAME2 = 0x30,
438 VST_EFFECT_OPCODE_PRODUCT_NAME = 0x30,
439
440 /* Retrieve the vendor version in return value.
441 *
442 * @return Version.
443 */
444 VST_EFFECT_OPCODE_31 = 0x31,
445 VST_EFFECT_OPCODE_GETVENDORVERSION = 0x31,
446 VST_EFFECT_OPCODE_VENDOR_VERSION = 0x31,
447
448 /* User defined OP Code, for custom interaction.
449 *
450 */
451 VST_EFFECT_OPCODE_32 = 0x32,
452 VST_EFFECT_OPCODE_CUSTOM = 0x32,
453
454 /* Test for support of a specific named feature.
455 *
456 * @param p_ptr Pointer to a zero-terminated buffer containing the feature name.
457 * @return Non-zero if the feature is supported, otherwise 0.
458 */
459 VST_EFFECT_OPCODE_33 = 0x33,
460 VST_EFFECT_OPCODE_SUPPORTS = 0x33,
461
462 /* Number of samples that are at the tail at the end of playback.
463 *
464 * @return 0 or 1 for no tail, > 1 for number of samples to tail.
465 */
466 VST_EFFECT_OPCODE_34 = 0x34,
467 VST_EFFECT_OPCODE_GETTAILSAMPLES = 0x34,
468 VST_EFFECT_OPCODE_TAIL_SAMPLES = 0x34,
469
470 /*
471 *
472 *
473 */
474 VST_EFFECT_OPCODE_35 = 0x35,
475
476 /*
477 *
478 *
479 */
480 VST_EFFECT_OPCODE_36 = 0x36,
481
482 /*
483 *
484 *
485 */
486 VST_EFFECT_OPCODE_37 = 0x37,
487
488 /*
489 *
490 *
491 */
492 VST_EFFECT_OPCODE_38 = 0x38,
493
494 /* Parameter Properties
495 *
496 * @param p_ptr vst_parameter_properties*
497 * @return 1 if supported, otherwise 0.
498 */
499 VST_EFFECT_OPCODE_39 = 0x39,
500 VST_EFFECT_OPCODE_GET_PARAMETER_PROPERTIES = VST_EFFECT_OPCODE_39,
501
502 /* Retrieve the VST Version supported.
503 *
504 * @return Return 0 for <2.0, 2 for 2.0, 2100 for 2.1, 2200 for 2.2, 2300 for 2.3, etc.
505 */
506 VST_EFFECT_OPCODE_3A = 0x3A,
507 VST_EFFECT_OPCODE_VST_VERSION = 0x3A,
508
509 // VST 2.1 or later
510
511 /*
512 *
513 *
514 */
515 VST_EFFECT_OPCODE_3B = 0x3B,
516
517 /*
518 *
519 *
520 */
521 VST_EFFECT_OPCODE_3C = 0x3C,
522
523 /*
524 *
525 *
526 */
527 VST_EFFECT_OPCODE_3D = 0x3D,
528
529 /*
530 *
531 *
532 */
533 VST_EFFECT_OPCODE_3E = 0x3E,
534
535 /*
536 *
537 *
538 */
539 VST_EFFECT_OPCODE_3F = 0x3F,
540
541 /*
542 *
543 *
544 */
545 VST_EFFECT_OPCODE_40 = 0x40,
546
547 /*
548 *
549 *
550 */
551 VST_EFFECT_OPCODE_41 = 0x41,
552
553 /*
554 *
555 *
556 */
557 VST_EFFECT_OPCODE_42 = 0x42,
558
559 /*
560 *
561 *
562 */
563 VST_EFFECT_OPCODE_43 = 0x43,
564
565 /*
566 *
567 *
568 */
569 VST_EFFECT_OPCODE_44 = 0x44,
570
571 // VST 2.3 or later
572
573 /* Retrieve the speaker arrangement.
574 *
575 * @param p_int2 (vst_speaker_arrangement**) Pointer to a pointer to the speaker arrangement for the input.
576 * @param p_ptr (vst_speaker_arrangement**) Pointer to a pointer to the speaker arrangement for the output.
577 */
578 VST_EFFECT_OPCODE_45 = 0x45,
579 VST_EFFECT_OPCODE_GET_SPEAKER_ARRANGEMENT = 0x45,
580
581 /*
582 *
583 *
584 */
585 VST_EFFECT_OPCODE_46 = 0x46,
586
587 /* Begin processing of audio.
588 *
589 *
590 *
591 */
592 VST_EFFECT_OPCODE_PROCESS_BEGIN = 0x47,
593
594 /* End processing of audio.
595 *
596 *
597 *
598 */
599 VST_EFFECT_OPCODE_PROCESS_END = 0x48,
600
601 /*
602 *
603 *
604 */
605 VST_EFFECT_OPCODE_49 = 0x49,
606
607 /*
608 *
609 *
610 */
611 VST_EFFECT_OPCODE_4A = 0x4A,
612
613 /*
614 *
615 *
616 */
617 VST_EFFECT_OPCODE_4B = 0x4B,
618
619 /*
620 *
621 *
622 */
623 VST_EFFECT_OPCODE_4C = 0x4C,
624
625 // VST 2.4 or later
626
627 /*
628 *
629 *
630 */
631 VST_EFFECT_OPCODE_4D = 0x4D,
632
633 /*
634 *
635 *
636 */
637 VST_EFFECT_OPCODE_4E = 0x4E,
638
639 /*
640 *
641 *
642 */
643 VST_EFFECT_OPCODE_4F = 0x4F,
644
645 // Highest number of known OPCODE.
646 VST_EFFECT_OPCODE_MAX,
647
648 // Pad to force 32-bit number.
649 _VST_EFFECT_OPCODE_PAD = 0xFFFFFFFFul,
650 };
651
652 enum VST_HOST_OPCODE {
653 /*
654 * @param int1 -1 or Parameter Index
655 * @return Expected to return... something.
656 */
657 VST_HOST_OPCODE_00 = 0x00, // cb(vst, 0x00, ?, 0, 0);
658 VST_HOST_OPCODE_01 = 0x01,
659 VST_HOST_OPCODE_02 = 0x02, // bool cb(0, 0x02, 0, 0, 0);
660 VST_HOST_OPCODE_03 = 0x03,
661 VST_HOST_OPCODE_04 = 0x04,
662 VST_HOST_OPCODE_05 = 0x05,
663 VST_HOST_OPCODE_06 = 0x06,
664 VST_HOST_OPCODE_07 = 0x07,
665 VST_HOST_OPCODE_08 = 0x08,
666 VST_HOST_OPCODE_09 = 0x09,
667 VST_HOST_OPCODE_0A = 0x0A,
668 VST_HOST_OPCODE_0B = 0x0B,
669 VST_HOST_OPCODE_0C = 0x0C,
670 VST_HOST_OPCODE_0D = 0x0D,
671 VST_HOST_OPCODE_0E = 0x0E,
672 VST_HOST_OPCODE_0F = 0x0F,
673 VST_HOST_OPCODE_10 = 0x10,
674 VST_HOST_OPCODE_11 = 0x11,
675 VST_HOST_OPCODE_12 = 0x12,
676 VST_HOST_OPCODE_13 = 0x13,
677 VST_HOST_OPCODE_14 = 0x14,
678 VST_HOST_OPCODE_15 = 0x15,
679 VST_HOST_OPCODE_16 = 0x16,
680 VST_HOST_OPCODE_17 = 0x17,
681 VST_HOST_OPCODE_18 = 0x18,
682 VST_HOST_OPCODE_19 = 0x19,
683 VST_HOST_OPCODE_1A = 0x1A,
684 VST_HOST_OPCODE_1B = 0x1B,
685 VST_HOST_OPCODE_1C = 0x1C,
686 VST_HOST_OPCODE_1D = 0x1D,
687 VST_HOST_OPCODE_1E = 0x1E,
688 VST_HOST_OPCODE_1F = 0x1F,
689 VST_HOST_OPCODE_20 = 0x20,
690 VST_HOST_OPCODE_21 = 0x21,
691 VST_HOST_OPCODE_22 = 0x22,
692 VST_HOST_OPCODE_23 = 0x23,
693 VST_HOST_OPCODE_24 = 0x24,
694 VST_HOST_OPCODE_25 = 0x25,
695 VST_HOST_OPCODE_26 = 0x26,
696 VST_HOST_OPCODE_27 = 0x27,
697 VST_HOST_OPCODE_28 = 0x28,
698 VST_HOST_OPCODE_29 = 0x29,
699 VST_HOST_OPCODE_2A = 0x2A,
700
701 /* Parameter gained focus.
702 *
703 * @param int1 Parameter index.
704 */
705 VST_HOST_OPCODE_2B = 0x2B,
706
707 /* Parameter lost focus.
708 *
709 * @param int1 Parameter index.
710 */
711 VST_HOST_OPCODE_2C = 0x2C,
712
713 VST_HOST_OPCODE_2D = 0x2D,
714 VST_HOST_OPCODE_2E = 0x2E,
715 VST_HOST_OPCODE_2F = 0x2F,
716
717 // Highest number of known OPCODE.
718 VST_HOST_OPCODE_MAX,
719
720 // Pad to force 32-bit number.
721 _VST_HOST_OPCODE_PAD = 0xFFFFFFFFul,
722 };
723
724 enum VST_ARRANGEMENT_TYPE {
725 /* Custom speaker arrangement.
726 *
727 * Accidentally discovered through random testing.
728 */
729 VST_ARRANGEMENT_TYPE_CUSTOM = -2,
730
731 /* Unknown/Empty speaker layout.
732 *
733 */
734 VST_ARRANGEMENT_TYPE_UNKNOWN = -1,
735
736 /* Mono
737 */
738 VST_ARRANGEMENT_TYPE_MONO = 0,
739
740 /* Stereo
741 */
742 VST_ARRANGEMENT_TYPE_STEREO = 1,
743
744 /* 5.1
745 */
746 VST_ARRANGEMENT_TYPE_5_1 = 0x0F,
747
748 // Pad to force 32-bit number.
749 _VST_ARRANGEMENT_TYPE_PAD = 0xFFFFFFFFul,
750 };
751
752 enum VST_SPEAKER_TYPE {
753 VST_SPEAKER_TYPE_MONO = 0,
754 VST_SPEAKER_TYPE_LEFT = 1,
755 VST_SPEAKER_TYPE_RIGHT = 2,
756 VST_SPEAKER_TYPE_CENTER = 3,
757 VST_SPEAKER_TYPE_LFE = 4,
758 VST_SPEAKER_TYPE_LEFT_SIDE = 5,
759 VST_SPEAKER_TYPE_RIGHT_SIDE = 6,
760
761 // Pad to force 32-bit number.
762 _VST_SPEAKER_TYPE_PAD = 0xFFFFFFFFul,
763 };
764
765 enum VST_PARAMETER_FLAGS {
766 /**
767 * Parameter is an on/off switch.
768 */
769 VST_PARAMETER_FLAGS_SWITCH = 1,
770 /**
771 * Limits defined by integers.
772 */
773 VST_PARAMETER_FLAGS_INTEGER_LIMITS = 1 << 1,
774 /**
775 * Uses float steps.
776 */
777 VST_PARAMETER_FLAGS_STEP_FLOAT = 1 << 2,
778 /**
779 * Uses integer steps.
780 */
781 VST_PARAMETER_FLAGS_STEP_INT = 1 << 3,
782 /**
783 * Respect index variable for display ordering.
784 */
785 VST_PARAMETER_FLAGS_INDEX = 1 << 4,
786 /**
787 * Respect category value and names.
788 */
789 VST_PARAMETER_FLAGS_CATEGORY = 1 << 5,
790 VST_PARAMETER_FLAGS_UNKNOWN6 = 1 << 6,
791 _VST_PARAMETER_FLAGS_PAD = 0xFFFFFFFFul,
792 };
793
794 /*******************************************************************************
795 |* Structures
796 |*/
797
798 struct vst_rect {
799 int16_t top;
800 int16_t left;
801 int16_t bottom;
802 int16_t right;
803 };
804
805 struct vst_effect {
806 int32_t magic_number; // Should always be VST_MAGICNUMBER
807
808 // 64-bit adds 4-byte padding here to align pointers.
809
810 /* Control the VST through an opcode and up to four parameters.
811 *
812 * @param this Pointer to the effect itself.
813 * @param opcode The opcode to run, see VST_EFFECT_OPCODES.
814 * @param p_int1 Parameter, see VST_EFFECT_OPCODES.
815 * @param p_int2 Parameter, see VST_EFFECT_OPCODES.
816 * @param p_ptr Parameter, see VST_EFFECT_OPCODES.
817 * @param p_float Parameter, see VST_EFFECT_OPCODES.
818 */
819 intptr_t(VST_FUNCTION_INTERFACE* control)(vst_effect* pthis, VST_EFFECT_OPCODE opcode, int32_t p_int1,
820 intptr_t p_int2, void* p_ptr, float p_float);
821
822 /* Process the given number of samples in inputs and outputs.
823 *
824 * Different to process_float how? Never seen any difference.
825 *
826 * @param pthis Pointer to the effect itself.
827 * @param inputs Pointer to an array of 'const float[samples]' with size numInputs.
828 * @param outputs Pointer to an array of 'float[samples]' with size numOutputs.
829 * @param samples Number of samples per channel in inputs.
830 */
831 void(VST_FUNCTION_INTERFACE* process)(vst_effect* pthis, const float* const* inputs, float** outputs,
832 int32_t samples);
833
834 /* Updates the value for the parameter at the given index, or does nothing if out of bounds.
835 *
836 * @param pthis Pointer to the effect itself.
837 * @param index Parameter index.
838 * @param value New value for the parameter.
839 */
840 void(VST_FUNCTION_INTERFACE* set_parameter)(vst_effect* pthis, uint32_t index, float value);
841
842 /* Returns the value stored for the parameter at index, or 0 if out of bounds.
843 *
844 * @param pthis Pointer to the effect itself.
845 * @param index Parameter index.
846 * @return float Value of the parameter.
847 */
848 float(VST_FUNCTION_INTERFACE* get_parameter)(vst_effect* pthis, uint32_t index);
849
850 int32_t num_programs; // Number of possible programs.
851 int32_t num_params; // Number of possible parameters.
852 int32_t num_inputs; // Number of inputs.
853 int32_t num_outputs; // Number of outputs.
854
855 /* Bitflags
856 *
857 * Bit Description
858 * 1 Effect has "Editor"
859 * 2 Unknown (Found in: ReaDelay)
860 * 3 Unknown (Found in: ReaDelay)
861 * 4 Unknown (Found in: ReaDelay)
862 * 5 Has process_float (Found in: ReaDelay, ReaComp, ReaControlMIDI, ReaStream, ReaFir)
863 * 6 Unknown (Found in: ReaControlMIDI, ReaStream, ReaFir)
864 * 10 Unknown (Found in: ReaFir)
865 * 13 Has process_double (Found in: ReaControlMIDI)
866 */
867 int32_t flags;
868
869 // 64-bit adds 4-byte padding here to align pointers.
870
871 void* _unknown_ptr_00[2];
872
873 /* Initial delay before processing of samples can actually begin in Samples.
874 *
875 * Should be updated before or during handling the 0x47 control call.
876 */
877 int32_t delay;
878
879 int32_t _unknown_int32_00[2]; // Unknown int32_t values.
880 float _unknown_float_00; // Seems to always be 1.0
881
882 void* effect_internal; // Pointer to Plugin internal data
883 void* host_internal; // Pointer to Host internal data.
884
885 /* Id of the plugin.
886 *
887 * Due to this not being enough for uniqueness, it should not be used alone
888 * for indexing. Ideally you want to index like this:
889 * [unique_id][module_name][version][flags]
890 * If any of the checks after unique_id fail, you default to the first
891 * possible choice.
892 */
893 int32_t unique_id;
894
895 /* Plugin version
896 *
897 * Unrelated to the minimum VST Version, but often the same.
898 */
899 int32_t version;
900
901 // There is no padding here if everything went right.
902
903 /* Process the given number of single samples in inputs and outputs.
904 *
905 * @param pthis Pointer to the effect itself.
906 * @param inputs Pointer to an array of 'const float[samples]' with size numInputs.
907 * @param outputs Pointer to an array of 'float[samples]' with size numOutputs.
908 * @param samples Number of samples per channel in inputs.
909 */
910 void(VST_FUNCTION_INTERFACE* process_float)(vst_effect* pthis, const float* const* inputs, float** outputs,
911 int32_t samples);
912
913 /* Process the given number of double samples in inputs and outputs.
914 *
915 * Used only by 2.4 hosts and plugins, possibly restricted to said version.
916 *
917 * @param pthis Pointer to the effect itself.
918 * @param inputs Pointer to an array of 'const double[samples]' with size numInputs.
919 * @param outputs Pointer to an array of 'double[samples]' with size numOutputs.
920 * @param samples Number of samples per channel in inputs.
921 */
922 void(VST_FUNCTION_INTERFACE* process_double)(vst_effect* pthis, const double* const* inputs, double** outputs,
923 int32_t samples);
924
925 // Everything after this is unknown and was present in reacomp-standalone.dll.
926 uint8_t _unknown[56]; // 56-bytes of something. Could also just be 52-bytes.
927 };
928
929 struct vst_parameter_properties {
930 float step_f32;
931 float step_small_f32;
932 float step_large_f32;
933
934 char name[VST_BUFFER_64];
935
936 uint32_t flags;
937 int32_t min_value_i32;
938 int32_t max_value_i32;
939 int32_t step_i32;
940
941 char label[VST_BUFFER_8];
942
943 uint16_t index;
944
945 uint16_t category;
946 uint16_t num_parameters_in_category;
947 uint16_t _unknown_00;
948
949 char category_label[VST_BUFFER_24];
950
951 char _unknown_01[VST_BUFFER_16];
952 };
953
954 struct vst_speaker_properties {
955 float _unknown_00; // 10.0 if LFE, otherwise random? Never exceeds -PI to PI range.
956 float _unknown_04; // 10.0 if LFE, otherwise random? Never exceeds -PI to PI range.
957 float _unknown_08; // 0.0 if LFE, otherwise 1.0.
958 float _unknown_0C;
959 char name[VST_BUFFER_64];
960 VST_SPEAKER_TYPE type;
961
962 uint8_t _unknown[28]; // Padding detected from testing.
963 };
964
965 struct vst_speaker_arrangement {
966 VST_ARRANGEMENT_TYPE type; // See VST_SPEAKER_ARRANGEMENT_TYPE
967 int32_t channels; // Number of channels in speakers.
968 vst_speaker_properties speakers[VST_MAX_CHANNELS]; // Array of speaker properties, actual size defined by channels.
969 };
970
971 /* Callback used by the plugin to interface with the host.
972 *
973 * @param opcode See VST_HOST_OPCODE
974 * @param p_str Zero terminated string or null on call.
975 * @return ?
976 */
977 typedef intptr_t (*vst_host_callback)(vst_effect* plugin, VST_HOST_OPCODE opcode, int32_t p_int1, int64_t p_int2,
978 void* p_str, int32_t p_int3);
979
980 /* Entry point for VST2.x plugins.
981 *
982 * @return A new instance of the VST2.x effect.
983 */
984 #define VST_ENTRYPOINT vst_effect* VSTPluginMain(vst_host_callback callback)
985 #define VST_ENTRYPOINT_WINDOWS \
986 vst_effect* MAIN(vst_host_callback callback) \
987 { \
988 return VSTPluginMain(callback); \
989 }
990 #define VST_ENTRYPOINT_MACOS \
991 vst_effect* main_macho(vst_host_callback callback) \
992 { \
993 return VSTPluginMain(callback); \
994 }
995
996 #ifdef __cplusplus
997 }
998 #endif
999
1000 // Variable size variant of vst_speaker_arrangement.
1001 #ifdef __cplusplus
1002 template<size_t T>
1003 struct vst_speaker_arrangement_t {
1004 VST_ARRANGEMENT_TYPE type; // See VST_SPEAKER_ARRANGEMENT_TYPE
1005 int32_t channels; // Number of channels in speakers.
1006 vst_speaker_properties speakers[T]; // Array of speaker properties, actual size defined by channels.
1007 };
1008 #endif
1009
1010 #pragma pack(pop)
1011
1012 #endif