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.

346 lines
9.4KB

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