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.

337 lines
9.2KB

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