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.

492 lines
15KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. #ifndef JUCE_VSTINTERFACE_H_INCLUDED
  20. #define JUCE_VSTINTERFACE_H_INCLUDED
  21. using juce::int16;
  22. using juce::int32;
  23. using juce::uint32;
  24. using juce::pointer_sized_int;
  25. #if JUCE_MSVC
  26. #define VSTINTERFACECALL __cdecl
  27. #pragma pack(push)
  28. #pragma pack(8)
  29. #elif JUCE_MAC || JUCE_IOS
  30. #define VSTINTERFACECALL
  31. #if JUCE_64BIT
  32. #pragma options align=power
  33. #else
  34. #pragma options align=mac68k
  35. #endif
  36. #else
  37. #define VSTINTERFACECALL
  38. #pragma pack(push, 8)
  39. #endif
  40. const int32 juceVstInterfaceVersion = 2400;
  41. const int32 juceVstInterfaceIdentifier = 0x56737450; // The "magic" identifier in the SDK is 'VstP'.
  42. //==============================================================================
  43. struct VstEffectInterface
  44. {
  45. int32 interfaceIdentifier;
  46. pointer_sized_int (VSTINTERFACECALL* dispatchFunction) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt);
  47. void (VSTINTERFACECALL* processAudioFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples);
  48. void (VSTINTERFACECALL* setParameterValueFunction) (VstEffectInterface*, int32 parameterIndex, float value);
  49. float (VSTINTERFACECALL* getParameterValueFunction) (VstEffectInterface*, int32 parameterIndex);
  50. int32 numPrograms;
  51. int32 numParameters;
  52. int32 numInputChannels;
  53. int32 numOutputChannels;
  54. int32 flags;
  55. pointer_sized_int hostSpace1;
  56. pointer_sized_int hostSpace2;
  57. int32 latency;
  58. int32 deprecated1;
  59. int32 deprecated2;
  60. float deprecated3;
  61. void* effectPointer;
  62. void* userPointer;
  63. int32 plugInIdentifier;
  64. int32 plugInVersion;
  65. void (VSTINTERFACECALL* processAudioInplaceFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples);
  66. void (VSTINTERFACECALL* processDoubleAudioInplaceFunction) (VstEffectInterface*, double** inputs, double** outputs, int32 numSamples);
  67. char emptySpace[56];
  68. };
  69. typedef pointer_sized_int (VSTINTERFACECALL* VstHostCallback) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt);
  70. enum VstEffectInterfaceFlags
  71. {
  72. vstEffectFlagHasEditor = 1,
  73. vstEffectFlagInplaceAudio = 16,
  74. vstEffectFlagDataInChunks = 32,
  75. vstEffectFlagIsSynth = 256,
  76. vstEffectFlagInplaceDoubleAudio = 4096
  77. };
  78. //==============================================================================
  79. enum VstHostToPlugInOpcodes
  80. {
  81. plugInOpcodeOpen,
  82. plugInOpcodeClose,
  83. plugInOpcodeSetCurrentProgram,
  84. plugInOpcodeGetCurrentProgram,
  85. plugInOpcodeSetCurrentProgramName,
  86. plugInOpcodeGetCurrentProgramName,
  87. plugInOpcodeGetParameterLabel,
  88. plugInOpcodeGetParameterText,
  89. plugInOpcodeGetParameterName,
  90. plugInOpcodeSetSampleRate = plugInOpcodeGetParameterName + 2,
  91. plugInOpcodeSetBlockSize,
  92. plugInOpcodeResumeSuspend,
  93. plugInOpcodeGetEditorBounds,
  94. plugInOpcodeOpenEditor,
  95. plugInOpcodeCloseEditor,
  96. plugInOpcodeDrawEditor,
  97. plugInOpcodeGetMouse,
  98. plugInOpcodeEditorIdle = plugInOpcodeGetMouse + 2,
  99. plugInOpcodeeffEditorTop,
  100. plugInOpcodeSleepEditor,
  101. plugInOpcodeIdentify,
  102. plugInOpcodeGetData,
  103. plugInOpcodeSetData,
  104. plugInOpcodePreAudioProcessingEvents,
  105. plugInOpcodeIsParameterAutomatable,
  106. plugInOpcodeParameterValueForText,
  107. plugInOpcodeGetProgramName = plugInOpcodeParameterValueForText + 2,
  108. plugInOpcodeConnectInput = plugInOpcodeGetProgramName + 2,
  109. plugInOpcodeConnectOutput,
  110. plugInOpcodeGetInputPinProperties,
  111. plugInOpcodeGetOutputPinProperties,
  112. plugInOpcodeGetPlugInCategory,
  113. plugInOpcodeSetSpeakerConfiguration = plugInOpcodeGetPlugInCategory + 7,
  114. plugInOpcodeSetBypass = plugInOpcodeSetSpeakerConfiguration + 2,
  115. plugInOpcodeGetPlugInName,
  116. plugInOpcodeGetManufacturerName = plugInOpcodeGetPlugInName + 2,
  117. plugInOpcodeGetManufacturerProductName,
  118. plugInOpcodeGetManufacturerVersion,
  119. plugInOpcodeManufacturerSpecific,
  120. plugInOpcodeCanPlugInDo,
  121. plugInOpcodeGetTailSize,
  122. plugInOpcodeIdle,
  123. plugInOpcodeKeyboardFocusRequired = plugInOpcodeIdle + 4,
  124. plugInOpcodeGetVstInterfaceVersion,
  125. plugInOpcodeGetCurrentMidiProgram = plugInOpcodeGetVstInterfaceVersion + 5,
  126. plugInOpcodeGetSpeakerArrangement = plugInOpcodeGetCurrentMidiProgram + 6,
  127. plugInOpcodeNextPlugInUniqueID,
  128. plugInOpcodeStartProcess,
  129. plugInOpcodeStopProcess,
  130. plugInOpcodeSetNumberOfSamplesToProcess,
  131. plugInOpcodeSetSampleFloatType = plugInOpcodeSetNumberOfSamplesToProcess + 4,
  132. pluginOpcodeGetNumMidiInputChannels,
  133. pluginOpcodeGetNumMidiOutputChannels,
  134. plugInOpcodeMaximum = pluginOpcodeGetNumMidiOutputChannels
  135. };
  136. enum VstPlugInToHostOpcodes
  137. {
  138. hostOpcodeParameterChanged,
  139. hostOpcodeVstVersion,
  140. hostOpcodeCurrentId,
  141. hostOpcodeIdle,
  142. hostOpcodePinConnected,
  143. hostOpcodePlugInWantsMidi = hostOpcodePinConnected + 2,
  144. hostOpcodeGetTimingInfo,
  145. hostOpcodePreAudioProcessingEvents,
  146. hostOpcodeSetTime,
  147. hostOpcodeTempoAt,
  148. hostOpcodeGetNumberOfAutomatableParameters,
  149. hostOpcodeGetParameterInterval,
  150. hostOpcodeIOModified,
  151. hostOpcodeNeedsIdle,
  152. hostOpcodeWindowSize,
  153. hostOpcodeGetSampleRate,
  154. hostOpcodeGetBlockSize,
  155. hostOpcodeGetInputLatency,
  156. hostOpcodeGetOutputLatency,
  157. hostOpcodeGetPreviousPlugIn,
  158. hostOpcodeGetNextPlugIn,
  159. hostOpcodeWillReplace,
  160. hostOpcodeGetCurrentAudioProcessingLevel,
  161. hostOpcodeGetAutomationState,
  162. hostOpcodeOfflineStart,
  163. hostOpcodeOfflineReadSource,
  164. hostOpcodeOfflineWrite,
  165. hostOpcodeOfflineGetCurrentPass,
  166. hostOpcodeOfflineGetCurrentMetaPass,
  167. hostOpcodeSetOutputSampleRate,
  168. hostOpcodeGetOutputSpeakerConfiguration,
  169. hostOpcodeGetManufacturerName,
  170. hostOpcodeGetProductName,
  171. hostOpcodeGetManufacturerVersion,
  172. hostOpcodeManufacturerSpecific,
  173. hostOpcodeSetIcon,
  174. hostOpcodeCanHostDo,
  175. hostOpcodeGetLanguage,
  176. hostOpcodeOpenEditorWindow,
  177. hostOpcodeCloseEditorWindow,
  178. hostOpcodeGetDirectory,
  179. hostOpcodeUpdateView,
  180. hostOpcodeParameterChangeGestureBegin,
  181. hostOpcodeParameterChangeGestureEnd,
  182. };
  183. //==============================================================================
  184. enum VstProcessingSampleType
  185. {
  186. vstProcessingSampleTypeFloat,
  187. vstProcessingSampleTypeDouble
  188. };
  189. //==============================================================================
  190. // These names must be identical to the Steinberg SDK so JUCE users can set
  191. // exactly what they want.
  192. enum VstPlugInCategory
  193. {
  194. kPlugCategUnknown,
  195. kPlugCategEffect,
  196. kPlugCategSynth,
  197. kPlugCategAnalysis,
  198. kPlugCategMastering,
  199. kPlugCategSpacializer,
  200. kPlugCategRoomFx,
  201. kPlugSurroundFx,
  202. kPlugCategRestoration,
  203. kPlugCategOfflineProcess,
  204. kPlugCategShell,
  205. kPlugCategGenerator
  206. };
  207. //==============================================================================
  208. struct VstEditorBounds
  209. {
  210. int16 upper;
  211. int16 leftmost;
  212. int16 lower;
  213. int16 rightmost;
  214. };
  215. //==============================================================================
  216. enum VstMaxStringLengths
  217. {
  218. vstMaxNameLength = 64,
  219. vstMaxParameterOrPinLabelLength = 64,
  220. vstMaxParameterOrPinShortLabelLength = 8,
  221. vstMaxCategoryLength = 24,
  222. vstMaxManufacturerStringLength = 64,
  223. vstMaxPlugInNameStringLength = 64
  224. };
  225. //==============================================================================
  226. struct VstPinInfo
  227. {
  228. char text[vstMaxParameterOrPinLabelLength];
  229. int32 flags;
  230. int32 configurationType;
  231. char shortText[vstMaxParameterOrPinShortLabelLength];
  232. char unused[48];
  233. };
  234. enum VstPinInfoFlags
  235. {
  236. vstPinInfoFlagIsActive = 1,
  237. vstPinInfoFlagIsStereo = 2,
  238. vstPinInfoFlagValid = 4
  239. };
  240. //==============================================================================
  241. struct VstEvent
  242. {
  243. int32 type;
  244. int32 size;
  245. int32 sampleOffset;
  246. int32 flags;
  247. char content[16];
  248. };
  249. enum VstEventTypes
  250. {
  251. vstMidiEventType = 1,
  252. vstSysExEventType = 6
  253. };
  254. struct VstEventBlock
  255. {
  256. int32 numberOfEvents;
  257. pointer_sized_int future;
  258. VstEvent* events[2];
  259. };
  260. struct VstMidiEvent
  261. {
  262. int32 type;
  263. int32 size;
  264. int32 sampleOffset;
  265. int32 flags;
  266. int32 noteSampleLength;
  267. int32 noteSampleOffset;
  268. char midiData[4];
  269. char tuning;
  270. char noteVelocityOff;
  271. char future1;
  272. char future2;
  273. };
  274. enum VstMidiEventFlags
  275. {
  276. vstMidiEventIsRealtime = 1
  277. };
  278. struct VstSysExEvent
  279. {
  280. int32 type;
  281. int32 size;
  282. int32 offsetSamples;
  283. int32 flags;
  284. int32 sysExDumpSize;
  285. pointer_sized_int future1;
  286. char* sysExDump;
  287. pointer_sized_int future2;
  288. };
  289. //==============================================================================
  290. struct VstTimingInformation
  291. {
  292. double samplePosition;
  293. double sampleRate;
  294. double systemTimeNanoseconds;
  295. double musicalPosition;
  296. double tempoBPM;
  297. double lastBarPosition;
  298. double loopStartPosition;
  299. double loopEndPosition;
  300. int32 timeSignatureNumerator;
  301. int32 timeSignatureDenominator;
  302. int32 smpteOffset;
  303. int32 smpteRate;
  304. int32 samplesToNearestClock;
  305. int32 flags;
  306. };
  307. enum VstTimingInformationFlags
  308. {
  309. vstTimingInfoFlagTransportChanged = 1,
  310. vstTimingInfoFlagCurrentlyPlaying = 2,
  311. vstTimingInfoFlagLoopActive = 4,
  312. vstTimingInfoFlagCurrentlyRecording = 8,
  313. vstTimingInfoFlagAutomationWriteModeActive = 64,
  314. vstTimingInfoFlagAutomationReadModeActive = 128,
  315. vstTimingInfoFlagNanosecondsValid = 256,
  316. vstTimingInfoFlagMusicalPositionValid = 512,
  317. vstTimingInfoFlagTempoValid = 1024,
  318. vstTimingInfoFlagLastBarPositionValid = 2048,
  319. vstTimingInfoFlagLoopPositionValid = 4096,
  320. vstTimingInfoFlagTimeSignatureValid = 8192,
  321. vstTimingInfoFlagSmpteValid = 16384,
  322. vstTimingInfoFlagNearestClockValid = 32768
  323. };
  324. //==============================================================================
  325. enum VstSmpteRates
  326. {
  327. vstSmpteRateFps24,
  328. vstSmpteRateFps25,
  329. vstSmpteRateFps2997,
  330. vstSmpteRateFps30,
  331. vstSmpteRateFps2997drop,
  332. vstSmpteRateFps30drop,
  333. vstSmpteRate16mmFilm,
  334. vstSmpteRate35mmFilm,
  335. vstSmpteRateFps239 = vstSmpteRate35mmFilm + 3,
  336. vstSmpteRateFps249 ,
  337. vstSmpteRateFps599,
  338. vstSmpteRateFps60
  339. };
  340. //==============================================================================
  341. struct VstIndividualSpeakerInfo
  342. {
  343. float azimuthalAngle;
  344. float elevationAngle;
  345. float radius;
  346. float reserved;
  347. char label[vstMaxNameLength];
  348. int32 type;
  349. char unused[28];
  350. };
  351. enum VstIndividualSpeakerType
  352. {
  353. vstIndividualSpeakerTypeUndefined = 0x7fffffff,
  354. vstIndividualSpeakerTypeMono = 0,
  355. vstIndividualSpeakerTypeLeft,
  356. vstIndividualSpeakerTypeRight,
  357. vstIndividualSpeakerTypeCentre,
  358. vstIndividualSpeakerTypeLFE,
  359. vstIndividualSpeakerTypeLeftSurround,
  360. vstIndividualSpeakerTypeRightSurround,
  361. vstIndividualSpeakerTypeLeftCentre,
  362. vstIndividualSpeakerTypeRightCentre,
  363. vstIndividualSpeakerTypeSurround,
  364. vstIndividualSpeakerTypeCentreSurround = vstIndividualSpeakerTypeSurround,
  365. vstIndividualSpeakerTypeLeftRearSurround,
  366. vstIndividualSpeakerTypeRightRearSurround,
  367. vstIndividualSpeakerTypeTopMiddle,
  368. vstIndividualSpeakerTypeTopFrontLeft,
  369. vstIndividualSpeakerTypeTopFrontCentre,
  370. vstIndividualSpeakerTypeTopFrontRight,
  371. vstIndividualSpeakerTypeTopRearLeft,
  372. vstIndividualSpeakerTypeTopRearCentre,
  373. vstIndividualSpeakerTypeTopRearRight,
  374. vstIndividualSpeakerTypeLFE2
  375. };
  376. struct VstSpeakerConfiguration
  377. {
  378. int32 type;
  379. int32 numberOfChannels;
  380. VstIndividualSpeakerInfo speakers[8];
  381. };
  382. enum VstSpeakerConfigurationType
  383. {
  384. vstSpeakerConfigTypeUser = -2,
  385. vstSpeakerConfigTypeEmpty = -1,
  386. vstSpeakerConfigTypeMono = 0,
  387. vstSpeakerConfigTypeLR,
  388. vstSpeakerConfigTypeLsRs,
  389. vstSpeakerConfigTypeLcRc,
  390. vstSpeakerConfigTypeSlSr,
  391. vstSpeakerConfigTypeCLfe,
  392. vstSpeakerConfigTypeLRC,
  393. vstSpeakerConfigTypeLRS,
  394. vstSpeakerConfigTypeLRCLfe,
  395. vstSpeakerConfigTypeLRLfeS,
  396. vstSpeakerConfigTypeLRCS,
  397. vstSpeakerConfigTypeLRLsRs,
  398. vstSpeakerConfigTypeLRCLfeS,
  399. vstSpeakerConfigTypeLRLfeLsRs,
  400. vstSpeakerConfigTypeLRCLsRs,
  401. vstSpeakerConfigTypeLRCLfeLsRs,
  402. vstSpeakerConfigTypeLRCLsRsCs,
  403. vstSpeakerConfigTypeLRLsRsSlSr,
  404. vstSpeakerConfigTypeLRCLfeLsRsCs,
  405. vstSpeakerConfigTypeLRLfeLsRsSlSr,
  406. vstSpeakerConfigTypeLRCLsRsLcRc,
  407. vstSpeakerConfigTypeLRCLsRsSlSr,
  408. vstSpeakerConfigTypeLRCLfeLsRsLcRc,
  409. vstSpeakerConfigTypeLRCLfeLsRsSlSr,
  410. vstSpeakerConfigTypeLRCLsRsLcRcCs,
  411. vstSpeakerConfigTypeLRCLsRsCsSlSr,
  412. vstSpeakerConfigTypeLRCLfeLsRsLcRcCs,
  413. vstSpeakerConfigTypeLRCLfeLsRsCsSlSr,
  414. vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2
  415. };
  416. #if JUCE_BIG_ENDIAN
  417. #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (a | (((uint32) b) << 8) | (((uint32) c) << 16) | (((uint32) d) << 24))
  418. #else
  419. #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (d | (((uint32) c) << 8) | (((uint32) b) << 16) | (((uint32) a) << 24))
  420. #endif
  421. enum PresonusExtensionConstants
  422. {
  423. presonusVendorID = JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'),
  424. presonusSetContentScaleFactor = JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's')
  425. };
  426. //==============================================================================
  427. struct vst2FxBank
  428. {
  429. int32 magic1;
  430. int32 size;
  431. int32 magic2;
  432. int32 version1;
  433. int32 fxID;
  434. int32 version2;
  435. int32 elements;
  436. int32 current;
  437. char shouldBeZero[124];
  438. int32 chunkSize;
  439. char chunk[1];
  440. };
  441. #if JUCE_MSVC
  442. #pragma pack(pop)
  443. #elif JUCE_MAC || JUCE_IOS
  444. #pragma options align=reset
  445. #else
  446. #pragma pack(pop)
  447. #endif
  448. #endif // JUCE_VSTINTERFACE_H_INCLUDED