aeffectx.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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 effGetParamName = 8; // currently unused
  93. const int effSetSampleRate = 10;
  94. const int effSetBlockSize = 11;
  95. const int effMainsChanged = 12;
  96. const int effEditGetRect = 13;
  97. const int effEditOpen = 14;
  98. const int effEditClose = 15;
  99. const int effEditIdle = 19;
  100. const int effEditTop = 20;
  101. const int effSetChunk = 24;
  102. const int effProcessEvents = 25;
  103. const int effGetEffectName = 45;
  104. const int effGetVendorString = 47;
  105. const int effGetProductString = 48;
  106. const int effGetVendorVersion = 49;
  107. const int effCanDo = 51; // currently unused
  108. const int effGetVstVersion = 58; // currently unused
  109. const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
  110. const int kVstLangEnglish = 1;
  111. const int kVstMidiType = 1;
  112. const int kVstTransportChanged = 1;
  113. const int kVstTransportPlaying = 1 << 1;
  114. const int kVstTransportCycleActive = 1 << 2;
  115. const int kVstTransportRecording = 1 << 3; // currently unused
  116. const int kVstPpqPosValid = 1 << 9;
  117. const int kVstTempoValid = 1 << 10;
  118. const int kVstBarsValid = 1 << 11;
  119. const int kVstCyclePosValid = 1 << 12;
  120. const int kVstTimeSigValid = 1 << 13;
  121. const int kVstSmpteValid = 1 << 14; // currently unused
  122. const int kVstClockValid = 1 << 15; // currently unused
  123. // currently unused
  124. const int kVstSmpte24fps = 0;
  125. const int kVstSmpte25fps = 1;
  126. const int kVstSmpte2997fps = 2;
  127. const int kVstSmpte30fps = 3;
  128. const int kVstSmpte2997dfps = 4;
  129. const int kVstSmpte30dfps = 5;
  130. const int kVstSmpteFilm16mm = 6; // very likely
  131. const int kVstSmpteFilm35mm = 7; // very likely
  132. const int kVstSmpte239fps = 10;
  133. const int kVstSmpte249fps = 11;
  134. const int kVstSmpte599fps = 12;
  135. const int kVstSmpte60fps = 13;
  136. class VstMidiEvent
  137. {
  138. public:
  139. // 00
  140. int32_t type;
  141. // 04
  142. int32_t byteSize;
  143. // 08
  144. int32_t deltaFrames;
  145. // 0c?
  146. int32_t flags;
  147. // 10?
  148. int32_t noteLength;
  149. // 14?
  150. int32_t noteOffset;
  151. // 18
  152. char midiData[4];
  153. // 1c?
  154. char detune;
  155. // 1d?
  156. char noteOffVelocity;
  157. // 1e?
  158. char reserved1;
  159. // 1f?
  160. char reserved2;
  161. } ;
  162. class VstEvent
  163. {
  164. char dump[sizeof( VstMidiEvent )];
  165. } ;
  166. class VstEvents
  167. {
  168. public:
  169. // 00
  170. int32_t numEvents;
  171. // 04
  172. void *reserved;
  173. // 08
  174. VstEvent* events[1];
  175. } ;
  176. class AEffect
  177. {
  178. public:
  179. // Never use virtual functions!!!
  180. // 00-03
  181. int32_t magic;
  182. // dispatcher 04-07
  183. intptr_t (VST_CALL_CONV * dispatcher)( AEffect * , int32_t , int32_t , intptr_t, void * , float );
  184. // process, quite sure 08-0b
  185. void (VST_CALL_CONV * process)( AEffect * , float * * , float * * , int32_t );
  186. // setParameter 0c-0f
  187. void (VST_CALL_CONV * setParameter)( AEffect * , int32_t , float );
  188. // getParameter 10-13
  189. float (VST_CALL_CONV * getParameter)( AEffect * , int32_t );
  190. // programs 14-17
  191. int32_t numPrograms;
  192. // Params 18-1b
  193. int32_t numParams;
  194. // Input 1c-1f
  195. int32_t numInputs;
  196. // Output 20-23
  197. int32_t numOutputs;
  198. // flags 24-27
  199. int32_t flags;
  200. // Fill somewhere 28-2b
  201. void *ptr1;
  202. void *ptr2;
  203. // Zeroes 2c-2f 30-33 34-37 38-3b
  204. char empty3[4 + 4 + 4];
  205. // 1.0f 3c-3f
  206. float unknown_float;
  207. // An object? pointer 40-43
  208. void *ptr3;
  209. // Zeroes 44-47
  210. void *user;
  211. // Id 48-4b
  212. int32_t uniqueID;
  213. // Don't know 4c-4f
  214. char unknown1[4];
  215. // processReplacing 50-53
  216. void (VST_CALL_CONV * processReplacing)( AEffect * , float * * , float * * , int );
  217. } ;
  218. class VstTimeInfo
  219. {
  220. public:
  221. // 00
  222. double samplePos;
  223. // 08
  224. double sampleRate;
  225. // unconfirmed 10
  226. double nanoSeconds;
  227. // 18
  228. double ppqPos;
  229. // 20
  230. double tempo;
  231. // 28
  232. double barStartPos;
  233. // 30
  234. double cycleStartPos;
  235. // 38
  236. double cycleEndPos;
  237. // 40
  238. int32_t timeSigNumerator;
  239. // 44
  240. int32_t timeSigDenominator;
  241. // 48 unused
  242. int32_t smpteOffset;
  243. // 4c unused
  244. int32_t smpteFrameRate;
  245. // 50? unused, where does this come from?
  246. int32_t samplesToNextClock;
  247. // 54
  248. int32_t flags;
  249. } ;
  250. typedef intptr_t (VST_CALL_CONV * audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float );
  251. #endif