2 * Copyright 2012, Gerasim Troeglazov (3dEyes**), 3dEyes@gmail.com.
4 * Distributed under the terms of the MIT License.
12 #include <Directory.h>
23 #define VST_PARAM_TEST_COUNT 100
26 #define VST_ERR_ALREADY_LOADED -1
27 #define VST_ERR_NOT_LOADED -2
28 #define VST_ERR_NO_MAINPROC -3
31 #define VST_PARAM_SLIDER 1
32 #define VST_PARAM_CHECKBOX 2
33 #define VST_PARAM_DROPLIST 3
36 #define VST_INPUT_CHANNELS 1
37 #define VST_OUTPUT_CHANNELS 2
39 //vst callback opcodes
40 #define VST_MASTER_AUTOMATE 0x00
41 #define VST_MASTER_VERSION 0x01
42 #define VST_MASTER_IDLE 0x03
43 #define VST_MASTER_VENDOR 0x20
44 #define VST_MASTER_PRODUCT 0x21
48 #define VST_CLOSE 0x01
49 #define VST_GET_PARAM_UNIT 0x06
50 #define VST_GET_PARAM_STR 0x07
51 #define VST_GET_PARAM_NAME 0x08
52 #define VST_SET_SAMPLE_RATE 0x0A
53 #define VST_SET_BLOCK_SIZE 0x0B
54 #define VST_STATE_CHANGED 0x0C
55 #define VST_GET_EFFECT_NAME 0x2D
56 #define VST_GET_VENDOR_STR 0x2F
57 #define VST_GET_PRODUCT_STR 0x30
58 #define VST_GET_VENDOR_VER 0x31
60 //vst plugin structure
64 int32 (*dispatcher
)(struct VSTEffect
*, int32
,
65 int32
, int32
, void*, float);
66 void (*process
)(struct VSTEffect
*, float**,
68 void (*setParameter
)(struct VSTEffect
*, int32
, float);
69 float (*getParameter
)(struct VSTEffect
*, int32
);
75 void* _notused_pointer1
;
76 void* _notused_pointer2
;
77 char _notused_block1
[12];
79 void* _notused_pointer3
;
80 void* _notused_pointer4
;
82 char _notused_block2
[4];
83 void (*processReplacing
)(struct VSTEffect
*,
84 float**, float**, int);
88 typedef int32 (*audioMasterCallback
)(VSTEffect
*, int32
, int32
, int32
, void*, float);
89 typedef VSTEffect
* (*VSTEntryProc
)(audioMasterCallback audioMaster
);
90 inline float round(float x
) {return ceil(x
-0.5);}
92 //structure for droplist parameters
93 struct DropListValue
{
100 //vst parameter class adapter
103 VSTParameter(VSTPlugin
* plugin
, int index
);
106 void SetValue(float value
);
107 const char* MinimumValue(void);
108 const char* MaximumValue(void);
109 const char* Unit(void);
112 const char* Name(void);
114 DropListValue
* ListItemAt(int index
);
115 bigtime_t
LastChangeTime(void);
117 BString
* ValidateValues(BString
*string
);
131 //vst plugin interface
136 int LoadModule(const char *path
);
137 int UnLoadModule(void);
138 int SetSampleRate(float rate
);
139 float SampleRate(void);
140 int SetBlockSize(size_t size
);
141 const char* Path(void);
142 size_t BlockSize(void);
143 VSTEffect
* Effect(void);
144 const char* EffectName(void);
145 const char* ModuleName(void);
146 const char* Vendor(void);
147 const char* Product(void);
148 int ParametersCount(void);
149 VSTParameter
* Parameter(int index
);
150 int Channels(int mode
);
151 int ReAllocBuffers(void);
152 void Process(float *buffer
, int samples
, int channels
);
154 VSTEntryProc
GetMainEntry();
156 VSTEntryProc VSTMainProc
;
166 BString fVendorString
;
167 BString fProductString
;
173 #endif //__VST_HOST_H__