aeffectx.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. const int audioMasterAutomate = 0;
  32. const int audioMasterVersion = 1;
  33. const int audioMasterCurrentId = 2;
  34. const int audioMasterIdle = 3;
  35. const int audioMasterPinConnected = 4;
  36. // unsupported? 5
  37. const int audioMasterWantMidi = 6;
  38. const int audioMasterGetTime = 7;
  39. const int audioMasterProcessEvents = 8;
  40. const int audioMasterSetTime = 9;
  41. const int audioMasterTempoAt = 10;
  42. const int audioMasterGetNumAutomatableParameters = 11;
  43. const int audioMasterGetParameterQuantization = 12;
  44. const int audioMasterIOChanged = 13;
  45. const int audioMasterNeedIdle = 14;
  46. const int audioMasterSizeWindow = 15;
  47. const int audioMasterGetSampleRate = 16;
  48. const int audioMasterGetBlockSize = 17;
  49. const int audioMasterGetInputLatency = 18;
  50. const int audioMasterGetOutputLatency = 19;
  51. const int audioMasterGetPreviousPlug = 20;
  52. const int audioMasterGetNextPlug = 21;
  53. const int audioMasterWillReplaceOrAccumulate = 22;
  54. const int audioMasterGetCurrentProcessLevel = 23;
  55. const int audioMasterGetAutomationState = 24;
  56. const int audioMasterOfflineStart = 25;
  57. const int audioMasterOfflineRead = 26;
  58. const int audioMasterOfflineWrite = 27;
  59. const int audioMasterOfflineGetCurrentPass = 28;
  60. const int audioMasterOfflineGetCurrentMetaPass = 29;
  61. const int audioMasterSetOutputSampleRate = 30;
  62. // unsupported? 31
  63. const int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4?
  64. const int audioMasterGetVendorString = 32;
  65. const int audioMasterGetProductString = 33;
  66. const int audioMasterGetVendorVersion = 34;
  67. const int audioMasterVendorSpecific = 35;
  68. const int audioMasterSetIcon = 36;
  69. const int audioMasterCanDo = 37;
  70. const int audioMasterGetLanguage = 38;
  71. const int audioMasterOpenWindow = 39;
  72. const int audioMasterCloseWindow = 40;
  73. const int audioMasterGetDirectory = 41;
  74. const int audioMasterUpdateDisplay = 42;
  75. const int audioMasterBeginEdit = 43;
  76. const int audioMasterEndEdit = 44;
  77. const int audioMasterOpenFileSelector = 45;
  78. const int audioMasterCloseFileSelector = 46; // currently unused
  79. const int audioMasterEditFile = 47; // currently unused
  80. const int audioMasterGetChunkFile = 48; // currently unused
  81. const int audioMasterGetInputSpeakerArrangement = 49; // currently unused
  82. const int effFlagsHasEditor = 1;
  83. const int effFlagsCanReplacing = 1 << 4; // very likely
  84. const int effFlagsProgramChunks = 1 << 5; // from Ardour
  85. const int effFlagsIsSynth = 1 << 8; // currently unused
  86. const int effOpen = 0;
  87. const int effClose = 1; // currently unused
  88. const int effSetProgram = 2; // currently unused
  89. const int effGetProgram = 3; // currently unused
  90. // The next one was gleaned from http://www.kvraudio.com/forum/viewtopic.php?p=1905347
  91. const int effSetProgramName = 4;
  92. const int effGetProgramName = 5; // currently unused
  93. // The next two were gleaned from http://www.kvraudio.com/forum/viewtopic.php?p=1905347
  94. const int effGetParamLabel = 6;
  95. const int effGetParamDisplay = 7;
  96. const int effGetParamName = 8; // currently unused
  97. const int effSetSampleRate = 10;
  98. const int effSetBlockSize = 11;
  99. const int effMainsChanged = 12;
  100. const int effEditGetRect = 13;
  101. const int effEditOpen = 14;
  102. const int effEditClose = 15;
  103. const int effEditIdle = 19;
  104. const int effEditTop = 20;
  105. const int effIdentify = 22; // from http://www.asseca.org/vst-24-specs/efIdentify.html
  106. const int effGetChunk = 23; // from Ardour
  107. const int effSetChunk = 24; // from Ardour
  108. const int effProcessEvents = 25;
  109. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efCanBeAutomated.html
  110. const int effCanBeAutomated = 26;
  111. // The next one was gleaned from http://www.kvraudio.com/forum/viewtopic.php?p=1905347
  112. const int effGetProgramNameIndexed = 29;
  113. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efGetPlugCategory.html
  114. const int effGetPlugCategory = 35;
  115. const int effGetEffectName = 45;
  116. const int effGetParameterProperties = 56; // missing
  117. const int effGetVendorString = 47;
  118. const int effGetProductString = 48;
  119. const int effGetVendorVersion = 49;
  120. const int effCanDo = 51; // currently unused
  121. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efIdle.html
  122. const int effIdle = 53;
  123. const int effGetVstVersion = 58; // currently unused
  124. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efBeginSetProgram.html
  125. const int effBeginSetProgram = 67;
  126. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efEndSetProgram.html
  127. const int effEndSetProgram = 68;
  128. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efShellGetNextPlugin.html
  129. const int effShellGetNextPlugin = 70;
  130. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efBeginLoadBank.html
  131. const int effBeginLoadBank = 75;
  132. // The next one was gleaned from http://www.asseca.org/vst-24-specs/efBeginLoadProgram.html
  133. const int effBeginLoadProgram = 76;
  134. // The next two were gleaned from http://www.kvraudio.com/forum/printview.php?t=143587&start=0
  135. const int effStartProcess = 71;
  136. const int effStopProcess = 72;
  137. const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
  138. const int kVstLangEnglish = 1;
  139. const int kVstMidiType = 1;
  140. const int kVstNanosValid = 1 << 8;
  141. const int kVstPpqPosValid = 1 << 9;
  142. const int kVstTempoValid = 1 << 10;
  143. const int kVstBarsValid = 1 << 11;
  144. const int kVstCyclePosValid = 1 << 12;
  145. const int kVstTimeSigValid = 1 << 13;
  146. // from Ardour
  147. const int kVstSmpteValid = 1 << 14;
  148. // from Ardour
  149. const int kVstClockValid = 1 << 15;
  150. const int kVstTransportPlaying = 1 << 1;
  151. const int kVstTransportCycleActive = 1 << 2;
  152. const int kVstTransportChanged = 1;
  153. class RemoteVstPlugin;
  154. class VstMidiEvent
  155. {
  156. public:
  157. // 00
  158. int type;
  159. // 04
  160. int byteSize;
  161. // 08
  162. int deltaFrames;
  163. // 0c?
  164. int flags;
  165. // 10?
  166. int noteLength;
  167. // 14?
  168. int noteOffset;
  169. // 18
  170. char midiData[4];
  171. // 1c?
  172. char detune;
  173. // 1d?
  174. char noteOffVelocity;
  175. // 1e?
  176. char reserved1;
  177. // 1f?
  178. char reserved2;
  179. };
  180. class VstEvent
  181. {
  182. char dump[sizeof( VstMidiEvent )];
  183. };
  184. class VstEvents
  185. {
  186. public:
  187. // 00
  188. int numEvents;
  189. // 04
  190. void *reserved;
  191. // 08
  192. VstEvent* events[1];
  193. };
  194. // Not finished, neither really used
  195. class VstParameterProperties
  196. {
  197. public:
  198. /*
  199. float stepFloat;
  200. char label[64];
  201. int flags;
  202. int minInteger;
  203. int maxInteger;
  204. int stepInteger;
  205. char shortLabel[8];
  206. int category;
  207. char categoryLabel[24];
  208. char empty[128];
  209. */
  210. float stepFloat;
  211. float smallStepFloat;
  212. float largeStepFloat;
  213. char label[64];
  214. unsigned int flags;
  215. unsigned int minInteger;
  216. unsigned int maxInteger;
  217. unsigned int stepInteger;
  218. unsigned int largeStepInteger;
  219. char shortLabel[8];
  220. unsigned short displayIndex;
  221. unsigned short category;
  222. unsigned short numParametersInCategory;
  223. unsigned short reserved;
  224. char categoryLabel[24];
  225. char future[16];
  226. };
  227. class AEffect
  228. {
  229. public:
  230. // Never use virtual functions!!!
  231. // 00-03
  232. int magic;
  233. // dispatcher 04-07
  234. intptr_t (* dispatcher)( AEffect * , int , int , intptr_t, void * , float );
  235. // process, quite sure 08-0b
  236. void (* process)( AEffect * , float * * , float * * , int );
  237. // setParameter 0c-0f
  238. void (* setParameter)( AEffect * , int , float );
  239. // getParameter 10-13
  240. float (* getParameter)( AEffect * , int );
  241. // programs 14-17
  242. int numPrograms;
  243. // Params 18-1b
  244. int numParams;
  245. // Input 1c-1f
  246. int numInputs;
  247. // Output 20-23
  248. int numOutputs;
  249. // flags 24-27
  250. int flags;
  251. // Fill somewhere 28-2b
  252. void * ptr1;
  253. void * ptr2;
  254. int initialDelay;
  255. // Zeroes 34-37 38-3b
  256. int empty3a;
  257. int empty3b;
  258. // 1.0f 3c-3f
  259. float unkown_float;
  260. // An object? pointer 40-43
  261. void *ptr3;
  262. // Zeroes 44-47
  263. void *user;
  264. // Id 48-4b
  265. int32_t uniqueID;
  266. int32_t version;
  267. // processReplacing 50-53
  268. void (* processReplacing)( AEffect * , float * * , float * * , int );
  269. };
  270. typedef intptr_t (* audioMasterCallback)( AEffect * , int32_t, int32_t,
  271. intptr_t, void * , float );
  272. class VstTimeInfo
  273. {
  274. public:
  275. // 00
  276. double samplePos;
  277. // 08
  278. double sampleRate;
  279. // 10
  280. double nanoSeconds;
  281. // 18
  282. double ppqPos;
  283. // 20?
  284. double tempo;
  285. // 28
  286. double barStartPos;
  287. // 30?
  288. double cycleStartPos;
  289. // 38?
  290. double cycleEndPos;
  291. // 40?
  292. int timeSigNumerator;
  293. // 44?
  294. int timeSigDenominator;
  295. // unconfirmed 48 4c 50
  296. char empty3[4 + 4 + 4];
  297. // 54
  298. int flags;
  299. };
  300. // from http://www.asseca.org/vst-24-specs/efGetParameterProperties.html
  301. enum VstParameterFlags
  302. {
  303. // parameter is a switch (on/off)
  304. kVstParameterIsSwitch = 1 << 0,
  305. // minInteger, maxInteger valid
  306. kVstParameterUsesIntegerMinMax = 1 << 1,
  307. // stepFloat, smallStepFloat, largeStepFloat valid
  308. kVstParameterUsesFloatStep = 1 << 2,
  309. // stepInteger, largeStepInteger valid
  310. kVstParameterUsesIntStep = 1 << 3,
  311. // displayIndex valid
  312. kVstParameterSupportsDisplayIndex = 1 << 4,
  313. // category, etc. valid
  314. kVstParameterSupportsDisplayCategory = 1 << 5,
  315. // set if parameter value can ramp up/down
  316. kVstParameterCanRamp = 1 << 6
  317. };
  318. // from http://www.asseca.org/vst-24-specs/efBeginLoadProgram.html
  319. struct VstPatchChunkInfo
  320. {
  321. int32_t version; // Format Version (should be 1)
  322. int32_t pluginUniqueID; // UniqueID of the plug-in
  323. int32_t pluginVersion; // Plug-in Version
  324. int32_t numElements; // Number of Programs (Bank) or
  325. // Parameters (Program)
  326. char future[48]; // Reserved for future use
  327. };
  328. // from http://www.asseca.org/vst-24-specs/efGetPlugCategory.html
  329. enum VstPlugCategory
  330. {
  331. kPlugCategUnknown = 0, // 0=Unknown, category not implemented
  332. kPlugCategEffect, // 1=Simple Effect
  333. kPlugCategSynth, // 2=VST Instrument (Synths, samplers,...)
  334. kPlugCategAnalysis, // 3=Scope, Tuner, ...
  335. kPlugCategMastering, // 4=Dynamics, ...
  336. kPlugCategSpacializer, // 5=Panners, ...
  337. kPlugCategRoomFx, // 6=Delays and Reverbs
  338. kPlugSurroundFx, // 7=Dedicated surround processor
  339. kPlugCategRestoration, // 8=Denoiser, ...
  340. kPlugCategOfflineProcess, // 9=Offline Process
  341. kPlugCategShell, // 10=Plug-in is container of other
  342. // plug-ins @see effShellGetNextPlugin()
  343. kPlugCategGenerator, // 11=ToneGenerator, ...
  344. kPlugCategMaxCount // 12=Marker to count the categories
  345. };
  346. #endif