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.

aeffectx.h 7.6KB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. #define effGetEffectName 45
  101. #define effGetVendorString 47
  102. #define effGetProductString 48
  103. #define effGetVendorVersion 49
  104. #define effCanDo 51 // currently unused
  105. /* from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
  106. #define effGetParameterProperties 56
  107. #define effGetVstVersion 58 // currently unused
  108. #define kEffectMagic (CCONST( 'V', 's', 't', 'P' ))
  109. #define kVstLangEnglish 1
  110. #define kVstMidiType 1
  111. struct RemoteVstPlugin;
  112. #define kVstTransportPlaying (1 << 1)
  113. #define kVstNanosValid (1 << 8)
  114. #define kVstPpqPosValid (1 << 9)
  115. #define kVstTempoValid (1 << 10)
  116. #define kVstBarsValid (1 << 11)
  117. #define kVstCyclePosValid (1 << 12)
  118. #define kVstTimeSigValid (1 << 13)
  119. #define kVstSmpteValid (1 << 14)
  120. #define kVstClockValid (1 << 15)
  121. struct _VstMidiEvent
  122. {
  123. // 00
  124. int type;
  125. // 04
  126. int byteSize;
  127. // 08
  128. int deltaFrames;
  129. // 0c?
  130. int flags;
  131. // 10?
  132. int noteLength;
  133. // 14?
  134. int noteOffset;
  135. // 18
  136. char midiData[4];
  137. // 1c?
  138. char detune;
  139. // 1d?
  140. char noteOffVelocity;
  141. // 1e?
  142. char reserved1;
  143. // 1f?
  144. char reserved2;
  145. };
  146. typedef struct _VstMidiEvent VstMidiEvent;
  147. struct _VstEvent
  148. {
  149. char dump[sizeof (VstMidiEvent)];
  150. };
  151. typedef struct _VstEvent VstEvent;
  152. struct _VstEvents
  153. {
  154. // 00
  155. int numEvents;
  156. // 04
  157. void *reserved;
  158. // 08
  159. VstEvent * events[2];
  160. };
  161. typedef struct _VstEvents VstEvents;
  162. /* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
  163. struct _VstParameterProperties
  164. {
  165. float stepFloat;
  166. float smallStepFloat;
  167. float largeStepFloat;
  168. char label[64];
  169. int32_t flags;
  170. int32_t minInteger;
  171. int32_t maxInteger;
  172. int32_t stepInteger;
  173. int32_t largeStepInteger;
  174. char shortLabel[8];
  175. };
  176. typedef struct _VstParameterProperties VstParameterProperties;
  177. /* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
  178. enum VstParameterFlags
  179. {
  180. kVstParameterIsSwitch = 1 << 0, /* parameter is a switch (on/off) */
  181. kVstParameterUsesIntegerMinMax = 1 << 1, /* minInteger, maxInteger valid */
  182. kVstParameterUsesFloatStep = 1 << 2, /* stepFloat, smallStepFloat, largeStepFloat valid */
  183. kVstParameterUsesIntStep = 1 << 3, /* stepInteger, largeStepInteger valid */
  184. kVstParameterSupportsDisplayIndex = 1 << 4, /* displayIndex valid */
  185. kVstParameterSupportsDisplayCategory = 1 << 5, /* category, etc. valid */
  186. kVstParameterCanRamp = 1 << 6 /* set if parameter value can ramp up/down */
  187. };
  188. struct _AEffect
  189. {
  190. // Never use virtual functions!!!
  191. // 00-03
  192. int magic;
  193. // dispatcher 04-07
  194. intptr_t (* dispatcher) (struct _AEffect *, int, int, intptr_t, void *, float);
  195. // process, quite sure 08-0b
  196. void (* process) (struct _AEffect *, float **, float **, int);
  197. // setParameter 0c-0f
  198. void (* setParameter) (struct _AEffect *, int, float);
  199. // getParameter 10-13
  200. float (* getParameter) (struct _AEffect *, int);
  201. // programs 14-17
  202. int numPrograms;
  203. // Params 18-1b
  204. int numParams;
  205. // Input 1c-1f
  206. int numInputs;
  207. // Output 20-23
  208. int numOutputs;
  209. // flags 24-27
  210. int flags;
  211. // Fill somewhere 28-2b
  212. void *ptr1;
  213. void *ptr2;
  214. // Zeroes 2c-2f 30-33 34-37 38-3b
  215. char empty3[4 + 4 + 4];
  216. // 1.0f 3c-3f
  217. float unkown_float;
  218. // An object? pointer 40-43
  219. void *ptr3;
  220. // Zeroes 44-47
  221. void *user;
  222. // Id 48-4b
  223. int32_t uniqueID;
  224. // Don't know 4c-4f
  225. char unknown1[4];
  226. // processReplacing 50-53
  227. void (* processReplacing) (struct _AEffect *, float **, float **, int);
  228. };
  229. typedef struct _AEffect AEffect;
  230. typedef struct _VstTimeInfo
  231. {
  232. /* info from online documentation of VST provided by Steinberg */
  233. double samplePos;
  234. double sampleRate;
  235. double nanoSeconds;
  236. double ppqPos;
  237. double tempo;
  238. double barStartPos;
  239. double cycleStartPos;
  240. double cycleEndPos;
  241. int32_t timeSigNumerator;
  242. int32_t timeSigDenominator;
  243. int32_t smpteOffset;
  244. int32_t smpteFrameRate;
  245. int32_t samplesToNextClock;
  246. int32_t flags;
  247. } VstTimeInfo;
  248. typedef intptr_t (* audioMasterCallback) (AEffect *, int32_t, int32_t, intptr_t, void *, float);
  249. #endif