aeffectx.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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 LMMS - https://lmms.io
  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. #ifndef AEFFECTX_H
  25. #define AEFFECTX_H
  26. #include <stdint.h>
  27. // Calling convention
  28. #define VST_CALL_CONV __cdecl
  29. #define CCONST(a, b, c, d)( ( ( (int32_t) a ) << 24 ) | \
  30. ( ( (int32_t) b ) << 16 ) | \
  31. ( ( (int32_t) c ) << 8 ) | \
  32. ( ( (int32_t) d ) << 0 ) )
  33. const int audioMasterAutomate = 0;
  34. const int audioMasterVersion = 1;
  35. const int audioMasterCurrentId = 2;
  36. const int audioMasterIdle = 3;
  37. const int audioMasterPinConnected = 4;
  38. // unsupported? 5
  39. const int audioMasterWantMidi = 6;
  40. const int audioMasterGetTime = 7;
  41. const int audioMasterProcessEvents = 8;
  42. const int audioMasterSetTime = 9;
  43. const int audioMasterTempoAt = 10;
  44. const int audioMasterGetNumAutomatableParameters = 11;
  45. const int audioMasterGetParameterQuantization = 12;
  46. const int audioMasterIOChanged = 13;
  47. const int audioMasterNeedIdle = 14;
  48. const int audioMasterSizeWindow = 15;
  49. const int audioMasterGetSampleRate = 16;
  50. const int audioMasterGetBlockSize = 17;
  51. const int audioMasterGetInputLatency = 18;
  52. const int audioMasterGetOutputLatency = 19;
  53. const int audioMasterGetPreviousPlug = 20;
  54. const int audioMasterGetNextPlug = 21;
  55. const int audioMasterWillReplaceOrAccumulate = 22;
  56. const int audioMasterGetCurrentProcessLevel = 23;
  57. const int audioMasterGetAutomationState = 24;
  58. const int audioMasterOfflineStart = 25;
  59. const int audioMasterOfflineRead = 26;
  60. const int audioMasterOfflineWrite = 27;
  61. const int audioMasterOfflineGetCurrentPass = 28;
  62. const int audioMasterOfflineGetCurrentMetaPass = 29;
  63. const int audioMasterSetOutputSampleRate = 30;
  64. // unsupported? 31
  65. const int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4?
  66. const int audioMasterGetVendorString = 32;
  67. const int audioMasterGetProductString = 33;
  68. const int audioMasterGetVendorVersion = 34;
  69. const int audioMasterVendorSpecific = 35;
  70. const int audioMasterSetIcon = 36;
  71. const int audioMasterCanDo = 37;
  72. const int audioMasterGetLanguage = 38;
  73. const int audioMasterOpenWindow = 39;
  74. const int audioMasterCloseWindow = 40;
  75. const int audioMasterGetDirectory = 41;
  76. const int audioMasterUpdateDisplay = 42;
  77. const int audioMasterBeginEdit = 43;
  78. const int audioMasterEndEdit = 44;
  79. const int audioMasterOpenFileSelector = 45;
  80. const int audioMasterCloseFileSelector = 46; // currently unused
  81. const int audioMasterEditFile = 47; // currently unused
  82. const int audioMasterGetChunkFile = 48; // currently unused
  83. const int audioMasterGetInputSpeakerArrangement = 49; // currently unused
  84. const int effFlagsHasEditor = 1;
  85. const int effFlagsCanReplacing = 1 << 4; // very likely
  86. const int effFlagsIsSynth = 1 << 8; // currently unused
  87. const int effOpen = 0;
  88. const int effClose = 1; // currently unused
  89. const int effSetProgram = 2; // currently unused
  90. const int effGetProgram = 3; // currently unused
  91. const int effGetProgramName = 5; // currently unused
  92. const int effGetParamLabel = 6;
  93. const int effGetParamDisplay = 7;
  94. const int effGetParamName = 8; // currently unused
  95. const int effSetSampleRate = 10;
  96. const int effSetBlockSize = 11;
  97. const int effMainsChanged = 12;
  98. const int effEditGetRect = 13;
  99. const int effEditOpen = 14;
  100. const int effEditClose = 15;
  101. const int effEditIdle = 19;
  102. const int effEditTop = 20;
  103. const int effSetChunk = 24;
  104. const int effProcessEvents = 25;
  105. const int effGetEffectName = 45;
  106. const int effGetVendorString = 47;
  107. const int effGetProductString = 48;
  108. const int effGetVendorVersion = 49;
  109. const int effCanDo = 51; // currently unused
  110. const int effGetVstVersion = 58; // currently unused
  111. const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
  112. const int kVstLangEnglish = 1;
  113. const int kVstMidiType = 1;
  114. const int kVstTransportChanged = 1;
  115. const int kVstTransportPlaying = 1 << 1;
  116. const int kVstTransportCycleActive = 1 << 2;
  117. const int kVstTransportRecording = 1 << 3; // currently unused
  118. const int kVstPpqPosValid = 1 << 9;
  119. const int kVstTempoValid = 1 << 10;
  120. const int kVstBarsValid = 1 << 11;
  121. const int kVstCyclePosValid = 1 << 12;
  122. const int kVstTimeSigValid = 1 << 13;
  123. const int kVstSmpteValid = 1 << 14; // currently unused
  124. const int kVstClockValid = 1 << 15; // currently unused
  125. // currently unused
  126. const int kVstSmpte24fps = 0;
  127. const int kVstSmpte25fps = 1;
  128. const int kVstSmpte2997fps = 2;
  129. const int kVstSmpte30fps = 3;
  130. const int kVstSmpte2997dfps = 4;
  131. const int kVstSmpte30dfps = 5;
  132. const int kVstSmpteFilm16mm = 6; // very likely
  133. const int kVstSmpteFilm35mm = 7; // very likely
  134. const int kVstSmpte239fps = 10;
  135. const int kVstSmpte249fps = 11;
  136. const int kVstSmpte599fps = 12;
  137. const int kVstSmpte60fps = 13;
  138. class VstMidiEvent
  139. {
  140. public:
  141. // 00
  142. int32_t type;
  143. // 04
  144. int32_t byteSize;
  145. // 08
  146. int32_t deltaFrames;
  147. // 0c?
  148. int32_t flags;
  149. // 10?
  150. int32_t noteLength;
  151. // 14?
  152. int32_t noteOffset;
  153. // 18
  154. char midiData[4];
  155. // 1c?
  156. char detune;
  157. // 1d?
  158. char noteOffVelocity;
  159. // 1e?
  160. char reserved1;
  161. // 1f?
  162. char reserved2;
  163. } ;
  164. class VstEvent
  165. {
  166. char dump[sizeof( VstMidiEvent )];
  167. } ;
  168. class VstEvents
  169. {
  170. public:
  171. // 00
  172. int32_t numEvents;
  173. // 04
  174. void *reserved;
  175. // 08
  176. VstEvent* events[1];
  177. } ;
  178. class AEffect
  179. {
  180. public:
  181. // Never use virtual functions!!!
  182. // 00-03
  183. int32_t magic;
  184. // dispatcher 04-07
  185. intptr_t (VST_CALL_CONV * dispatcher)( AEffect * , int32_t , int32_t , intptr_t, void * , float );
  186. // process, quite sure 08-0b
  187. void (VST_CALL_CONV * process)( AEffect * , float * * , float * * , int32_t );
  188. // setParameter 0c-0f
  189. void (VST_CALL_CONV * setParameter)( AEffect * , int32_t , float );
  190. // getParameter 10-13
  191. float (VST_CALL_CONV * getParameter)( AEffect * , int32_t );
  192. // programs 14-17
  193. int32_t numPrograms;
  194. // Params 18-1b
  195. int32_t numParams;
  196. // Input 1c-1f
  197. int32_t numInputs;
  198. // Output 20-23
  199. int32_t numOutputs;
  200. // flags 24-27
  201. int32_t flags;
  202. // Fill somewhere 28-2b
  203. void *ptr1;
  204. void *ptr2;
  205. // Zeroes 2c-2f 30-33 34-37 38-3b
  206. char empty3[4 + 4 + 4];
  207. // 1.0f 3c-3f
  208. float unknown_float;
  209. // An object? pointer 40-43
  210. void *ptr3;
  211. // Zeroes 44-47
  212. void *user;
  213. // Id 48-4b
  214. int32_t uniqueID;
  215. // Don't know 4c-4f
  216. char unknown1[4];
  217. // processReplacing 50-53
  218. void (VST_CALL_CONV * processReplacing)( AEffect * , float * * , float * * , int );
  219. } ;
  220. class VstTimeInfo
  221. {
  222. public:
  223. // 00
  224. double samplePos;
  225. // 08
  226. double sampleRate;
  227. // unconfirmed 10
  228. double nanoSeconds;
  229. // 18
  230. double ppqPos;
  231. // 20
  232. double tempo;
  233. // 28
  234. double barStartPos;
  235. // 30
  236. double cycleStartPos;
  237. // 38
  238. double cycleEndPos;
  239. // 40
  240. int32_t timeSigNumerator;
  241. // 44
  242. int32_t timeSigDenominator;
  243. // 48 unused
  244. int32_t smpteOffset;
  245. // 4c unused
  246. int32_t smpteFrameRate;
  247. // 50? unused, where does this come from?
  248. int32_t samplesToNextClock;
  249. // 54
  250. int32_t flags;
  251. } ;
  252. typedef intptr_t (VST_CALL_CONV * audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float );
  253. #endif