Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vestige.h 9.3KB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /*
  2. * IMPORTANT: The author of Carla has no connection with the
  3. * author of the VeSTige VST-compatibility header, has had no
  4. * involvement in its creation.
  5. *
  6. * The VeSTige header is included in this package in the good-faith
  7. * belief that it has been cleanly and legally reverse engineered
  8. * without reference to the official VST SDK and without its
  9. * developer(s) having agreed to the VST SDK license agreement.
  10. */
  11. /*
  12. * simple header to allow VeSTige compilation and eventually work
  13. *
  14. * Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public
  18. * License as published by the Free Software Foundation; either
  19. * version 2 of the License, or (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. * General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public
  27. * License along with this program (see COPYING); if not, write to the
  28. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  29. * Boston, MA 02110-1301 USA.
  30. *
  31. */
  32. #include <stdint.h>
  33. #ifndef _VESTIGE_H
  34. #define _VESTIGE_H
  35. #if ! (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
  36. # define __cdecl
  37. #endif
  38. #define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) | \
  39. ( ( (int) b ) << 16 ) | \
  40. ( ( (int) c ) << 8 ) | \
  41. ( ( (int) d ) << 0 ) )
  42. #define audioMasterAutomate 0
  43. #define audioMasterVersion 1
  44. #define audioMasterCurrentId 2
  45. #define audioMasterIdle 3
  46. #define audioMasterPinConnected 4
  47. // unsupported? 5
  48. #define audioMasterWantMidi 6
  49. #define audioMasterGetTime 7
  50. #define audioMasterProcessEvents 8
  51. #define audioMasterSetTime 9
  52. #define audioMasterTempoAt 10
  53. #define audioMasterGetNumAutomatableParameters 11
  54. #define audioMasterGetParameterQuantization 12
  55. #define audioMasterIOChanged 13
  56. #define audioMasterNeedIdle 14
  57. #define audioMasterSizeWindow 15
  58. #define audioMasterGetSampleRate 16
  59. #define audioMasterGetBlockSize 17
  60. #define audioMasterGetInputLatency 18
  61. #define audioMasterGetOutputLatency 19
  62. #define audioMasterGetPreviousPlug 20
  63. #define audioMasterGetNextPlug 21
  64. #define audioMasterWillReplaceOrAccumulate 22
  65. #define audioMasterGetCurrentProcessLevel 23
  66. #define audioMasterGetAutomationState 24
  67. #define audioMasterOfflineStart 25
  68. #define audioMasterOfflineRead 26
  69. #define audioMasterOfflineWrite 27
  70. #define audioMasterOfflineGetCurrentPass 28
  71. #define audioMasterOfflineGetCurrentMetaPass 29
  72. #define audioMasterSetOutputSampleRate 30
  73. // unsupported? 31
  74. #define audioMasterGetSpeakerArrangement 31 // deprecated in 2.4?
  75. #define audioMasterGetVendorString 32
  76. #define audioMasterGetProductString 33
  77. #define audioMasterGetVendorVersion 34
  78. #define audioMasterVendorSpecific 35
  79. #define audioMasterSetIcon 36
  80. #define audioMasterCanDo 37
  81. #define audioMasterGetLanguage 38
  82. #define audioMasterOpenWindow 39
  83. #define audioMasterCloseWindow 40
  84. #define audioMasterGetDirectory 41
  85. #define audioMasterUpdateDisplay 42
  86. #define audioMasterBeginEdit 43
  87. #define audioMasterEndEdit 44
  88. #define audioMasterOpenFileSelector 45
  89. #define audioMasterCloseFileSelector 46 // currently unused
  90. #define audioMasterEditFile 47 // currently unused
  91. #define audioMasterGetChunkFile 48 // currently unused
  92. #define audioMasterGetInputSpeakerArrangement 49 // currently unused
  93. #define effFlagsHasEditor 1
  94. #define effFlagsCanReplacing (1 << 4) // very likely
  95. #define effFlagsIsSynth (1 << 8) // currently unused
  96. #define effOpen 0
  97. #define effClose 1
  98. #define effSetProgram 2
  99. #define effGetProgram 3
  100. #define effGetProgramName 5
  101. #define effGetParamName 8
  102. #define effSetSampleRate 10
  103. #define effSetBlockSize 11
  104. #define effMainsChanged 12
  105. #define effEditGetRect 13
  106. #define effEditOpen 14
  107. #define effEditClose 15
  108. #define effEditIdle 19
  109. #define effEditTop 20
  110. #define effProcessEvents 25
  111. #define effGetPlugCategory 35
  112. #define effGetEffectName 45
  113. #define effGetVendorString 47
  114. #define effGetProductString 48
  115. #define effGetVendorVersion 49
  116. #define effCanDo 51
  117. #define effIdle 53
  118. #define effGetParameterProperties 56
  119. #define effGetVstVersion 58
  120. #define effShellGetNextPlugin 70
  121. #define effStartProcess 71
  122. #define effStopProcess 72
  123. #define effBeginSetProgram 67
  124. #define effEndSetProgram 68
  125. #ifdef WORDS_BIGENDIAN
  126. // "VstP"
  127. #define kEffectMagic 0x50747356
  128. #else
  129. // "PtsV"
  130. #define kEffectMagic 0x56737450
  131. #endif
  132. #define kVstLangEnglish 1
  133. #define kVstMidiType 1
  134. struct RemoteVstPlugin;
  135. #define kVstTransportChanged 1
  136. #define kVstTransportPlaying (1 << 1)
  137. #define kVstTransportCycleActive (1 << 2)
  138. #define kVstTransportRecording (1 << 3)
  139. #define kVstAutomationWriting (1 << 6)
  140. #define kVstAutomationReading (1 << 7)
  141. #define kVstNanosValid (1 << 8)
  142. #define kVstPpqPosValid (1 << 9)
  143. #define kVstTempoValid (1 << 10)
  144. #define kVstBarsValid (1 << 11)
  145. #define kVstCyclePosValid (1 << 12)
  146. #define kVstTimeSigValid (1 << 13)
  147. #define kVstSmpteValid (1 << 14)
  148. #define kVstClockValid (1 << 15)
  149. struct _VstMidiEvent
  150. {
  151. // 00
  152. int type;
  153. // 04
  154. int byteSize;
  155. // 08
  156. int deltaFrames;
  157. // 0c?
  158. int flags;
  159. // 10?
  160. int noteLength;
  161. // 14?
  162. int noteOffset;
  163. // 18
  164. char midiData[4];
  165. // 1c?
  166. char detune;
  167. // 1d?
  168. char noteOffVelocity;
  169. // 1e?
  170. char reserved1;
  171. // 1f?
  172. char reserved2;
  173. };
  174. typedef struct _VstMidiEvent VstMidiEvent;
  175. struct _VstEvent
  176. {
  177. char dump[sizeof (VstMidiEvent)];
  178. };
  179. typedef struct _VstEvent VstEvent;
  180. struct _VstEvents
  181. {
  182. // 00
  183. int numEvents;
  184. // 04
  185. void *reserved;
  186. // 08
  187. VstEvent * events[2];
  188. };
  189. enum Vestige2StringConstants
  190. {
  191. VestigeMaxNameLen = 64,
  192. VestigeMaxLabelLen = 64,
  193. VestigeMaxShortLabelLen = 8,
  194. VestigeMaxCategLabelLen = 24,
  195. VestigeMaxFileNameLen = 100
  196. };
  197. enum VstPlugCategory
  198. {
  199. kPlugCategUnknown = 0,
  200. kPlugCategEffect,
  201. kPlugCategSynth,
  202. kPlugCategAnalysis,
  203. kPlugCategMastering,
  204. kPlugCategSpacializer,
  205. kPlugCategRoomFx,
  206. kPlugSurroundFx,
  207. kPlugCategRestoration,
  208. kPlugCategOfflineProcess,
  209. kPlugCategShell,
  210. kPlugCategGenerator,
  211. kPlugCategMaxCount
  212. };
  213. typedef struct _VstEvents VstEvents;
  214. struct _VstParameterProperties
  215. {
  216. float stepFloat; /* float step */
  217. float smallStepFloat; /* small float step */
  218. float largeStepFloat; /* large float step */
  219. char label[VestigeMaxLabelLen]; /* parameter label */
  220. int32_t flags; /* @see VstParameterFlags */
  221. int32_t minInteger; /* integer minimum */
  222. int32_t maxInteger; /* integer maximum */
  223. int32_t stepInteger; /* integer step */
  224. int32_t largeStepInteger; /* large integer step */
  225. char shortLabel[VestigeMaxShortLabelLen]; /* short label, recommended: 6 + delimiter */
  226. int16_t displayIndex; /* index where this parameter should be displayed (starting with 0) */
  227. int16_t category; /* 0: no category, else group index + 1 */
  228. int16_t numParametersInCategory; /* number of parameters in category */
  229. int16_t reserved; /* zero */
  230. char categoryLabel[VestigeMaxCategLabelLen]; /* category label, e.g. "Osc 1" */
  231. char future[16]; /* reserved for future use */
  232. };
  233. typedef struct _VstParameterProperties VstParameterProperties;
  234. enum VstParameterFlags
  235. {
  236. kVstParameterIsSwitch = 1 << 0, /* parameter is a switch (on/off) */
  237. kVstParameterUsesIntegerMinMax = 1 << 1, /* minInteger, maxInteger valid */
  238. kVstParameterUsesFloatStep = 1 << 2, /* stepFloat, smallStepFloat, largeStepFloat valid */
  239. kVstParameterUsesIntStep = 1 << 3, /* stepInteger, largeStepInteger valid */
  240. kVstParameterSupportsDisplayIndex = 1 << 4, /* displayIndex valid */
  241. kVstParameterSupportsDisplayCategory = 1 << 5, /* category, etc. valid */
  242. kVstParameterCanRamp = 1 << 6 /* set if parameter value can ramp up/down */
  243. };
  244. struct _AEffect
  245. {
  246. // Never use virtual functions!!!
  247. // 00-03
  248. int magic;
  249. // dispatcher 04-07
  250. intptr_t (__cdecl *dispatcher) (struct _AEffect *, int, int, intptr_t, void *, float);
  251. // process, quite sure 08-0b
  252. void (__cdecl *process) (struct _AEffect *, float **, float **, int);
  253. // setParameter 0c-0f
  254. void (__cdecl *setParameter) (struct _AEffect *, int, float);
  255. // getParameter 10-13
  256. float (__cdecl *getParameter) (struct _AEffect *, int);
  257. // programs 14-17
  258. int numPrograms;
  259. // Params 18-1b
  260. int numParams;
  261. // Input 1c-1f
  262. int numInputs;
  263. // Output 20-23
  264. int numOutputs;
  265. // flags 24-27
  266. int flags;
  267. // Fill somewhere 28-2b
  268. void *ptr1;
  269. void *ptr2;
  270. int initialDelay;
  271. // Zeroes 30-33 34-37 38-3b
  272. char empty2[4 + 4];
  273. // 1.0f 3c-3f
  274. float unkown_float;
  275. // An object? pointer 40-43
  276. void *object;
  277. // Zeroes 44-47
  278. void *user;
  279. // Id 48-4b
  280. int32_t uniqueID;
  281. // plugin version 4c-4f
  282. int32_t version;
  283. // processReplacing 50-53
  284. void (__cdecl *processReplacing) (struct _AEffect *, float **, float **, int);
  285. };
  286. typedef struct _AEffect AEffect;
  287. typedef struct _VstTimeInfo
  288. {
  289. /* info from online documentation of VST provided by Steinberg */
  290. double samplePos;
  291. double sampleRate;
  292. double nanoSeconds;
  293. double ppqPos;
  294. double tempo;
  295. double barStartPos;
  296. double cycleStartPos;
  297. double cycleEndPos;
  298. int32_t timeSigNumerator;
  299. int32_t timeSigDenominator;
  300. int32_t smpteOffset;
  301. int32_t smpteFrameRate;
  302. int32_t samplesToNextClock;
  303. int32_t flags;
  304. } VstTimeInfo;
  305. typedef intptr_t (__cdecl *audioMasterCallback) (AEffect *, int32_t, int32_t, intptr_t, void *, float);
  306. #endif