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.

332 lines
9.5KB

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