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.

539 lines
16KB

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