Skip to content

Commit e909d6b

Browse files
committed
Update and cleanup xaymar-vst2 header
Signed-off-by: falkTX <[email protected]>
1 parent c60a151 commit e909d6b

File tree

1 file changed

+57
-38
lines changed
  • distrho/src/xaymar-vst2

1 file changed

+57
-38
lines changed

distrho/src/xaymar-vst2/vst.h

+57-38
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
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.
1+
/*
2+
* Copyright 2020 Michael Fabian 'Xaymar' Dirks <[email protected]>
3+
*
4+
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
*
6+
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
*
8+
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9+
*
10+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11+
*/
512

6-
// See README.md for all information.
13+
/*
14+
* This was created from released VST2.x plugins, and is technically under the 2-clause BSD license. Depending on which country you are in, Steinberg can do fuck all about this. Notable countries for this are most members of the United States of America, the entirety of Europe, Japan, and Russia.
15+
*
16+
* Consult a lawyer if you don't know if clean room reverse engineering is allowed in your country.
17+
*
18+
* See README.md for all information.
19+
*/
720

821
// Known additional information:
922
// - Function call standard seems to be stdcall.
@@ -94,7 +107,7 @@ enum VST_CATEGORY {
94107

95108
enum VST_EFFECT_OPCODE {
96109
/* Create/Initialize the effect (if it has not been created already).
97-
*
110+
*
98111
* @return Always 0.
99112
*/
100113
VST_EFFECT_OPCODE_00 = 0x00,
@@ -104,7 +117,7 @@ enum VST_EFFECT_OPCODE {
104117
/* Destroy the effect (if there is any) and free its memory.
105118
*
106119
* This should destroy the actual object created by VST_ENTRYPOINT.
107-
*
120+
*
108121
* @return Always 0.
109122
*/
110123
VST_EFFECT_OPCODE_01 = 0x01,
@@ -135,7 +148,7 @@ enum VST_EFFECT_OPCODE {
135148
VST_EFFECT_OPCODE_05 = 0x05,
136149

137150
/* Get the value? label for the parameter.
138-
*
151+
*
139152
* @param p_int1 Parameter index.
140153
* @param p_ptr 'char[8]'
141154
* @return 0 on success, 1 on failure.
@@ -144,7 +157,7 @@ enum VST_EFFECT_OPCODE {
144157
VST_EFFECT_OPCODE_PARAM_GETLABEL = 0x06,
145158

146159
/* Get the string value for the parameter.
147-
*
160+
*
148161
* @param p_int1 Parameter index.
149162
* @param p_ptr 'char[8]'
150163
* @return 0 on success, 1 on failure.
@@ -153,7 +166,7 @@ enum VST_EFFECT_OPCODE {
153166
VST_EFFECT_OPCODE_PARAM_GETVALUE = 0x07,
154167

155168
/* Get the name for the parameter.
156-
*
169+
*
157170
* @param p_int1 Parameter index.
158171
* @param p_ptr 'char[8]'
159172
* @return 0 on success, 1 on failure.
@@ -168,7 +181,7 @@ enum VST_EFFECT_OPCODE {
168181
VST_EFFECT_OPCODE_09 = 0x09,
169182

170183
/* Set the new sample rate for the plugin to use.
171-
*
184+
*
172185
* @param p_float New sample rate as a float (double on 64-bit because register upgrades).
173186
*/
174187
VST_EFFECT_OPCODE_0A = 0x0A,
@@ -186,7 +199,7 @@ enum VST_EFFECT_OPCODE {
186199
/* Effect processing should be suspended/paused.
187200
*
188201
* Unclear if this is should result in a flush of buffers.
189-
*
202+
*
190203
* @param p_int2 0 if the effect should suspend processing, 1 if it should resume.
191204
*/
192205
VST_EFFECT_OPCODE_0C = 0x0C,
@@ -202,15 +215,15 @@ enum VST_EFFECT_OPCODE {
202215
VST_EFFECT_OPCODE_WINDOW_GETRECT = 0x0D,
203216

204217
/* Create the window for the plugin.
205-
*
218+
*
206219
* @param p_ptr HWND of the parent window.
207220
* @return 0 on failure, or HWND on success.
208221
*/
209222
VST_EFFECT_OPCODE_0E = 0x0E,
210223
VST_EFFECT_OPCODE_WINDOW_CREATE = 0x0E,
211224

212225
/* Destroy the plugins window.
213-
*
226+
*
214227
* @return Always 0.
215228
*/
216229
VST_EFFECT_OPCODE_0F = 0x0F,
@@ -383,7 +396,7 @@ enum VST_EFFECT_OPCODE {
383396
*/
384397
VST_EFFECT_OPCODE_29 = 0x29,
385398

386-
/* Set the speaker arrangement
399+
/* Set the speaker arrangement
387400
*
388401
* @param p_int2 (vst_speaker_arrangement*) Pointer to a pointer to the speaker arrangement for the input.
389402
* @param p_ptr (vst_speaker_arrangement*) Pointer to a pointer to the speaker arrangement for the output.
@@ -446,21 +459,21 @@ enum VST_EFFECT_OPCODE {
446459
VST_EFFECT_OPCODE_VENDOR_VERSION = 0x31,
447460

448461
/* User defined OP Code, for custom interaction.
449-
*
462+
*
450463
*/
451464
VST_EFFECT_OPCODE_32 = 0x32,
452465
VST_EFFECT_OPCODE_CUSTOM = 0x32,
453466

454467
/* Test for support of a specific named feature.
455-
*
468+
*
456469
* @param p_ptr Pointer to a zero-terminated buffer containing the feature name.
457470
* @return Non-zero if the feature is supported, otherwise 0.
458471
*/
459472
VST_EFFECT_OPCODE_33 = 0x33,
460473
VST_EFFECT_OPCODE_SUPPORTS = 0x33,
461474

462475
/* Number of samples that are at the tail at the end of playback.
463-
*
476+
*
464477
* @return 0 or 1 for no tail, > 1 for number of samples to tail.
465478
*/
466479
VST_EFFECT_OPCODE_34 = 0x34,
@@ -586,14 +599,14 @@ enum VST_EFFECT_OPCODE {
586599

587600
/* Begin processing of audio.
588601
*
589-
*
590-
*
602+
*
603+
*
591604
*/
592605
VST_EFFECT_OPCODE_PROCESS_BEGIN = 0x47,
593606

594607
/* End processing of audio.
595608
*
596-
*
609+
*
597610
*
598611
*/
599612
VST_EFFECT_OPCODE_PROCESS_END = 0x48,
@@ -705,7 +718,7 @@ enum VST_HOST_OPCODE {
705718
VST_HOST_OPCODE_2B = 0x2B,
706719

707720
/* Parameter lost focus.
708-
*
721+
*
709722
* @param int1 Parameter index.
710723
*/
711724
VST_HOST_OPCODE_2C = 0x2C,
@@ -808,7 +821,7 @@ struct vst_effect {
808821
// 64-bit adds 4-byte padding here to align pointers.
809822

810823
/* Control the VST through an opcode and up to four parameters.
811-
*
824+
*
812825
* @param this Pointer to the effect itself.
813826
* @param opcode The opcode to run, see VST_EFFECT_OPCODES.
814827
* @param p_int1 Parameter, see VST_EFFECT_OPCODES.
@@ -817,30 +830,30 @@ struct vst_effect {
817830
* @param p_float Parameter, see VST_EFFECT_OPCODES.
818831
*/
819832
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);
833+
intptr_t p_int2, void* p_ptr, float p_float);
821834

822835
/* Process the given number of samples in inputs and outputs.
823836
*
824837
* Different to process_float how? Never seen any difference.
825-
*
838+
*
826839
* @param pthis Pointer to the effect itself.
827840
* @param inputs Pointer to an array of 'const float[samples]' with size numInputs.
828841
* @param outputs Pointer to an array of 'float[samples]' with size numOutputs.
829842
* @param samples Number of samples per channel in inputs.
830843
*/
831844
void(VST_FUNCTION_INTERFACE* process)(vst_effect* pthis, const float* const* inputs, float** outputs,
832-
int32_t samples);
845+
int32_t samples);
833846

834847
/* Updates the value for the parameter at the given index, or does nothing if out of bounds.
835-
*
848+
*
836849
* @param pthis Pointer to the effect itself.
837850
* @param index Parameter index.
838851
* @param value New value for the parameter.
839852
*/
840853
void(VST_FUNCTION_INTERFACE* set_parameter)(vst_effect* pthis, uint32_t index, float value);
841854

842855
/* Returns the value stored for the parameter at index, or 0 if out of bounds.
843-
*
856+
*
844857
* @param pthis Pointer to the effect itself.
845858
* @param index Parameter index.
846859
* @return float Value of the parameter.
@@ -853,7 +866,7 @@ struct vst_effect {
853866
int32_t num_outputs; // Number of outputs.
854867

855868
/* Bitflags
856-
*
869+
*
857870
* Bit Description
858871
* 1 Effect has "Editor"
859872
* 2 Unknown (Found in: ReaDelay)
@@ -872,7 +885,7 @@ struct vst_effect {
872885

873886
/* Initial delay before processing of samples can actually begin in Samples.
874887
*
875-
* Should be updated before or during handling the 0x47 control call.
888+
* Should be updated before or during handling the 0x47 control call.
876889
*/
877890
int32_t delay;
878891

@@ -884,16 +897,16 @@ struct vst_effect {
884897

885898
/* Id of the plugin.
886899
*
887-
* Due to this not being enough for uniqueness, it should not be used alone
900+
* Due to this not being enough for uniqueness, it should not be used alone
888901
* for indexing. Ideally you want to index like this:
889902
* [unique_id][module_name][version][flags]
890-
* If any of the checks after unique_id fail, you default to the first
903+
* If any of the checks after unique_id fail, you default to the first
891904
* possible choice.
892905
*/
893906
int32_t unique_id;
894907

895908
/* Plugin version
896-
*
909+
*
897910
* Unrelated to the minimum VST Version, but often the same.
898911
*/
899912
int32_t version;
@@ -908,19 +921,19 @@ struct vst_effect {
908921
* @param samples Number of samples per channel in inputs.
909922
*/
910923
void(VST_FUNCTION_INTERFACE* process_float)(vst_effect* pthis, const float* const* inputs, float** outputs,
911-
int32_t samples);
924+
int32_t samples);
912925

913926
/* Process the given number of double samples in inputs and outputs.
914927
*
915928
* Used only by 2.4 hosts and plugins, possibly restricted to said version.
916-
*
929+
*
917930
* @param pthis Pointer to the effect itself.
918931
* @param inputs Pointer to an array of 'const double[samples]' with size numInputs.
919932
* @param outputs Pointer to an array of 'double[samples]' with size numOutputs.
920933
* @param samples Number of samples per channel in inputs.
921934
*/
922935
void(VST_FUNCTION_INTERFACE* process_double)(vst_effect* pthis, const double* const* inputs, double** outputs,
923-
int32_t samples);
936+
int32_t samples);
924937

925938
// Everything after this is unknown and was present in reacomp-standalone.dll.
926939
uint8_t _unknown[56]; // 56-bytes of something. Could also just be 52-bytes.
@@ -969,13 +982,19 @@ struct vst_speaker_arrangement {
969982
};
970983

971984
/* Callback used by the plugin to interface with the host.
972-
*
985+
*
973986
* @param opcode See VST_HOST_OPCODE
974987
* @param p_str Zero terminated string or null on call.
975988
* @return ?
976989
*/
977990
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, float p_float);
991+
void* p_str, float p_float);
992+
993+
static constexpr const char* vst_host_string[] = {
994+
"GetResourcePath", // ReaControlMIDI
995+
"get_ini_file", // ReaControlMIDI
996+
"resolve_fn", // ReaControlMIDI
997+
};
979998

980999
/* Entry point for VST2.x plugins.
9811000
*

0 commit comments

Comments
 (0)