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.

3256 lines
166KB

  1. diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  2. index f9b8bed8a..23484732b 100644
  3. --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  4. +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  5. @@ -78,14 +78,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4458)
  6. namespace Vst2
  7. {
  8. -// If the following files cannot be found then you are probably trying to build
  9. -// a VST2 plug-in or a VST2-compatible VST3 plug-in. To do this you must have a
  10. -// VST2 SDK in your header search paths or use the "VST (Legacy) SDK Folder"
  11. -// field in the Projucer. The VST2 SDK can be obtained from the
  12. -// vstsdk3610_11_06_2018_build_37 (or older) VST3 SDK or JUCE version 5.3.2. You
  13. -// also need a VST2 license from Steinberg to distribute VST2 plug-ins.
  14. -#include "pluginterfaces/vst2.x/aeffect.h"
  15. -#include "pluginterfaces/vst2.x/aeffectx.h"
  16. +#include "../../juce_audio_processors/format_types/juce_VSTInterface.h"
  17. }
  18. JUCE_END_IGNORE_WARNINGS_MSVC
  19. @@ -96,7 +89,6 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE
  20. #pragma pack (push, 8)
  21. #endif
  22. -#define JUCE_VSTINTERFACE_H_INCLUDED 1
  23. #define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1
  24. #include "../utility/juce_IncludeModuleHeaders.h"
  25. @@ -289,7 +281,7 @@ private:
  26. public:
  27. //==============================================================================
  28. - JuceVSTWrapper (Vst2::audioMasterCallback cb, AudioProcessor* af)
  29. + JuceVSTWrapper (Vst2::VstHostCallback cb, AudioProcessor* af)
  30. : hostCallback (cb),
  31. processor (af)
  32. {
  33. @@ -320,41 +312,41 @@ public:
  34. juceParameters.update (*processor, false);
  35. memset (&vstEffect, 0, sizeof (vstEffect));
  36. - vstEffect.magic = 0x56737450 /* 'VstP' */;
  37. - vstEffect.dispatcher = (Vst2::AEffectDispatcherProc) dispatcherCB;
  38. - vstEffect.process = nullptr;
  39. - vstEffect.setParameter = (Vst2::AEffectSetParameterProc) setParameterCB;
  40. - vstEffect.getParameter = (Vst2::AEffectGetParameterProc) getParameterCB;
  41. + vstEffect.interfaceIdentifier = Vst2::juceVstInterfaceIdentifier;
  42. + vstEffect.dispatchFunction = dispatcherCB;
  43. + vstEffect.processAudioFunction = nullptr;
  44. + vstEffect.setParameterValueFunction = setParameterCB;
  45. + vstEffect.getParameterValueFunction = getParameterCB;
  46. vstEffect.numPrograms = jmax (1, af->getNumPrograms());
  47. - vstEffect.numParams = juceParameters.getNumParameters();
  48. - vstEffect.numInputs = maxNumInChannels;
  49. - vstEffect.numOutputs = maxNumOutChannels;
  50. - vstEffect.initialDelay = processor->getLatencySamples();
  51. - vstEffect.object = this;
  52. - vstEffect.uniqueID = JucePlugin_VSTUniqueID;
  53. + vstEffect.numParameters = juceParameters.getNumParameters();
  54. + vstEffect.numInputChannels = maxNumInChannels;
  55. + vstEffect.numOutputChannels = maxNumOutChannels;
  56. + vstEffect.latency = processor->getLatencySamples();
  57. + vstEffect.effectPointer = this;
  58. + vstEffect.plugInIdentifier = JucePlugin_VSTUniqueID;
  59. #ifdef JucePlugin_VSTChunkStructureVersion
  60. - vstEffect.version = JucePlugin_VSTChunkStructureVersion;
  61. + vstEffect.plugInVersion = JucePlugin_VSTChunkStructureVersion;
  62. #else
  63. - vstEffect.version = JucePlugin_VersionCode;
  64. + vstEffect.plugInVersion = JucePlugin_VersionCode;
  65. #endif
  66. - vstEffect.processReplacing = (Vst2::AEffectProcessProc) processReplacingCB;
  67. - vstEffect.processDoubleReplacing = (Vst2::AEffectProcessDoubleProc) processDoubleReplacingCB;
  68. + vstEffect.processAudioInplaceFunction = processReplacingCB;
  69. + vstEffect.processDoubleAudioInplaceFunction = processDoubleReplacingCB;
  70. - vstEffect.flags |= Vst2::effFlagsHasEditor;
  71. + vstEffect.flags |= Vst2::vstEffectFlagHasEditor;
  72. - vstEffect.flags |= Vst2::effFlagsCanReplacing;
  73. + vstEffect.flags |= Vst2::vstEffectFlagInplaceAudio;
  74. if (processor->supportsDoublePrecisionProcessing())
  75. - vstEffect.flags |= Vst2::effFlagsCanDoubleReplacing;
  76. + vstEffect.flags |= Vst2::vstEffectFlagInplaceDoubleAudio;
  77. - vstEffect.flags |= Vst2::effFlagsProgramChunks;
  78. + vstEffect.flags |= Vst2::vstEffectFlagDataInChunks;
  79. #if JucePlugin_IsSynth
  80. - vstEffect.flags |= Vst2::effFlagsIsSynth;
  81. + vstEffect.flags |= Vst2::vstEffectFlagIsSynth;
  82. #else
  83. if (processor->getTailLengthSeconds() == 0.0)
  84. - vstEffect.flags |= Vst2::effFlagsNoSoundInStop;
  85. + vstEffect.flags |= 512;
  86. #endif
  87. activePlugins.add (this);
  88. @@ -398,7 +390,7 @@ public:
  89. }
  90. }
  91. - Vst2::AEffect* getAEffect() noexcept { return &vstEffect; }
  92. + Vst2::VstEffectInterface* getAEffect() noexcept { return &vstEffect; }
  93. template <typename FloatType>
  94. void internalProcessReplacing (FloatType** inputs, FloatType** outputs,
  95. @@ -533,7 +525,7 @@ public:
  96. // Send VST events to the host.
  97. if (hostCallback != nullptr)
  98. - hostCallback (&vstEffect, Vst2::audioMasterProcessEvents, 0, 0, outgoingEvents.events, 0);
  99. + hostCallback (&vstEffect, Vst2::hostOpcodePreAudioProcessingEvents, 0, 0, outgoingEvents.events, 0);
  100. #elif JUCE_DEBUG
  101. /* This assertion is caused when you've added some events to the
  102. midiMessages array in your processBlock() method, which usually means
  103. @@ -562,7 +554,7 @@ public:
  104. internalProcessReplacing (inputs, outputs, sampleFrames, floatTempBuffers);
  105. }
  106. - static void processReplacingCB (Vst2::AEffect* vstInterface, float** inputs, float** outputs, int32 sampleFrames)
  107. + static void processReplacingCB (Vst2::VstEffectInterface* vstInterface, float** inputs, float** outputs, int32 sampleFrames)
  108. {
  109. getWrapper (vstInterface)->processReplacing (inputs, outputs, sampleFrames);
  110. }
  111. @@ -573,7 +565,7 @@ public:
  112. internalProcessReplacing (inputs, outputs, sampleFrames, doubleTempBuffers);
  113. }
  114. - static void processDoubleReplacingCB (Vst2::AEffect* vstInterface, double** inputs, double** outputs, int32 sampleFrames)
  115. + static void processDoubleReplacingCB (Vst2::VstEffectInterface* vstInterface, double** inputs, double** outputs, int32 sampleFrames)
  116. {
  117. getWrapper (vstInterface)->processDoubleReplacing (inputs, outputs, sampleFrames);
  118. }
  119. @@ -585,7 +577,7 @@ public:
  120. {
  121. isProcessing = true;
  122. - auto numInAndOutChannels = static_cast<size_t> (vstEffect.numInputs + vstEffect.numOutputs);
  123. + auto numInAndOutChannels = static_cast<size_t> (vstEffect.numInputChannels + vstEffect.numOutputChannels);
  124. floatTempBuffers .channels.calloc (numInAndOutChannels);
  125. doubleTempBuffers.channels.calloc (numInAndOutChannels);
  126. @@ -604,16 +596,16 @@ public:
  127. midiEvents.ensureSize (2048);
  128. midiEvents.clear();
  129. - vstEffect.initialDelay = processor->getLatencySamples();
  130. + vstEffect.latency = processor->getLatencySamples();
  131. /** If this plug-in is a synth or it can receive midi events we need to tell the
  132. host that we want midi. In the SDK this method is marked as deprecated, but
  133. some hosts rely on this behaviour.
  134. */
  135. - if (vstEffect.flags & Vst2::effFlagsIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect)
  136. + if (vstEffect.flags & Vst2::vstEffectFlagIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect)
  137. {
  138. if (hostCallback != nullptr)
  139. - hostCallback (&vstEffect, Vst2::audioMasterWantMidi, 0, 1, nullptr, 0);
  140. + hostCallback (&vstEffect, Vst2::hostOpcodePlugInWantsMidi, 0, 1, nullptr, 0);
  141. }
  142. if (getHostType().isAbletonLive()
  143. @@ -627,7 +619,7 @@ public:
  144. hostCmd.commandSize = sizeof (int);
  145. hostCmd.flags = AbletonLiveHostSpecific::KCantBeSuspended;
  146. - hostCallback (&vstEffect, Vst2::audioMasterVendorSpecific, 0, 0, &hostCmd, 0.0f);
  147. + hostCallback (&vstEffect, Vst2::hostOpcodeManufacturerSpecific, 0, 0, &hostCmd, 0.0f);
  148. }
  149. #if JucePlugin_ProducesMidiOutput || JucePlugin_IsMidiEffect
  150. @@ -654,28 +646,28 @@ public:
  151. //==============================================================================
  152. bool getCurrentPosition (AudioPlayHead::CurrentPositionInfo& info) override
  153. {
  154. - const Vst2::VstTimeInfo* ti = nullptr;
  155. + const Vst2::VstTimingInformation* ti = nullptr;
  156. if (hostCallback != nullptr)
  157. {
  158. - int32 flags = Vst2::kVstPpqPosValid | Vst2::kVstTempoValid
  159. - | Vst2::kVstBarsValid | Vst2::kVstCyclePosValid
  160. - | Vst2::kVstTimeSigValid | Vst2::kVstSmpteValid
  161. - | Vst2::kVstClockValid;
  162. + int32 flags = Vst2::vstTimingInfoFlagMusicalPositionValid | Vst2::vstTimingInfoFlagTempoValid
  163. + | Vst2::vstTimingInfoFlagLastBarPositionValid | Vst2::vstTimingInfoFlagLoopPositionValid
  164. + | Vst2::vstTimingInfoFlagTimeSignatureValid | Vst2::vstTimingInfoFlagSmpteValid
  165. + | Vst2::vstTimingInfoFlagNearestClockValid;
  166. - auto result = hostCallback (&vstEffect, Vst2::audioMasterGetTime, 0, flags, nullptr, 0);
  167. - ti = reinterpret_cast<Vst2::VstTimeInfo*> (result);
  168. + auto result = hostCallback (&vstEffect, Vst2::hostOpcodeGetTimingInfo, 0, flags, nullptr, 0);
  169. + ti = reinterpret_cast<Vst2::VstTimingInformation*> (result);
  170. }
  171. if (ti == nullptr || ti->sampleRate <= 0)
  172. return false;
  173. - info.bpm = (ti->flags & Vst2::kVstTempoValid) != 0 ? ti->tempo : 0.0;
  174. + info.bpm = (ti->flags & Vst2::vstTimingInfoFlagTempoValid) != 0 ? ti->tempoBPM : 0.0;
  175. - if ((ti->flags & Vst2::kVstTimeSigValid) != 0)
  176. + if ((ti->flags & Vst2::vstTimingInfoFlagTimeSignatureValid) != 0)
  177. {
  178. - info.timeSigNumerator = ti->timeSigNumerator;
  179. - info.timeSigDenominator = ti->timeSigDenominator;
  180. + info.timeSigNumerator = ti->timeSignatureNumerator;
  181. + info.timeSigDenominator = ti->timeSignatureDenominator;
  182. }
  183. else
  184. {
  185. @@ -683,34 +675,34 @@ public:
  186. info.timeSigDenominator = 4;
  187. }
  188. - info.timeInSamples = (int64) (ti->samplePos + 0.5);
  189. - info.timeInSeconds = ti->samplePos / ti->sampleRate;
  190. - info.ppqPosition = (ti->flags & Vst2::kVstPpqPosValid) != 0 ? ti->ppqPos : 0.0;
  191. - info.ppqPositionOfLastBarStart = (ti->flags & Vst2::kVstBarsValid) != 0 ? ti->barStartPos : 0.0;
  192. + info.timeInSamples = (int64) (ti->samplePosition + 0.5);
  193. + info.timeInSeconds = ti->samplePosition / ti->sampleRate;
  194. + info.ppqPosition = (ti->flags & Vst2::vstTimingInfoFlagMusicalPositionValid) != 0 ? ti->musicalPosition : 0.0;
  195. + info.ppqPositionOfLastBarStart = (ti->flags & Vst2::vstTimingInfoFlagLastBarPositionValid) != 0 ? ti->lastBarPosition : 0.0;
  196. - if ((ti->flags & Vst2::kVstSmpteValid) != 0)
  197. + if ((ti->flags & Vst2::vstTimingInfoFlagSmpteValid) != 0)
  198. {
  199. AudioPlayHead::FrameRateType rate = AudioPlayHead::fpsUnknown;
  200. double fps = 1.0;
  201. - switch (ti->smpteFrameRate)
  202. + switch (ti->smpteRate)
  203. {
  204. - case Vst2::kVstSmpte239fps: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break;
  205. - case Vst2::kVstSmpte24fps: rate = AudioPlayHead::fps24; fps = 24.0; break;
  206. - case Vst2::kVstSmpte25fps: rate = AudioPlayHead::fps25; fps = 25.0; break;
  207. - case Vst2::kVstSmpte2997fps: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break;
  208. - case Vst2::kVstSmpte30fps: rate = AudioPlayHead::fps30; fps = 30.0; break;
  209. - case Vst2::kVstSmpte2997dfps: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break;
  210. - case Vst2::kVstSmpte30dfps: rate = AudioPlayHead::fps30drop; fps = 30.0; break;
  211. -
  212. - case Vst2::kVstSmpteFilm16mm:
  213. - case Vst2::kVstSmpteFilm35mm: fps = 24.0; break;
  214. -
  215. - case Vst2::kVstSmpte249fps: fps = 25.0 * 1000.0 / 1001.0; break;
  216. - case Vst2::kVstSmpte599fps: fps = 60.0 * 1000.0 / 1001.0; break;
  217. - case Vst2::kVstSmpte60fps: fps = 60; break;
  218. -
  219. - default: jassertfalse; // unknown frame-rate..
  220. + case Vst2::vstSmpteRateFps239: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break;
  221. + case Vst2::vstSmpteRateFps24: rate = AudioPlayHead::fps24; fps = 24.0; break;
  222. + case Vst2::vstSmpteRateFps25: rate = AudioPlayHead::fps25; fps = 25.0; break;
  223. + case Vst2::vstSmpteRateFps2997: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break;
  224. + case Vst2::vstSmpteRateFps30: rate = AudioPlayHead::fps30; fps = 30.0; break;
  225. + case Vst2::vstSmpteRateFps2997drop: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break;
  226. + case Vst2::vstSmpteRateFps30drop: rate = AudioPlayHead::fps30drop; fps = 30.0; break;
  227. +
  228. + case Vst2::vstSmpteRate16mmFilm:
  229. + case Vst2::vstSmpteRate35mmFilm: fps = 24.0; break;
  230. +
  231. + case Vst2::vstSmpteRateFps249: fps = 25.0 * 1000.0 / 1001.0; break;
  232. + case Vst2::vstSmpteRateFps599: fps = 60.0 * 1000.0 / 1001.0; break;
  233. + case Vst2::vstSmpteRateFps60: fps = 60; break;
  234. +
  235. + default: jassertfalse; // unknown frame-rate..
  236. }
  237. info.frameRate = rate;
  238. @@ -722,14 +714,14 @@ public:
  239. info.editOriginTime = 0;
  240. }
  241. - info.isRecording = (ti->flags & Vst2::kVstTransportRecording) != 0;
  242. - info.isPlaying = (ti->flags & (Vst2::kVstTransportRecording | Vst2::kVstTransportPlaying)) != 0;
  243. - info.isLooping = (ti->flags & Vst2::kVstTransportCycleActive) != 0;
  244. + info.isRecording = (ti->flags & Vst2::vstTimingInfoFlagCurrentlyRecording) != 0;
  245. + info.isPlaying = (ti->flags & (Vst2::vstTimingInfoFlagCurrentlyRecording | Vst2::vstTimingInfoFlagCurrentlyPlaying)) != 0;
  246. + info.isLooping = (ti->flags & Vst2::vstTimingInfoFlagLoopActive) != 0;
  247. - if ((ti->flags & Vst2::kVstCyclePosValid) != 0)
  248. + if ((ti->flags & Vst2::vstTimingInfoFlagLoopPositionValid) != 0)
  249. {
  250. - info.ppqLoopStart = ti->cycleStartPos;
  251. - info.ppqLoopEnd = ti->cycleEndPos;
  252. + info.ppqLoopStart = ti->loopStartPosition;
  253. + info.ppqLoopEnd = ti->loopEndPosition;
  254. }
  255. else
  256. {
  257. @@ -749,7 +741,7 @@ public:
  258. return 0.0f;
  259. }
  260. - static float getParameterCB (Vst2::AEffect* vstInterface, int32 index)
  261. + static float getParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index)
  262. {
  263. return getWrapper (vstInterface)->getParameter (index);
  264. }
  265. @@ -765,7 +757,7 @@ public:
  266. }
  267. }
  268. - static void setParameterCB (Vst2::AEffect* vstInterface, int32 index, float value)
  269. + static void setParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index, float value)
  270. {
  271. getWrapper (vstInterface)->setParameter (index, value);
  272. }
  273. @@ -779,19 +771,19 @@ public:
  274. }
  275. if (hostCallback != nullptr)
  276. - hostCallback (&vstEffect, Vst2::audioMasterAutomate, index, 0, nullptr, newValue);
  277. + hostCallback (&vstEffect, Vst2::hostOpcodeParameterChanged, index, 0, nullptr, newValue);
  278. }
  279. void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int index) override
  280. {
  281. if (hostCallback != nullptr)
  282. - hostCallback (&vstEffect, Vst2::audioMasterBeginEdit, index, 0, nullptr, 0);
  283. + hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureBegin, index, 0, nullptr, 0);
  284. }
  285. void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int index) override
  286. {
  287. if (hostCallback != nullptr)
  288. - hostCallback (&vstEffect, Vst2::audioMasterEndEdit, index, 0, nullptr, 0);
  289. + hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureEnd, index, 0, nullptr, 0);
  290. }
  291. void parameterValueChanged (int, float newValue) override
  292. @@ -804,7 +796,7 @@ public:
  293. void audioProcessorChanged (AudioProcessor*) override
  294. {
  295. - vstEffect.initialDelay = processor->getLatencySamples();
  296. + vstEffect.latency = processor->getLatencySamples();
  297. triggerAsyncUpdate();
  298. }
  299. @@ -812,12 +804,12 @@ public:
  300. {
  301. if (hostCallback != nullptr)
  302. {
  303. - hostCallback (&vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, nullptr, 0);
  304. - hostCallback (&vstEffect, Vst2::audioMasterIOChanged, 0, 0, nullptr, 0);
  305. + hostCallback (&vstEffect, Vst2::hostOpcodeUpdateView, 0, 0, nullptr, 0);
  306. + hostCallback (&vstEffect, Vst2::hostOpcodeIOModified, 0, 0, nullptr, 0);
  307. }
  308. }
  309. - bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const
  310. + bool getPinProperties (Vst2::VstPinInfo& properties, bool direction, int index) const
  311. {
  312. if (processor->isMidiEffect())
  313. return false;
  314. @@ -826,9 +818,9 @@ public:
  315. // fill with default
  316. properties.flags = 0;
  317. - properties.label[0] = 0;
  318. - properties.shortLabel[0] = 0;
  319. - properties.arrangementType = Vst2::kSpeakerArrEmpty;
  320. + properties.text[0] = 0;
  321. + properties.shortText[0] = 0;
  322. + properties.configurationType = Vst2::vstSpeakerConfigTypeEmpty;
  323. if ((channelIdx = processor->getOffsetInBusBufferForAbsoluteChannelIndex (direction, index, busIdx)) >= 0)
  324. {
  325. @@ -836,8 +828,8 @@ public:
  326. auto& channelSet = bus.getCurrentLayout();
  327. auto channelType = channelSet.getTypeOfChannel (channelIdx);
  328. - properties.flags = Vst2::kVstPinIsActive | Vst2::kVstPinUseSpeaker;
  329. - properties.arrangementType = SpeakerMappings::channelSetToVstArrangementType (channelSet);
  330. + properties.flags = Vst2::vstPinInfoFlagIsActive | Vst2::vstPinInfoFlagValid;
  331. + properties.configurationType = SpeakerMappings::channelSetToVstArrangementType (channelSet);
  332. String label = bus.getName();
  333. #ifdef JucePlugin_PreferredChannelConfigurations
  334. @@ -847,8 +839,8 @@ public:
  335. label += " " + AudioChannelSet::getAbbreviatedChannelTypeName (channelType);
  336. #endif
  337. - label.copyToUTF8 (properties.label, (size_t) (Vst2::kVstMaxLabelLen + 1));
  338. - label.copyToUTF8 (properties.shortLabel, (size_t) (Vst2::kVstMaxShortLabelLen + 1));
  339. + label.copyToUTF8 (properties.text, (size_t) (Vst2::vstMaxParameterOrPinLabelLength + 1));
  340. + label.copyToUTF8 (properties.shortText, (size_t) (Vst2::vstMaxParameterOrPinShortLabelLength + 1));
  341. if (channelType == AudioChannelSet::left
  342. || channelType == AudioChannelSet::leftSurround
  343. @@ -858,7 +850,7 @@ public:
  344. || channelType == AudioChannelSet::topRearLeft
  345. || channelType == AudioChannelSet::leftSurroundRear
  346. || channelType == AudioChannelSet::wideLeft)
  347. - properties.flags |= Vst2::kVstPinIsStereo;
  348. + properties.flags |= Vst2::vstPinInfoFlagIsStereo;
  349. return true;
  350. }
  351. @@ -893,15 +885,15 @@ public:
  352. void setHasEditorFlag (bool shouldSetHasEditor)
  353. {
  354. - auto hasEditor = (vstEffect.flags & Vst2::effFlagsHasEditor) != 0;
  355. + auto hasEditor = (vstEffect.flags & Vst2::vstEffectFlagHasEditor) != 0;
  356. if (shouldSetHasEditor == hasEditor)
  357. return;
  358. if (shouldSetHasEditor)
  359. - vstEffect.flags |= Vst2::effFlagsHasEditor;
  360. + vstEffect.flags |= Vst2::vstEffectFlagHasEditor;
  361. else
  362. - vstEffect.flags &= ~Vst2::effFlagsHasEditor;
  363. + vstEffect.flags &= ~Vst2::vstEffectFlagHasEditor;
  364. }
  365. void createEditorComp()
  366. @@ -968,59 +960,59 @@ public:
  367. switch (opCode)
  368. {
  369. - case Vst2::effOpen: return handleOpen (args);
  370. - case Vst2::effClose: return handleClose (args);
  371. - case Vst2::effSetProgram: return handleSetCurrentProgram (args);
  372. - case Vst2::effGetProgram: return handleGetCurrentProgram (args);
  373. - case Vst2::effSetProgramName: return handleSetCurrentProgramName (args);
  374. - case Vst2::effGetProgramName: return handleGetCurrentProgramName (args);
  375. - case Vst2::effGetParamLabel: return handleGetParameterLabel (args);
  376. - case Vst2::effGetParamDisplay: return handleGetParameterText (args);
  377. - case Vst2::effGetParamName: return handleGetParameterName (args);
  378. - case Vst2::effSetSampleRate: return handleSetSampleRate (args);
  379. - case Vst2::effSetBlockSize: return handleSetBlockSize (args);
  380. - case Vst2::effMainsChanged: return handleResumeSuspend (args);
  381. - case Vst2::effEditGetRect: return handleGetEditorBounds (args);
  382. - case Vst2::effEditOpen: return handleOpenEditor (args);
  383. - case Vst2::effEditClose: return handleCloseEditor (args);
  384. - case Vst2::effIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf");
  385. - case Vst2::effGetChunk: return handleGetData (args);
  386. - case Vst2::effSetChunk: return handleSetData (args);
  387. - case Vst2::effProcessEvents: return handlePreAudioProcessingEvents (args);
  388. - case Vst2::effCanBeAutomated: return handleIsParameterAutomatable (args);
  389. - case Vst2::effString2Parameter: return handleParameterValueForText (args);
  390. - case Vst2::effGetProgramNameIndexed: return handleGetProgramName (args);
  391. - case Vst2::effGetInputProperties: return handleGetInputPinProperties (args);
  392. - case Vst2::effGetOutputProperties: return handleGetOutputPinProperties (args);
  393. - case Vst2::effGetPlugCategory: return handleGetPlugInCategory (args);
  394. - case Vst2::effSetSpeakerArrangement: return handleSetSpeakerConfiguration (args);
  395. - case Vst2::effSetBypass: return handleSetBypass (args);
  396. - case Vst2::effGetEffectName: return handleGetPlugInName (args);
  397. - case Vst2::effGetProductString: return handleGetPlugInName (args);
  398. - case Vst2::effGetVendorString: return handleGetManufacturerName (args);
  399. - case Vst2::effGetVendorVersion: return handleGetManufacturerVersion (args);
  400. - case Vst2::effVendorSpecific: return handleManufacturerSpecific (args);
  401. - case Vst2::effCanDo: return handleCanPlugInDo (args);
  402. - case Vst2::effGetTailSize: return handleGetTailSize (args);
  403. - case Vst2::effKeysRequired: return handleKeyboardFocusRequired (args);
  404. - case Vst2::effGetVstVersion: return handleGetVstInterfaceVersion (args);
  405. - case Vst2::effGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args);
  406. - case Vst2::effGetSpeakerArrangement: return handleGetSpeakerConfiguration (args);
  407. - case Vst2::effSetTotalSampleToProcess: return handleSetNumberOfSamplesToProcess (args);
  408. - case Vst2::effSetProcessPrecision: return handleSetSampleFloatType (args);
  409. - case Vst2::effGetNumMidiInputChannels: return handleGetNumMidiInputChannels();
  410. - case Vst2::effGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels();
  411. - default: return 0;
  412. - }
  413. - }
  414. -
  415. - static pointer_sized_int dispatcherCB (Vst2::AEffect* vstInterface, int32 opCode, int32 index,
  416. + case Vst2::plugInOpcodeOpen: return handleOpen (args);
  417. + case Vst2::plugInOpcodeClose: return handleClose (args);
  418. + case Vst2::plugInOpcodeSetCurrentProgram: return handleSetCurrentProgram (args);
  419. + case Vst2::plugInOpcodeGetCurrentProgram: return handleGetCurrentProgram (args);
  420. + case Vst2::plugInOpcodeSetCurrentProgramName: return handleSetCurrentProgramName (args);
  421. + case Vst2::plugInOpcodeGetCurrentProgramName: return handleGetCurrentProgramName (args);
  422. + case Vst2::plugInOpcodeGetParameterLabel: return handleGetParameterLabel (args);
  423. + case Vst2::plugInOpcodeGetParameterText: return handleGetParameterText (args);
  424. + case Vst2::plugInOpcodeGetParameterName: return handleGetParameterName (args);
  425. + case Vst2::plugInOpcodeSetSampleRate: return handleSetSampleRate (args);
  426. + case Vst2::plugInOpcodeSetBlockSize: return handleSetBlockSize (args);
  427. + case Vst2::plugInOpcodeResumeSuspend: return handleResumeSuspend (args);
  428. + case Vst2::plugInOpcodeGetEditorBounds: return handleGetEditorBounds (args);
  429. + case Vst2::plugInOpcodeOpenEditor: return handleOpenEditor (args);
  430. + case Vst2::plugInOpcodeCloseEditor: return handleCloseEditor (args);
  431. + case Vst2::plugInOpcodeIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf");
  432. + case Vst2::plugInOpcodeGetData: return handleGetData (args);
  433. + case Vst2::plugInOpcodeSetData: return handleSetData (args);
  434. + case Vst2::plugInOpcodePreAudioProcessingEvents: return handlePreAudioProcessingEvents (args);
  435. + case Vst2::plugInOpcodeIsParameterAutomatable: return handleIsParameterAutomatable (args);
  436. + case Vst2::plugInOpcodeParameterValueForText: return handleParameterValueForText (args);
  437. + case Vst2::plugInOpcodeGetProgramName: return handleGetProgramName (args);
  438. + case Vst2::plugInOpcodeGetInputPinProperties: return handleGetInputPinProperties (args);
  439. + case Vst2::plugInOpcodeGetOutputPinProperties: return handleGetOutputPinProperties (args);
  440. + case Vst2::plugInOpcodeGetPlugInCategory: return handleGetPlugInCategory (args);
  441. + case Vst2::plugInOpcodeSetSpeakerConfiguration: return handleSetSpeakerConfiguration (args);
  442. + case Vst2::plugInOpcodeSetBypass: return handleSetBypass (args);
  443. + case Vst2::plugInOpcodeGetPlugInName: return handleGetPlugInName (args);
  444. + case Vst2::plugInOpcodeGetManufacturerProductName: return handleGetPlugInName (args);
  445. + case Vst2::plugInOpcodeGetManufacturerName: return handleGetManufacturerName (args);
  446. + case Vst2::plugInOpcodeGetManufacturerVersion: return handleGetManufacturerVersion (args);
  447. + case Vst2::plugInOpcodeManufacturerSpecific: return handleManufacturerSpecific (args);
  448. + case Vst2::plugInOpcodeCanPlugInDo: return handleCanPlugInDo (args);
  449. + case Vst2::plugInOpcodeGetTailSize: return handleGetTailSize (args);
  450. + case Vst2::plugInOpcodeKeyboardFocusRequired: return handleKeyboardFocusRequired (args);
  451. + case Vst2::plugInOpcodeGetVstInterfaceVersion: return handleGetVstInterfaceVersion (args);
  452. + case Vst2::plugInOpcodeGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args);
  453. + case Vst2::plugInOpcodeGetSpeakerArrangement: return handleGetSpeakerConfiguration (args);
  454. + case Vst2::plugInOpcodeSetNumberOfSamplesToProcess: return handleSetNumberOfSamplesToProcess (args);
  455. + case Vst2::plugInOpcodeSetSampleFloatType: return handleSetSampleFloatType (args);
  456. + case Vst2::pluginOpcodeGetNumMidiInputChannels: return handleGetNumMidiInputChannels();
  457. + case Vst2::pluginOpcodeGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels();
  458. + default: return 0;
  459. + }
  460. + }
  461. +
  462. + static pointer_sized_int dispatcherCB (Vst2::VstEffectInterface* vstInterface, int32 opCode, int32 index,
  463. pointer_sized_int value, void* ptr, float opt)
  464. {
  465. auto* wrapper = getWrapper (vstInterface);
  466. VstOpCodeArguments args = { index, value, ptr, opt };
  467. - if (opCode == Vst2::effClose)
  468. + if (opCode == Vst2::plugInOpcodeClose)
  469. {
  470. wrapper->dispatcher (opCode, args);
  471. delete wrapper;
  472. @@ -1068,7 +1060,7 @@ public:
  473. void paint (Graphics&) override {}
  474. - void getEditorBounds (Vst2::ERect& bounds)
  475. + void getEditorBounds (Vst2::VstEditorBounds& bounds)
  476. {
  477. auto b = getSizeToContainChild();
  478. bounds = convertToHostBounds ({ 0, 0, (int16) b.getHeight(), (int16) b.getWidth() });
  479. @@ -1224,20 +1216,20 @@ public:
  480. void resizeHostWindow (int newWidth, int newHeight)
  481. {
  482. auto rect = convertToHostBounds ({ 0, 0, (int16) newHeight, (int16) newWidth });
  483. - newWidth = rect.right - rect.left;
  484. - newHeight = rect.bottom - rect.top;
  485. + newWidth = rect.rightmost - rect.leftmost;
  486. + newHeight = rect.lower - rect.upper;
  487. bool sizeWasSuccessful = false;
  488. if (auto host = wrapper.hostCallback)
  489. {
  490. - auto status = host (wrapper.getAEffect(), Vst2::audioMasterCanDo, 0, 0, const_cast<char*> ("sizeWindow"), 0);
  491. + auto status = host (wrapper.getAEffect(), Vst2::hostOpcodeCanHostDo, 0, 0, const_cast<char*> ("sizeWindow"), 0);
  492. if (status == (pointer_sized_int) 1 || getHostType().isAbletonLive())
  493. {
  494. const ScopedValueSetter<bool> inSizeWindowSetter (isInSizeWindow, true);
  495. - sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow,
  496. + sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::hostOpcodeWindowSize,
  497. newWidth, newHeight, nullptr, 0) != 0);
  498. }
  499. }
  500. @@ -1359,17 +1351,17 @@ public:
  501. #endif
  502. //==============================================================================
  503. - static Vst2::ERect convertToHostBounds (const Vst2::ERect& rect)
  504. + static Vst2::VstEditorBounds convertToHostBounds (const Vst2::VstEditorBounds& rect)
  505. {
  506. auto desktopScale = Desktop::getInstance().getGlobalScaleFactor();
  507. if (approximatelyEqual (desktopScale, 1.0f))
  508. return rect;
  509. - return { (int16) roundToInt (rect.top * desktopScale),
  510. - (int16) roundToInt (rect.left * desktopScale),
  511. - (int16) roundToInt (rect.bottom * desktopScale),
  512. - (int16) roundToInt (rect.right * desktopScale) };
  513. + return { (int16) roundToInt (rect.upper * desktopScale),
  514. + (int16) roundToInt (rect.leftmost * desktopScale),
  515. + (int16) roundToInt (rect.lower * desktopScale),
  516. + (int16) roundToInt (rect.rightmost * desktopScale)};
  517. }
  518. //==============================================================================
  519. @@ -1398,12 +1390,12 @@ public:
  520. //==============================================================================
  521. private:
  522. - static JuceVSTWrapper* getWrapper (Vst2::AEffect* v) noexcept { return static_cast<JuceVSTWrapper*> (v->object); }
  523. + static JuceVSTWrapper* getWrapper (Vst2::VstEffectInterface* v) noexcept { return static_cast<JuceVSTWrapper*> (v->effectPointer); }
  524. bool isProcessLevelOffline()
  525. {
  526. return hostCallback != nullptr
  527. - && (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, nullptr, 0) == 4;
  528. + && (int32) hostCallback (&vstEffect, Vst2::hostOpcodeGetCurrentAudioProcessingLevel, 0, 0, nullptr, 0) == 4;
  529. }
  530. static int32 convertHexVersionToDecimal (const unsigned int hexVersion)
  531. @@ -1471,8 +1463,8 @@ private:
  532. tmpBuffers.release();
  533. if (processor != nullptr)
  534. - tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputs
  535. - + vstEffect.numOutputs);
  536. + tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputChannels
  537. + + vstEffect.numOutputChannels);
  538. }
  539. void deleteTempChannels()
  540. @@ -1632,7 +1624,7 @@ private:
  541. if (editorComp != nullptr)
  542. {
  543. editorComp->getEditorBounds (editorBounds);
  544. - *((Vst2::ERect**) args.ptr) = &editorBounds;
  545. + *((Vst2::VstEditorBounds**) args.ptr) = &editorBounds;
  546. return (pointer_sized_int) &editorBounds;
  547. }
  548. @@ -1722,7 +1714,7 @@ private:
  549. pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args)
  550. {
  551. #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect
  552. - VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents);
  553. + VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEventBlock*) args.ptr, midiEvents);
  554. return 1;
  555. #else
  556. ignoreUnused (args);
  557. @@ -1773,12 +1765,12 @@ private:
  558. pointer_sized_int handleGetInputPinProperties (VstOpCodeArguments args)
  559. {
  560. - return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, true, args.index)) ? 1 : 0;
  561. + return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, true, args.index)) ? 1 : 0;
  562. }
  563. pointer_sized_int handleGetOutputPinProperties (VstOpCodeArguments args)
  564. {
  565. - return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, false, args.index)) ? 1 : 0;
  566. + return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, false, args.index)) ? 1 : 0;
  567. }
  568. pointer_sized_int handleGetPlugInCategory (VstOpCodeArguments)
  569. @@ -1788,8 +1780,8 @@ private:
  570. pointer_sized_int handleSetSpeakerConfiguration (VstOpCodeArguments args)
  571. {
  572. - auto* pluginInput = reinterpret_cast<Vst2::VstSpeakerArrangement*> (args.value);
  573. - auto* pluginOutput = reinterpret_cast<Vst2::VstSpeakerArrangement*> (args.ptr);
  574. + auto* pluginInput = reinterpret_cast<Vst2::VstSpeakerConfiguration*> (args.value);
  575. + auto* pluginOutput = reinterpret_cast<Vst2::VstSpeakerConfiguration*> (args.ptr);
  576. if (processor->isMidiEffect())
  577. return 0;
  578. @@ -1800,29 +1792,29 @@ private:
  579. if (pluginInput != nullptr && pluginInput->type >= 0)
  580. {
  581. // inconsistent request?
  582. - if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numChannels)
  583. + if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numberOfChannels)
  584. return 0;
  585. }
  586. if (pluginOutput != nullptr && pluginOutput->type >= 0)
  587. {
  588. // inconsistent request?
  589. - if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numChannels)
  590. + if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numberOfChannels)
  591. return 0;
  592. }
  593. - if (pluginInput != nullptr && pluginInput->numChannels > 0 && numIns == 0)
  594. + if (pluginInput != nullptr && pluginInput->numberOfChannels > 0 && numIns == 0)
  595. return 0;
  596. - if (pluginOutput != nullptr && pluginOutput->numChannels > 0 && numOuts == 0)
  597. + if (pluginOutput != nullptr && pluginOutput->numberOfChannels > 0 && numOuts == 0)
  598. return 0;
  599. auto layouts = processor->getBusesLayout();
  600. - if (pluginInput != nullptr && pluginInput-> numChannels >= 0 && numIns > 0)
  601. + if (pluginInput != nullptr && pluginInput-> numberOfChannels >= 0 && numIns > 0)
  602. layouts.getChannelSet (true, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput);
  603. - if (pluginOutput != nullptr && pluginOutput->numChannels >= 0 && numOuts > 0)
  604. + if (pluginOutput != nullptr && pluginOutput->numberOfChannels >= 0 && numOuts > 0)
  605. layouts.getChannelSet (false, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput);
  606. #ifdef JucePlugin_PreferredChannelConfigurations
  607. @@ -1870,7 +1862,7 @@ private:
  608. && args.value == (int32) ByteOrder::bigEndianInt ("AeCs"))
  609. return handleSetContentScaleFactor (args.opt);
  610. - if (args.index == Vst2::effGetParamDisplay)
  611. + if (args.index == Vst2::plugInOpcodeGetParameterText)
  612. return handleCockosGetParameterText (args.value, args.ptr, args.opt);
  613. if (auto callbackHandler = dynamic_cast<VSTCallbackHandler*> (processor))
  614. @@ -1965,7 +1957,7 @@ private:
  615. pointer_sized_int handleGetVstInterfaceVersion (VstOpCodeArguments)
  616. {
  617. - return kVstVersion;
  618. + return Vst2::juceVstInterfaceVersion;
  619. }
  620. pointer_sized_int handleGetCurrentMidiProgram (VstOpCodeArguments)
  621. @@ -1975,8 +1967,8 @@ private:
  622. pointer_sized_int handleGetSpeakerConfiguration (VstOpCodeArguments args)
  623. {
  624. - auto** pluginInput = reinterpret_cast<Vst2::VstSpeakerArrangement**> (args.value);
  625. - auto** pluginOutput = reinterpret_cast<Vst2::VstSpeakerArrangement**> (args.ptr);
  626. + auto** pluginInput = reinterpret_cast<Vst2::VstSpeakerConfiguration**> (args.value);
  627. + auto** pluginOutput = reinterpret_cast<Vst2::VstSpeakerConfiguration**> (args.ptr);
  628. if (pluginHasSidechainsOrAuxs() || processor->isMidiEffect())
  629. return false;
  630. @@ -1984,10 +1976,10 @@ private:
  631. auto inputLayout = processor->getChannelLayoutOfBus (true, 0);
  632. auto outputLayout = processor->getChannelLayoutOfBus (false, 0);
  633. - auto speakerBaseSize = sizeof (Vst2::VstSpeakerArrangement) - (sizeof (Vst2::VstSpeakerProperties) * 8);
  634. + auto speakerBaseSize = sizeof (Vst2::VstSpeakerConfiguration) - (sizeof (Vst2::VstIndividualSpeakerInfo) * 8);
  635. - cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (Vst2::VstSpeakerArrangement)), 1);
  636. - cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (Vst2::VstSpeakerArrangement)), 1);
  637. + cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1);
  638. + cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1);
  639. *pluginInput = cachedInArrangement. getData();
  640. *pluginOutput = cachedOutArrangement.getData();
  641. @@ -2009,7 +2001,7 @@ private:
  642. {
  643. if (processor != nullptr)
  644. {
  645. - processor->setProcessingPrecision ((args.value == Vst2::kVstProcessPrecision64
  646. + processor->setProcessingPrecision ((args.value == Vst2::vstProcessingSampleTypeDouble
  647. && processor->supportsDoublePrecisionProcessing())
  648. ? AudioProcessor::doublePrecision
  649. : AudioProcessor::singlePrecision);
  650. @@ -2083,16 +2075,16 @@ private:
  651. }
  652. //==============================================================================
  653. - Vst2::audioMasterCallback hostCallback;
  654. + Vst2::VstHostCallback hostCallback;
  655. AudioProcessor* processor = {};
  656. double sampleRate = 44100.0;
  657. int32 blockSize = 1024;
  658. - Vst2::AEffect vstEffect;
  659. + Vst2::VstEffectInterface vstEffect;
  660. CriticalSection stateInformationLock;
  661. juce::MemoryBlock chunkMemory;
  662. uint32 chunkMemoryTime = 0;
  663. std::unique_ptr<EditorCompWrapper> editorComp;
  664. - Vst2::ERect editorBounds;
  665. + Vst2::VstEditorBounds editorBounds;
  666. MidiBuffer midiEvents;
  667. VSTMidiEventList outgoingEvents;
  668. @@ -2117,7 +2109,7 @@ private:
  669. VstTempBuffers<double> doubleTempBuffers;
  670. int maxNumInChannels = 0, maxNumOutChannels = 0;
  671. - HeapBlock<Vst2::VstSpeakerArrangement> cachedInArrangement, cachedOutArrangement;
  672. + HeapBlock<Vst2::VstSpeakerConfiguration> cachedInArrangement, cachedOutArrangement;
  673. ThreadLocalValue<bool> inParameterChangedCallback;
  674. @@ -2129,7 +2121,7 @@ private:
  675. //==============================================================================
  676. namespace
  677. {
  678. - Vst2::AEffect* pluginEntryPoint (Vst2::audioMasterCallback audioMaster)
  679. + Vst2::VstEffectInterface* pluginEntryPoint (Vst2::VstHostCallback audioMaster)
  680. {
  681. JUCE_AUTORELEASEPOOL
  682. {
  683. @@ -2137,7 +2129,7 @@ namespace
  684. try
  685. {
  686. - if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0)
  687. + if (audioMaster (nullptr, Vst2::hostOpcodeVstVersion, 0, 0, nullptr, 0) != 0)
  688. {
  689. #if JUCE_LINUX
  690. MessageManagerLock mmLock;
  691. @@ -2174,8 +2166,8 @@ namespace
  692. // Mac startup code..
  693. #if JUCE_MAC
  694. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
  695. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
  696. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster);
  697. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster)
  698. {
  699. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  700. @@ -2183,8 +2175,8 @@ namespace
  701. return pluginEntryPoint (audioMaster);
  702. }
  703. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster);
  704. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster)
  705. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster);
  706. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster)
  707. {
  708. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  709. @@ -2196,8 +2188,8 @@ namespace
  710. // Linux startup code..
  711. #elif JUCE_LINUX
  712. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
  713. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
  714. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster);
  715. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster)
  716. {
  717. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  718. @@ -2205,8 +2197,8 @@ namespace
  719. return pluginEntryPoint (audioMaster);
  720. }
  721. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) asm ("main");
  722. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster)
  723. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) asm ("main");
  724. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster)
  725. {
  726. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  727. @@ -2221,7 +2213,7 @@ namespace
  728. // Win32 startup code..
  729. #else
  730. - extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
  731. + extern "C" __declspec (dllexport) Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster)
  732. {
  733. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  734. @@ -2229,7 +2221,7 @@ namespace
  735. }
  736. #if ! defined (JUCE_64BIT) && JUCE_MSVC // (can't compile this on win64, but it's not needed anyway with VST2.4)
  737. - extern "C" __declspec (dllexport) int main (Vst2::audioMasterCallback audioMaster)
  738. + extern "C" __declspec (dllexport) int main (Vst2::VstHostCallback audioMaster)
  739. {
  740. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  741. diff --git a/modules/juce_audio_processors/format_types/juce_VSTCommon.h b/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  742. index e3bd4edc4..b948abe2b 100644
  743. --- a/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  744. +++ b/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  745. @@ -58,25 +58,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  746. static AudioChannelSet vstArrangementTypeToChannelSet (int32 arr, int fallbackNumChannels)
  747. {
  748. - if (arr == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled();
  749. - else if (arr == Vst2::kSpeakerArrMono) return AudioChannelSet::mono();
  750. - else if (arr == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo();
  751. - else if (arr == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR();
  752. - else if (arr == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS();
  753. - else if (arr == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS();
  754. - else if (arr == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0();
  755. - else if (arr == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1();
  756. - else if (arr == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0();
  757. - else if (arr == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1();
  758. - else if (arr == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music();
  759. - else if (arr == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music();
  760. - else if (arr == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0();
  761. - else if (arr == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS();
  762. - else if (arr == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1();
  763. - else if (arr == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS();
  764. - else if (arr == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic();
  765. -
  766. - for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m)
  767. + if (arr == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled();
  768. + else if (arr == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono();
  769. + else if (arr == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo();
  770. + else if (arr == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR();
  771. + else if (arr == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS();
  772. + else if (arr == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS();
  773. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0();
  774. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1();
  775. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0();
  776. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1();
  777. + else if (arr == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music();
  778. + else if (arr == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music();
  779. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0();
  780. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS();
  781. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1();
  782. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS();
  783. + else if (arr == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic();
  784. +
  785. + for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m)
  786. {
  787. if (m->vst2 == arr)
  788. {
  789. @@ -92,53 +92,53 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  790. return AudioChannelSet::discreteChannels (fallbackNumChannels);
  791. }
  792. - static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr)
  793. + static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr)
  794. {
  795. - return vstArrangementTypeToChannelSet (arr.type, arr.numChannels);
  796. + return vstArrangementTypeToChannelSet (arr.type, arr.numberOfChannels);
  797. }
  798. static int32 channelSetToVstArrangementType (AudioChannelSet channels)
  799. {
  800. - if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty;
  801. - else if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono;
  802. - else if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo;
  803. - else if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine;
  804. - else if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music;
  805. - else if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine;
  806. - else if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50;
  807. - else if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51;
  808. - else if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine;
  809. - else if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine;
  810. - else if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music;
  811. - else if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music;
  812. - else if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music;
  813. - else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine;
  814. - else if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music;
  815. - else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine;
  816. - else if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music;
  817. + if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty;
  818. + else if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono;
  819. + else if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR;
  820. + else if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC;
  821. + else if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS;
  822. + else if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS;
  823. + else if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs;
  824. + else if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs;
  825. + else if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs;
  826. + else if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs;
  827. + else if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr;
  828. + else if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr;
  829. + else if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr;
  830. + else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc;
  831. + else if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr;
  832. + else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc;
  833. + else if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs;
  834. if (channels == AudioChannelSet::disabled())
  835. - return Vst2::kSpeakerArrEmpty;
  836. + return Vst2::vstSpeakerConfigTypeEmpty;
  837. auto chans = channels.getChannelTypes();
  838. - for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m)
  839. + for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m)
  840. if (m->matches (chans))
  841. return m->vst2;
  842. - return Vst2::kSpeakerArrUserDefined;
  843. + return Vst2::vstSpeakerConfigTypeUser;
  844. }
  845. - static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerArrangement& result)
  846. + static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerConfiguration& result)
  847. {
  848. result.type = channelSetToVstArrangementType (channels);
  849. - result.numChannels = channels.size();
  850. + result.numberOfChannels = channels.size();
  851. - for (int i = 0; i < result.numChannels; ++i)
  852. + for (int i = 0; i < result.numberOfChannels; ++i)
  853. {
  854. auto& speaker = result.speakers[i];
  855. - zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties));
  856. + zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo));
  857. speaker.type = getSpeakerType (channels.getTypeOfChannel (i));
  858. }
  859. }
  860. @@ -152,7 +152,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  861. clear();
  862. }
  863. - VstSpeakerConfigurationHolder (const Vst2::VstSpeakerArrangement& vstConfig)
  864. + VstSpeakerConfigurationHolder (const Vst2::VstSpeakerConfiguration& vstConfig)
  865. {
  866. operator= (vstConfig);
  867. }
  868. @@ -171,29 +171,29 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  869. VstSpeakerConfigurationHolder (const AudioChannelSet& channels)
  870. {
  871. auto numberOfChannels = channels.size();
  872. - Vst2::VstSpeakerArrangement& dst = *allocate (numberOfChannels);
  873. + Vst2::VstSpeakerConfiguration& dst = *allocate (numberOfChannels);
  874. dst.type = channelSetToVstArrangementType (channels);
  875. - dst.numChannels = numberOfChannels;
  876. + dst.numberOfChannels = numberOfChannels;
  877. - for (int i = 0; i < dst.numChannels; ++i)
  878. + for (int i = 0; i < dst.numberOfChannels; ++i)
  879. {
  880. - Vst2::VstSpeakerProperties& speaker = dst.speakers[i];
  881. + Vst2::VstIndividualSpeakerInfo& speaker = dst.speakers[i];
  882. - zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties));
  883. + zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo));
  884. speaker.type = getSpeakerType (channels.getTypeOfChannel (i));
  885. }
  886. }
  887. VstSpeakerConfigurationHolder& operator= (const VstSpeakerConfigurationHolder& vstConfig) { return operator=(vstConfig.get()); }
  888. - VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerArrangement& vstConfig)
  889. + VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerConfiguration& vstConfig)
  890. {
  891. - Vst2::VstSpeakerArrangement& dst = *allocate (vstConfig.numChannels);
  892. + Vst2::VstSpeakerConfiguration& dst = *allocate (vstConfig.numberOfChannels);
  893. dst.type = vstConfig.type;
  894. - dst.numChannels = vstConfig.numChannels;
  895. + dst.numberOfChannels = vstConfig.numberOfChannels;
  896. - for (int i = 0; i < dst.numChannels; ++i)
  897. + for (int i = 0; i < dst.numberOfChannels; ++i)
  898. dst.speakers[i] = vstConfig.speakers[i];
  899. return *this;
  900. @@ -207,17 +207,17 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  901. return *this;
  902. }
  903. - const Vst2::VstSpeakerArrangement& get() const { return *storage.get(); }
  904. + const Vst2::VstSpeakerConfiguration& get() const { return *storage.get(); }
  905. private:
  906. JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder)
  907. - HeapBlock<Vst2::VstSpeakerArrangement> storage;
  908. + HeapBlock<Vst2::VstSpeakerConfiguration> storage;
  909. - Vst2::VstSpeakerArrangement* allocate (int numChannels)
  910. + Vst2::VstSpeakerConfiguration* allocate (int numChannels)
  911. {
  912. - auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties)
  913. - + sizeof (Vst2::VstSpeakerArrangement);
  914. + auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstIndividualSpeakerInfo)
  915. + + sizeof (Vst2::VstSpeakerConfiguration);
  916. storage.malloc (1, arrangementSize);
  917. return storage.get();
  918. @@ -225,10 +225,10 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  919. void clear()
  920. {
  921. - Vst2::VstSpeakerArrangement& dst = *allocate (0);
  922. + Vst2::VstSpeakerConfiguration& dst = *allocate (0);
  923. - dst.type = Vst2::kSpeakerArrEmpty;
  924. - dst.numChannels = 0;
  925. + dst.type = Vst2::vstSpeakerConfigTypeEmpty;
  926. + dst.numberOfChannels = 0;
  927. }
  928. };
  929. @@ -236,36 +236,36 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  930. {
  931. static const Mapping mappings[] =
  932. {
  933. - { Vst2::kSpeakerArrMono, { centre, unknown } },
  934. - { Vst2::kSpeakerArrStereo, { left, right, unknown } },
  935. - { Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } },
  936. - { Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } },
  937. - { Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } },
  938. - { Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } },
  939. - { Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } },
  940. - { Vst2::kSpeakerArr30Music, { left, right, surround, unknown } },
  941. - { Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } },
  942. - { Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } },
  943. - { Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } },
  944. - { Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } },
  945. - { Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } },
  946. - { Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } },
  947. - { Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } },
  948. - { Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } },
  949. - { Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } },
  950. - { Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  951. - { Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } },
  952. - { Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  953. - { Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  954. - { Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  955. - { Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  956. - { Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  957. - { Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  958. - { Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  959. - { Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  960. - { Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  961. - { Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } },
  962. - { Vst2::kSpeakerArrEmpty, { unknown } }
  963. + { Vst2::vstSpeakerConfigTypeMono, { centre, unknown } },
  964. + { Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } },
  965. + { Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } },
  966. + { Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } },
  967. + { Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } },
  968. + { Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } },
  969. + { Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } },
  970. + { Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } },
  971. + { Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } },
  972. + { Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } },
  973. + { Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } },
  974. + { Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } },
  975. + { Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } },
  976. + { Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } },
  977. + { Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } },
  978. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } },
  979. + { Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } },
  980. + { Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  981. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } },
  982. + { Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  983. + { Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  984. + { Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  985. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  986. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  987. + { Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  988. + { Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  989. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  990. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  991. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } },
  992. + { Vst2::vstSpeakerConfigTypeEmpty, { unknown } }
  993. };
  994. return mappings;
  995. @@ -275,25 +275,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  996. {
  997. static const std::map<AudioChannelSet::ChannelType, int32> speakerTypeMap =
  998. {
  999. - { AudioChannelSet::left, Vst2::kSpeakerL },
  1000. - { AudioChannelSet::right, Vst2::kSpeakerR },
  1001. - { AudioChannelSet::centre, Vst2::kSpeakerC },
  1002. - { AudioChannelSet::LFE, Vst2::kSpeakerLfe },
  1003. - { AudioChannelSet::leftSurround, Vst2::kSpeakerLs },
  1004. - { AudioChannelSet::rightSurround, Vst2::kSpeakerRs },
  1005. - { AudioChannelSet::leftCentre, Vst2::kSpeakerLc },
  1006. - { AudioChannelSet::rightCentre, Vst2::kSpeakerRc },
  1007. - { AudioChannelSet::surround, Vst2::kSpeakerS },
  1008. - { AudioChannelSet::leftSurroundRear, Vst2::kSpeakerSl },
  1009. - { AudioChannelSet::rightSurroundRear, Vst2::kSpeakerSr },
  1010. - { AudioChannelSet::topMiddle, Vst2::kSpeakerTm },
  1011. - { AudioChannelSet::topFrontLeft, Vst2::kSpeakerTfl },
  1012. - { AudioChannelSet::topFrontCentre, Vst2::kSpeakerTfc },
  1013. - { AudioChannelSet::topFrontRight, Vst2::kSpeakerTfr },
  1014. - { AudioChannelSet::topRearLeft, Vst2::kSpeakerTrl },
  1015. - { AudioChannelSet::topRearCentre, Vst2::kSpeakerTrc },
  1016. - { AudioChannelSet::topRearRight, Vst2::kSpeakerTrr },
  1017. - { AudioChannelSet::LFE2, Vst2::kSpeakerLfe2 }
  1018. + { AudioChannelSet::left, Vst2::vstIndividualSpeakerTypeLeft },
  1019. + { AudioChannelSet::right, Vst2::vstIndividualSpeakerTypeRight },
  1020. + { AudioChannelSet::centre, Vst2::vstIndividualSpeakerTypeCentre },
  1021. + { AudioChannelSet::LFE, Vst2::vstIndividualSpeakerTypeLFE },
  1022. + { AudioChannelSet::leftSurround, Vst2::vstIndividualSpeakerTypeLeftSurround },
  1023. + { AudioChannelSet::rightSurround, Vst2::vstIndividualSpeakerTypeRightSurround },
  1024. + { AudioChannelSet::leftCentre, Vst2::vstIndividualSpeakerTypeLeftCentre },
  1025. + { AudioChannelSet::rightCentre, Vst2::vstIndividualSpeakerTypeRightCentre },
  1026. + { AudioChannelSet::surround, Vst2::vstIndividualSpeakerTypeSurround },
  1027. + { AudioChannelSet::leftSurroundRear, Vst2::vstIndividualSpeakerTypeLeftRearSurround },
  1028. + { AudioChannelSet::rightSurroundRear, Vst2::vstIndividualSpeakerTypeRightRearSurround },
  1029. + { AudioChannelSet::topMiddle, Vst2::vstIndividualSpeakerTypeTopMiddle },
  1030. + { AudioChannelSet::topFrontLeft, Vst2::vstIndividualSpeakerTypeTopFrontLeft },
  1031. + { AudioChannelSet::topFrontCentre, Vst2::vstIndividualSpeakerTypeTopFrontCentre },
  1032. + { AudioChannelSet::topFrontRight, Vst2::vstIndividualSpeakerTypeTopFrontRight },
  1033. + { AudioChannelSet::topRearLeft, Vst2::vstIndividualSpeakerTypeTopRearLeft },
  1034. + { AudioChannelSet::topRearCentre, Vst2::vstIndividualSpeakerTypeTopRearCentre },
  1035. + { AudioChannelSet::topRearRight, Vst2::vstIndividualSpeakerTypeTopRearRight },
  1036. + { AudioChannelSet::LFE2, Vst2::vstIndividualSpeakerTypeLFE2 }
  1037. };
  1038. if (speakerTypeMap.find (type) == speakerTypeMap.end())
  1039. @@ -306,25 +306,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  1040. {
  1041. switch (type)
  1042. {
  1043. - case Vst2::kSpeakerL: return AudioChannelSet::left;
  1044. - case Vst2::kSpeakerR: return AudioChannelSet::right;
  1045. - case Vst2::kSpeakerC: return AudioChannelSet::centre;
  1046. - case Vst2::kSpeakerLfe: return AudioChannelSet::LFE;
  1047. - case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround;
  1048. - case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround;
  1049. - case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre;
  1050. - case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre;
  1051. - case Vst2::kSpeakerS: return AudioChannelSet::surround;
  1052. - case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear;
  1053. - case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear;
  1054. - case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle;
  1055. - case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft;
  1056. - case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre;
  1057. - case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight;
  1058. - case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft;
  1059. - case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre;
  1060. - case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight;
  1061. - case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2;
  1062. + case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left;
  1063. + case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right;
  1064. + case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre;
  1065. + case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE;
  1066. + case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround;
  1067. + case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround;
  1068. + case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre;
  1069. + case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre;
  1070. + case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround;
  1071. + case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear;
  1072. + case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear;
  1073. + case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle;
  1074. + case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft;
  1075. + case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre;
  1076. + case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight;
  1077. + case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft;
  1078. + case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre;
  1079. + case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight;
  1080. + case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2;
  1081. default: break;
  1082. }
  1083. diff --git a/modules/juce_audio_processors/format_types/juce_VSTInterface.h b/modules/juce_audio_processors/format_types/juce_VSTInterface.h
  1084. new file mode 100644
  1085. index 000000000..1b3eb7d08
  1086. --- /dev/null
  1087. +++ b/modules/juce_audio_processors/format_types/juce_VSTInterface.h
  1088. @@ -0,0 +1,532 @@
  1089. +/*
  1090. + ==============================================================================
  1091. +
  1092. + This file is part of the JUCE library.
  1093. + Copyright (c) 2017 - ROLI Ltd.
  1094. +
  1095. + JUCE is an open source library subject to commercial or open-source
  1096. + licensing.
  1097. +
  1098. + By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  1099. + Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  1100. + 27th April 2017).
  1101. +
  1102. + End User License Agreement: www.juce.com/juce-5-licence
  1103. + Privacy Policy: www.juce.com/juce-5-privacy-policy
  1104. +
  1105. + Or: You may also use this code under the terms of the GPL v3 (see
  1106. + www.gnu.org/licenses).
  1107. +
  1108. + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  1109. + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  1110. + DISCLAIMED.
  1111. +
  1112. + ==============================================================================
  1113. +*/
  1114. +
  1115. +#ifndef JUCE_VSTINTERFACE_H_INCLUDED
  1116. +#define JUCE_VSTINTERFACE_H_INCLUDED
  1117. +
  1118. +using namespace juce;
  1119. +
  1120. +#if JUCE_MSVC
  1121. + #define VSTINTERFACECALL __cdecl
  1122. + #pragma pack(push)
  1123. + #pragma pack(8)
  1124. +#elif JUCE_MAC || JUCE_IOS
  1125. + #define VSTINTERFACECALL
  1126. + #if JUCE_64BIT
  1127. + #pragma options align=power
  1128. + #else
  1129. + #pragma options align=mac68k
  1130. + #endif
  1131. +#else
  1132. + #define VSTINTERFACECALL
  1133. + #pragma pack(push, 8)
  1134. +#endif
  1135. +
  1136. +const int32 juceVstInterfaceVersion = 2400;
  1137. +const int32 juceVstInterfaceIdentifier = 0x56737450; // The "magic" identifier in the SDK is 'VstP'.
  1138. +
  1139. +//==============================================================================
  1140. +/** Structure used for VSTs
  1141. +
  1142. + @tags{Audio}
  1143. +*/
  1144. +struct VstEffectInterface
  1145. +{
  1146. + int32 interfaceIdentifier;
  1147. + pointer_sized_int (VSTINTERFACECALL* dispatchFunction) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt);
  1148. + void (VSTINTERFACECALL* processAudioFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples);
  1149. + void (VSTINTERFACECALL* setParameterValueFunction) (VstEffectInterface*, int32 parameterIndex, float value);
  1150. + float (VSTINTERFACECALL* getParameterValueFunction) (VstEffectInterface*, int32 parameterIndex);
  1151. + int32 numPrograms;
  1152. + int32 numParameters;
  1153. + int32 numInputChannels;
  1154. + int32 numOutputChannels;
  1155. + int32 flags;
  1156. + pointer_sized_int hostSpace1;
  1157. + pointer_sized_int hostSpace2;
  1158. + int32 latency;
  1159. + int32 deprecated1;
  1160. + int32 deprecated2;
  1161. + float deprecated3;
  1162. + void* effectPointer;
  1163. + void* userPointer;
  1164. + int32 plugInIdentifier;
  1165. + int32 plugInVersion;
  1166. + void (VSTINTERFACECALL* processAudioInplaceFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples);
  1167. + void (VSTINTERFACECALL* processDoubleAudioInplaceFunction) (VstEffectInterface*, double** inputs, double** outputs, int32 numSamples);
  1168. + char emptySpace[56];
  1169. +};
  1170. +
  1171. +typedef pointer_sized_int (VSTINTERFACECALL* VstHostCallback) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt);
  1172. +
  1173. +enum VstEffectInterfaceFlags
  1174. +{
  1175. + vstEffectFlagHasEditor = 1,
  1176. + vstEffectFlagInplaceAudio = 16,
  1177. + vstEffectFlagDataInChunks = 32,
  1178. + vstEffectFlagIsSynth = 256,
  1179. + vstEffectFlagInplaceDoubleAudio = 4096
  1180. +};
  1181. +
  1182. +//==============================================================================
  1183. +enum VstHostToPlugInOpcodes
  1184. +{
  1185. + plugInOpcodeOpen,
  1186. + plugInOpcodeClose,
  1187. + plugInOpcodeSetCurrentProgram,
  1188. + plugInOpcodeGetCurrentProgram,
  1189. + plugInOpcodeSetCurrentProgramName,
  1190. + plugInOpcodeGetCurrentProgramName,
  1191. + plugInOpcodeGetParameterLabel,
  1192. + plugInOpcodeGetParameterText,
  1193. + plugInOpcodeGetParameterName,
  1194. + plugInOpcodeSetSampleRate = plugInOpcodeGetParameterName + 2,
  1195. + plugInOpcodeSetBlockSize,
  1196. + plugInOpcodeResumeSuspend,
  1197. + plugInOpcodeGetEditorBounds,
  1198. + plugInOpcodeOpenEditor,
  1199. + plugInOpcodeCloseEditor,
  1200. + plugInOpcodeDrawEditor,
  1201. + plugInOpcodeGetMouse,
  1202. + plugInOpcodeEditorIdle = plugInOpcodeGetMouse + 2,
  1203. + plugInOpcodeeffEditorTop,
  1204. + plugInOpcodeSleepEditor,
  1205. + plugInOpcodeIdentify,
  1206. + plugInOpcodeGetData,
  1207. + plugInOpcodeSetData,
  1208. + plugInOpcodePreAudioProcessingEvents,
  1209. + plugInOpcodeIsParameterAutomatable,
  1210. + plugInOpcodeParameterValueForText,
  1211. + plugInOpcodeGetProgramName = plugInOpcodeParameterValueForText + 2,
  1212. + plugInOpcodeConnectInput = plugInOpcodeGetProgramName + 2,
  1213. + plugInOpcodeConnectOutput,
  1214. + plugInOpcodeGetInputPinProperties,
  1215. + plugInOpcodeGetOutputPinProperties,
  1216. + plugInOpcodeGetPlugInCategory,
  1217. + plugInOpcodeSetSpeakerConfiguration = plugInOpcodeGetPlugInCategory + 7,
  1218. + plugInOpcodeSetBypass = plugInOpcodeSetSpeakerConfiguration + 2,
  1219. + plugInOpcodeGetPlugInName,
  1220. + plugInOpcodeGetManufacturerName = plugInOpcodeGetPlugInName + 2,
  1221. + plugInOpcodeGetManufacturerProductName,
  1222. + plugInOpcodeGetManufacturerVersion,
  1223. + plugInOpcodeManufacturerSpecific,
  1224. + plugInOpcodeCanPlugInDo,
  1225. + plugInOpcodeGetTailSize,
  1226. + plugInOpcodeIdle,
  1227. + plugInOpcodeKeyboardFocusRequired = plugInOpcodeIdle + 4,
  1228. + plugInOpcodeGetVstInterfaceVersion,
  1229. + plugInOpcodeGetCurrentMidiProgram = plugInOpcodeGetVstInterfaceVersion + 5,
  1230. + plugInOpcodeGetSpeakerArrangement = plugInOpcodeGetCurrentMidiProgram + 6,
  1231. + plugInOpcodeNextPlugInUniqueID,
  1232. + plugInOpcodeStartProcess,
  1233. + plugInOpcodeStopProcess,
  1234. + plugInOpcodeSetNumberOfSamplesToProcess,
  1235. + plugInOpcodeSetSampleFloatType = plugInOpcodeSetNumberOfSamplesToProcess + 4,
  1236. + pluginOpcodeGetNumMidiInputChannels,
  1237. + pluginOpcodeGetNumMidiOutputChannels,
  1238. + plugInOpcodeMaximum = pluginOpcodeGetNumMidiOutputChannels
  1239. +};
  1240. +
  1241. +
  1242. +enum VstPlugInToHostOpcodes
  1243. +{
  1244. + hostOpcodeParameterChanged,
  1245. + hostOpcodeVstVersion,
  1246. + hostOpcodeCurrentId,
  1247. + hostOpcodeIdle,
  1248. + hostOpcodePinConnected,
  1249. + hostOpcodePlugInWantsMidi = hostOpcodePinConnected + 2,
  1250. + hostOpcodeGetTimingInfo,
  1251. + hostOpcodePreAudioProcessingEvents,
  1252. + hostOpcodeSetTime,
  1253. + hostOpcodeTempoAt,
  1254. + hostOpcodeGetNumberOfAutomatableParameters,
  1255. + hostOpcodeGetParameterInterval,
  1256. + hostOpcodeIOModified,
  1257. + hostOpcodeNeedsIdle,
  1258. + hostOpcodeWindowSize,
  1259. + hostOpcodeGetSampleRate,
  1260. + hostOpcodeGetBlockSize,
  1261. + hostOpcodeGetInputLatency,
  1262. + hostOpcodeGetOutputLatency,
  1263. + hostOpcodeGetPreviousPlugIn,
  1264. + hostOpcodeGetNextPlugIn,
  1265. + hostOpcodeWillReplace,
  1266. + hostOpcodeGetCurrentAudioProcessingLevel,
  1267. + hostOpcodeGetAutomationState,
  1268. + hostOpcodeOfflineStart,
  1269. + hostOpcodeOfflineReadSource,
  1270. + hostOpcodeOfflineWrite,
  1271. + hostOpcodeOfflineGetCurrentPass,
  1272. + hostOpcodeOfflineGetCurrentMetaPass,
  1273. + hostOpcodeSetOutputSampleRate,
  1274. + hostOpcodeGetOutputSpeakerConfiguration,
  1275. + hostOpcodeGetManufacturerName,
  1276. + hostOpcodeGetProductName,
  1277. + hostOpcodeGetManufacturerVersion,
  1278. + hostOpcodeManufacturerSpecific,
  1279. + hostOpcodeSetIcon,
  1280. + hostOpcodeCanHostDo,
  1281. + hostOpcodeGetLanguage,
  1282. + hostOpcodeOpenEditorWindow,
  1283. + hostOpcodeCloseEditorWindow,
  1284. + hostOpcodeGetDirectory,
  1285. + hostOpcodeUpdateView,
  1286. + hostOpcodeParameterChangeGestureBegin,
  1287. + hostOpcodeParameterChangeGestureEnd,
  1288. +};
  1289. +
  1290. +//==============================================================================
  1291. +enum VstProcessingSampleType
  1292. +{
  1293. + vstProcessingSampleTypeFloat,
  1294. + vstProcessingSampleTypeDouble
  1295. +};
  1296. +
  1297. +//==============================================================================
  1298. +// These names must be identical to the Steinberg SDK so JUCE users can set
  1299. +// exactly what they want.
  1300. +enum VstPlugInCategory
  1301. +{
  1302. + kPlugCategUnknown,
  1303. + kPlugCategEffect,
  1304. + kPlugCategSynth,
  1305. + kPlugCategAnalysis,
  1306. + kPlugCategMastering,
  1307. + kPlugCategSpacializer,
  1308. + kPlugCategRoomFx,
  1309. + kPlugSurroundFx,
  1310. + kPlugCategRestoration,
  1311. + kPlugCategOfflineProcess,
  1312. + kPlugCategShell,
  1313. + kPlugCategGenerator
  1314. +};
  1315. +
  1316. +//==============================================================================
  1317. +/** Structure used for VSTs
  1318. +
  1319. + @tags{Audio}
  1320. +*/
  1321. +struct VstEditorBounds
  1322. +{
  1323. + int16 upper;
  1324. + int16 leftmost;
  1325. + int16 lower;
  1326. + int16 rightmost;
  1327. +};
  1328. +
  1329. +//==============================================================================
  1330. +enum VstMaxStringLengths
  1331. +{
  1332. + vstMaxNameLength = 64,
  1333. + vstMaxParameterOrPinLabelLength = 64,
  1334. + vstMaxParameterOrPinShortLabelLength = 8,
  1335. + vstMaxCategoryLength = 24,
  1336. + vstMaxManufacturerStringLength = 64,
  1337. + vstMaxPlugInNameStringLength = 64
  1338. +};
  1339. +
  1340. +//==============================================================================
  1341. +/** Structure used for VSTs
  1342. +
  1343. + @tags{Audio}
  1344. +*/
  1345. +struct VstPinInfo
  1346. +{
  1347. + char text[vstMaxParameterOrPinLabelLength];
  1348. + int32 flags;
  1349. + int32 configurationType;
  1350. + char shortText[vstMaxParameterOrPinShortLabelLength];
  1351. + char unused[48];
  1352. +};
  1353. +
  1354. +enum VstPinInfoFlags
  1355. +{
  1356. + vstPinInfoFlagIsActive = 1,
  1357. + vstPinInfoFlagIsStereo = 2,
  1358. + vstPinInfoFlagValid = 4
  1359. +};
  1360. +
  1361. +//==============================================================================
  1362. +/** Structure used for VSTs
  1363. +
  1364. + @tags{Audio}
  1365. +*/
  1366. +struct VstEvent
  1367. +{
  1368. + int32 type;
  1369. + int32 size;
  1370. + int32 sampleOffset;
  1371. + int32 flags;
  1372. + char content[16];
  1373. +};
  1374. +
  1375. +enum VstEventTypes
  1376. +{
  1377. + vstMidiEventType = 1,
  1378. + vstSysExEventType = 6
  1379. +};
  1380. +
  1381. +/** Structure used for VSTs
  1382. +
  1383. + @tags{Audio}
  1384. +*/
  1385. +struct VstEventBlock
  1386. +{
  1387. + int32 numberOfEvents;
  1388. + pointer_sized_int future;
  1389. + VstEvent* events[2];
  1390. +};
  1391. +
  1392. +/** Structure used for VSTs
  1393. +
  1394. + @tags{Audio}
  1395. +*/
  1396. +struct VstMidiEvent
  1397. +{
  1398. + int32 type;
  1399. + int32 size;
  1400. + int32 sampleOffset;
  1401. + int32 flags;
  1402. + int32 noteSampleLength;
  1403. + int32 noteSampleOffset;
  1404. + char midiData[4];
  1405. + char tuning;
  1406. + char noteVelocityOff;
  1407. + char future1;
  1408. + char future2;
  1409. +};
  1410. +
  1411. +enum VstMidiEventFlags
  1412. +{
  1413. + vstMidiEventIsRealtime = 1
  1414. +};
  1415. +
  1416. +/** Structure used for VSTs
  1417. +
  1418. + @tags{Audio}
  1419. +*/
  1420. +struct VstSysExEvent
  1421. +{
  1422. + int32 type;
  1423. + int32 size;
  1424. + int32 offsetSamples;
  1425. + int32 flags;
  1426. + int32 sysExDumpSize;
  1427. + pointer_sized_int future1;
  1428. + char* sysExDump;
  1429. + pointer_sized_int future2;
  1430. +};
  1431. +
  1432. +//==============================================================================
  1433. +/** Structure used for VSTs
  1434. +
  1435. + @tags{Audio}
  1436. +*/
  1437. +struct VstTimingInformation
  1438. +{
  1439. + double samplePosition;
  1440. + double sampleRate;
  1441. + double systemTimeNanoseconds;
  1442. + double musicalPosition;
  1443. + double tempoBPM;
  1444. + double lastBarPosition;
  1445. + double loopStartPosition;
  1446. + double loopEndPosition;
  1447. + int32 timeSignatureNumerator;
  1448. + int32 timeSignatureDenominator;
  1449. + int32 smpteOffset;
  1450. + int32 smpteRate;
  1451. + int32 samplesToNearestClock;
  1452. + int32 flags;
  1453. +};
  1454. +
  1455. +enum VstTimingInformationFlags
  1456. +{
  1457. + vstTimingInfoFlagTransportChanged = 1,
  1458. + vstTimingInfoFlagCurrentlyPlaying = 2,
  1459. + vstTimingInfoFlagLoopActive = 4,
  1460. + vstTimingInfoFlagCurrentlyRecording = 8,
  1461. + vstTimingInfoFlagAutomationWriteModeActive = 64,
  1462. + vstTimingInfoFlagAutomationReadModeActive = 128,
  1463. + vstTimingInfoFlagNanosecondsValid = 256,
  1464. + vstTimingInfoFlagMusicalPositionValid = 512,
  1465. + vstTimingInfoFlagTempoValid = 1024,
  1466. + vstTimingInfoFlagLastBarPositionValid = 2048,
  1467. + vstTimingInfoFlagLoopPositionValid = 4096,
  1468. + vstTimingInfoFlagTimeSignatureValid = 8192,
  1469. + vstTimingInfoFlagSmpteValid = 16384,
  1470. + vstTimingInfoFlagNearestClockValid = 32768
  1471. +};
  1472. +
  1473. +//==============================================================================
  1474. +enum VstSmpteRates
  1475. +{
  1476. + vstSmpteRateFps24,
  1477. + vstSmpteRateFps25,
  1478. + vstSmpteRateFps2997,
  1479. + vstSmpteRateFps30,
  1480. + vstSmpteRateFps2997drop,
  1481. + vstSmpteRateFps30drop,
  1482. +
  1483. + vstSmpteRate16mmFilm,
  1484. + vstSmpteRate35mmFilm,
  1485. +
  1486. + vstSmpteRateFps239 = vstSmpteRate35mmFilm + 3,
  1487. + vstSmpteRateFps249 ,
  1488. + vstSmpteRateFps599,
  1489. + vstSmpteRateFps60
  1490. +};
  1491. +
  1492. +//==============================================================================
  1493. +/** Structure used for VSTs
  1494. +
  1495. + @tags{Audio}
  1496. +*/
  1497. +struct VstIndividualSpeakerInfo
  1498. +{
  1499. + float azimuthalAngle;
  1500. + float elevationAngle;
  1501. + float radius;
  1502. + float reserved;
  1503. + char label[vstMaxNameLength];
  1504. + int32 type;
  1505. + char unused[28];
  1506. +};
  1507. +
  1508. +enum VstIndividualSpeakerType
  1509. +{
  1510. + vstIndividualSpeakerTypeUndefined = 0x7fffffff,
  1511. + vstIndividualSpeakerTypeMono = 0,
  1512. + vstIndividualSpeakerTypeLeft,
  1513. + vstIndividualSpeakerTypeRight,
  1514. + vstIndividualSpeakerTypeCentre,
  1515. + vstIndividualSpeakerTypeLFE,
  1516. + vstIndividualSpeakerTypeLeftSurround,
  1517. + vstIndividualSpeakerTypeRightSurround,
  1518. + vstIndividualSpeakerTypeLeftCentre,
  1519. + vstIndividualSpeakerTypeRightCentre,
  1520. + vstIndividualSpeakerTypeSurround,
  1521. + vstIndividualSpeakerTypeCentreSurround = vstIndividualSpeakerTypeSurround,
  1522. + vstIndividualSpeakerTypeLeftRearSurround,
  1523. + vstIndividualSpeakerTypeRightRearSurround,
  1524. + vstIndividualSpeakerTypeTopMiddle,
  1525. + vstIndividualSpeakerTypeTopFrontLeft,
  1526. + vstIndividualSpeakerTypeTopFrontCentre,
  1527. + vstIndividualSpeakerTypeTopFrontRight,
  1528. + vstIndividualSpeakerTypeTopRearLeft,
  1529. + vstIndividualSpeakerTypeTopRearCentre,
  1530. + vstIndividualSpeakerTypeTopRearRight,
  1531. + vstIndividualSpeakerTypeLFE2
  1532. +};
  1533. +
  1534. +/** Structure used for VSTs
  1535. +
  1536. + @tags{Audio}
  1537. +*/
  1538. +struct VstSpeakerConfiguration
  1539. +{
  1540. + int32 type;
  1541. + int32 numberOfChannels;
  1542. + VstIndividualSpeakerInfo speakers[8];
  1543. +};
  1544. +
  1545. +enum VstSpeakerConfigurationType
  1546. +{
  1547. + vstSpeakerConfigTypeUser = -2,
  1548. + vstSpeakerConfigTypeEmpty = -1,
  1549. + vstSpeakerConfigTypeMono = 0,
  1550. + vstSpeakerConfigTypeLR,
  1551. + vstSpeakerConfigTypeLsRs,
  1552. + vstSpeakerConfigTypeLcRc,
  1553. + vstSpeakerConfigTypeSlSr,
  1554. + vstSpeakerConfigTypeCLfe,
  1555. + vstSpeakerConfigTypeLRC,
  1556. + vstSpeakerConfigTypeLRS,
  1557. + vstSpeakerConfigTypeLRCLfe,
  1558. + vstSpeakerConfigTypeLRLfeS,
  1559. + vstSpeakerConfigTypeLRCS,
  1560. + vstSpeakerConfigTypeLRLsRs,
  1561. + vstSpeakerConfigTypeLRCLfeS,
  1562. + vstSpeakerConfigTypeLRLfeLsRs,
  1563. + vstSpeakerConfigTypeLRCLsRs,
  1564. + vstSpeakerConfigTypeLRCLfeLsRs,
  1565. + vstSpeakerConfigTypeLRCLsRsCs,
  1566. + vstSpeakerConfigTypeLRLsRsSlSr,
  1567. + vstSpeakerConfigTypeLRCLfeLsRsCs,
  1568. + vstSpeakerConfigTypeLRLfeLsRsSlSr,
  1569. + vstSpeakerConfigTypeLRCLsRsLcRc,
  1570. + vstSpeakerConfigTypeLRCLsRsSlSr,
  1571. + vstSpeakerConfigTypeLRCLfeLsRsLcRc,
  1572. + vstSpeakerConfigTypeLRCLfeLsRsSlSr,
  1573. + vstSpeakerConfigTypeLRCLsRsLcRcCs,
  1574. + vstSpeakerConfigTypeLRCLsRsCsSlSr,
  1575. + vstSpeakerConfigTypeLRCLfeLsRsLcRcCs,
  1576. + vstSpeakerConfigTypeLRCLfeLsRsCsSlSr,
  1577. + vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2
  1578. +};
  1579. +
  1580. +#if JUCE_BIG_ENDIAN
  1581. + #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (a | (((uint32) b) << 8) | (((uint32) c) << 16) | (((uint32) d) << 24))
  1582. +#else
  1583. + #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (d | (((uint32) c) << 8) | (((uint32) b) << 16) | (((uint32) a) << 24))
  1584. +#endif
  1585. +
  1586. +enum PresonusExtensionConstants
  1587. +{
  1588. + presonusVendorID = JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'),
  1589. + presonusSetContentScaleFactor = JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's')
  1590. +};
  1591. +
  1592. +//==============================================================================
  1593. +/** Structure used for VSTs
  1594. +
  1595. + @tags{Audio}
  1596. +*/
  1597. +struct fxBank
  1598. +{
  1599. + int32 magic1;
  1600. + int32 size;
  1601. + int32 magic2;
  1602. + int32 version1;
  1603. + int32 fxID;
  1604. + int32 version2;
  1605. + int32 elements;
  1606. + int32 current;
  1607. + char shouldBeZero[124];
  1608. + int32 chunkSize;
  1609. + char chunk[1];
  1610. +};
  1611. +
  1612. +#if JUCE_MSVC
  1613. + #pragma pack(pop)
  1614. +#elif JUCE_MAC || JUCE_IOS
  1615. + #pragma options align=reset
  1616. +#else
  1617. + #pragma pack(pop)
  1618. +#endif
  1619. +
  1620. +#endif // JUCE_VSTINTERFACE_H_INCLUDED
  1621. diff --git a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  1622. index 49f0d3b3b..6e99d63d0 100644
  1623. --- a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  1624. +++ b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  1625. @@ -57,7 +57,7 @@ public:
  1626. numEventsUsed = 0;
  1627. if (events != nullptr)
  1628. - events->numEvents = 0;
  1629. + events->numberOfEvents = 0;
  1630. }
  1631. void addEvent (const void* const midiData, int numBytes, int frameOffset)
  1632. @@ -66,50 +66,50 @@ public:
  1633. void* const ptr = (Vst2::VstMidiEvent*) (events->events [numEventsUsed]);
  1634. auto* const e = (Vst2::VstMidiEvent*) ptr;
  1635. - events->numEvents = ++numEventsUsed;
  1636. + events->numberOfEvents = ++numEventsUsed;
  1637. if (numBytes <= 4)
  1638. {
  1639. - if (e->type == Vst2::kVstSysExType)
  1640. + if (e->type == Vst2::vstSysExEventType)
  1641. {
  1642. - delete[] (((Vst2::VstMidiSysexEvent*) ptr)->sysexDump);
  1643. - e->type = Vst2::kVstMidiType;
  1644. - e->byteSize = sizeof (Vst2::VstMidiEvent);
  1645. - e->noteLength = 0;
  1646. - e->noteOffset = 0;
  1647. - e->detune = 0;
  1648. - e->noteOffVelocity = 0;
  1649. + delete[] (((Vst2::VstSysExEvent*) ptr)->sysExDump);
  1650. + e->type = Vst2::vstMidiEventType;
  1651. + e->size = sizeof (Vst2::VstMidiEvent);
  1652. + e->noteSampleLength = 0;
  1653. + e->noteSampleOffset = 0;
  1654. + e->tuning = 0;
  1655. + e->noteVelocityOff = 0;
  1656. }
  1657. - e->deltaFrames = frameOffset;
  1658. + e->sampleOffset = frameOffset;
  1659. memcpy (e->midiData, midiData, (size_t) numBytes);
  1660. }
  1661. else
  1662. {
  1663. - auto* const se = (Vst2::VstMidiSysexEvent*) ptr;
  1664. + auto* const se = (Vst2::VstSysExEvent*) ptr;
  1665. - if (se->type == Vst2::kVstSysExType)
  1666. - delete[] se->sysexDump;
  1667. + if (se->type == Vst2::vstSysExEventType)
  1668. + delete[] se->sysExDump;
  1669. - se->sysexDump = new char [(size_t) numBytes];
  1670. - memcpy (se->sysexDump, midiData, (size_t) numBytes);
  1671. + se->sysExDump = new char [(size_t) numBytes];
  1672. + memcpy (se->sysExDump, midiData, (size_t) numBytes);
  1673. - se->type = Vst2::kVstSysExType;
  1674. - se->byteSize = sizeof (Vst2::VstMidiSysexEvent);
  1675. - se->deltaFrames = frameOffset;
  1676. + se->type = Vst2::vstSysExEventType;
  1677. + se->size = sizeof (Vst2::VstSysExEvent);
  1678. + se->offsetSamples = frameOffset;
  1679. se->flags = 0;
  1680. - se->dumpBytes = numBytes;
  1681. - se->resvd1 = 0;
  1682. - se->resvd2 = 0;
  1683. + se->sysExDumpSize = numBytes;
  1684. + se->future1 = 0;
  1685. + se->future2 = 0;
  1686. }
  1687. }
  1688. //==============================================================================
  1689. // Handy method to pull the events out of an event buffer supplied by the host
  1690. // or plugin.
  1691. - static void addEventsToMidiBuffer (const Vst2::VstEvents* events, MidiBuffer& dest)
  1692. + static void addEventsToMidiBuffer (const Vst2::VstEventBlock* events, MidiBuffer& dest)
  1693. {
  1694. - for (int i = 0; i < events->numEvents; ++i)
  1695. + for (int i = 0; i < events->numberOfEvents; ++i)
  1696. {
  1697. const Vst2::VstEvent* const e = events->events[i];
  1698. @@ -117,17 +117,17 @@ public:
  1699. {
  1700. const void* const ptr = events->events[i];
  1701. - if (e->type == Vst2::kVstMidiType)
  1702. + if (e->type == Vst2::vstMidiEventType)
  1703. {
  1704. dest.addEvent ((const juce::uint8*) ((const Vst2::VstMidiEvent*) ptr)->midiData,
  1705. - 4, e->deltaFrames);
  1706. + 4, e->sampleOffset);
  1707. }
  1708. - else if (e->type == Vst2::kVstSysExType)
  1709. + else if (e->type == Vst2::vstSysExEventType)
  1710. {
  1711. - const auto* se = (const Vst2::VstMidiSysexEvent*) ptr;
  1712. - dest.addEvent ((const juce::uint8*) se->sysexDump,
  1713. - (int) se->dumpBytes,
  1714. - e->deltaFrames);
  1715. + const auto* se = (const Vst2::VstSysExEvent*) ptr;
  1716. + dest.addEvent ((const juce::uint8*) se->sysExDump,
  1717. + (int) se->sysExDumpSize,
  1718. + e->sampleOffset);
  1719. }
  1720. }
  1721. }
  1722. @@ -168,25 +168,25 @@ public:
  1723. }
  1724. //==============================================================================
  1725. - HeapBlock<Vst2::VstEvents> events;
  1726. + HeapBlock<Vst2::VstEventBlock> events;
  1727. private:
  1728. int numEventsUsed, numEventsAllocated;
  1729. static Vst2::VstEvent* allocateVSTEvent()
  1730. {
  1731. - auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstMidiSysexEvent) ? sizeof (Vst2::VstMidiEvent)
  1732. - : sizeof (Vst2::VstMidiSysexEvent));
  1733. - e->type = Vst2::kVstMidiType;
  1734. - e->byteSize = sizeof (Vst2::VstMidiEvent);
  1735. + auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstSysExEvent) ? sizeof (Vst2::VstMidiEvent)
  1736. + : sizeof (Vst2::VstSysExEvent));
  1737. + e->type = Vst2::vstMidiEventType;
  1738. + e->size = sizeof (Vst2::VstMidiEvent);
  1739. return e;
  1740. }
  1741. static void freeVSTEvent (Vst2::VstEvent* e)
  1742. {
  1743. - if (e->type == Vst2::kVstSysExType)
  1744. + if (e->type == Vst2::vstSysExEventType)
  1745. {
  1746. - delete[] (reinterpret_cast<Vst2::VstMidiSysexEvent*> (e)->sysexDump);
  1747. + delete[] (reinterpret_cast<Vst2::VstSysExEvent*> (e)->sysExDump);
  1748. }
  1749. std::free (e);
  1750. diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  1751. index 871a69bb1..adf058959 100644
  1752. --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  1753. +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  1754. @@ -37,7 +37,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant")
  1755. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
  1756. #define VST_FORCE_DEPRECATED 0
  1757. -#define JUCE_VSTINTERFACE_H_INCLUDED 1
  1758. namespace Vst2
  1759. {
  1760. @@ -46,8 +45,7 @@ namespace Vst2
  1761. // paths or use the "VST (Legacy) SDK Folder" field in the Projucer. The VST2
  1762. // SDK can be obtained from the vstsdk3610_11_06_2018_build_37 (or older) VST3
  1763. // SDK or JUCE version 5.3.2.
  1764. -#include <pluginterfaces/vst2.x/aeffect.h>
  1765. -#include <pluginterfaces/vst2.x/aeffectx.h>
  1766. +#include "../../juce_audio_processors/format_types/juce_VSTInterface.h"
  1767. }
  1768. #include "juce_VSTCommon.h"
  1769. @@ -76,7 +74,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4355)
  1770. #endif
  1771. #ifndef JUCE_VST_WRAPPER_INVOKE_MAIN
  1772. -#define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain ((Vst2::audioMasterCallback) &audioMaster);
  1773. + #define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain (&audioMaster);
  1774. #endif
  1775. //==============================================================================
  1776. @@ -216,8 +214,8 @@ namespace
  1777. }
  1778. //==============================================================================
  1779. -typedef Vst2::AEffect* (VSTCALLBACK *MainCall) (Vst2::audioMasterCallback);
  1780. -static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect*, int32, int32, pointer_sized_int, void*, float);
  1781. +typedef Vst2::VstEffectInterface* (VSTINTERFACECALL *MainCall) (Vst2::VstHostCallback);
  1782. +static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface*, int32, int32, pointer_sized_int, void*, float);
  1783. //==============================================================================
  1784. // Change this to disable logging of various VST activities
  1785. @@ -685,9 +683,9 @@ struct ModuleHandle : public ReferenceCountedObject
  1786. module.close();
  1787. }
  1788. - void closeEffect (Vst2::AEffect* eff)
  1789. + void closeEffect (Vst2::VstEffectInterface* eff)
  1790. {
  1791. - eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0);
  1792. + eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0);
  1793. }
  1794. #if JUCE_WINDOWS
  1795. @@ -811,9 +809,9 @@ struct ModuleHandle : public ReferenceCountedObject
  1796. }
  1797. }
  1798. - void closeEffect (Vst2::AEffect* eff)
  1799. + void closeEffect (Vst2::VstEffectInterface* eff)
  1800. {
  1801. - eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0);
  1802. + eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0);
  1803. }
  1804. #endif
  1805. @@ -865,7 +863,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1806. {
  1807. const ScopedLock sl (pluginInstance.lock);
  1808. - return effect->getParameter (effect, getParameterIndex());
  1809. + return effect->getParameterValueFunction (effect, getParameterIndex());
  1810. }
  1811. return 0.0f;
  1812. @@ -877,8 +875,8 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1813. {
  1814. const ScopedLock sl (pluginInstance.lock);
  1815. - if (effect->getParameter (effect, getParameterIndex()) != newValue)
  1816. - effect->setParameter (effect, getParameterIndex(), newValue);
  1817. + if (effect->getParameterValueFunction (effect, getParameterIndex()) != newValue)
  1818. + effect->setParameterValueFunction (effect, getParameterIndex(), newValue);
  1819. }
  1820. }
  1821. @@ -911,7 +909,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1822. if (valueType != nullptr || ! vstValueStrings.isEmpty())
  1823. return getText (getValue(), 1024);
  1824. - return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::effGetParamDisplay);
  1825. + return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::plugInOpcodeGetParameterText);
  1826. }
  1827. float getDefaultValue() const override
  1828. @@ -923,7 +921,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1829. {
  1830. if (name.isEmpty())
  1831. return pluginInstance.getTextForOpcode (getParameterIndex(),
  1832. - Vst2::effGetParamName);
  1833. + Vst2::plugInOpcodeGetParameterName);
  1834. if (name.length() <= maximumStringLength)
  1835. return name;
  1836. @@ -943,7 +941,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1837. String getLabel() const override
  1838. {
  1839. return label.isEmpty() ? pluginInstance.getTextForOpcode (getParameterIndex(),
  1840. - Vst2::effGetParamLabel)
  1841. + Vst2::plugInOpcodeGetParameterLabel)
  1842. : label;
  1843. }
  1844. @@ -985,7 +983,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1845. const VSTXMLInfo::ValueType* const valueType;
  1846. };
  1847. - VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::AEffect* effect,
  1848. + VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::VstEffectInterface* effect,
  1849. double sampleRateToUse, int blockSizeToUse)
  1850. : AudioPluginInstance (ioConfig),
  1851. vstEffect (effect),
  1852. @@ -1008,13 +1006,13 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1853. {
  1854. AudioProcessorParameterGroup newParameterTree;
  1855. - for (int i = 0; i < vstEffect->numParams; ++i)
  1856. + for (int i = 0; i < vstEffect->numParameters; ++i)
  1857. {
  1858. String paramName;
  1859. Array<String> shortParamNames;
  1860. float defaultValue = 0;
  1861. String label;
  1862. - bool isAutomatable = dispatch (Vst2::effCanBeAutomated, i, 0, nullptr, 0) != 0;
  1863. + bool isAutomatable = dispatch (Vst2::plugInOpcodeIsParameterAutomatable, i, 0, nullptr, 0) != 0;
  1864. bool isDiscrete = false;
  1865. int numSteps = AudioProcessor::getDefaultNumParameterSteps();
  1866. bool isBoolSwitch = false;
  1867. @@ -1082,7 +1080,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1868. ~VSTPluginInstance() override
  1869. {
  1870. - if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */)
  1871. + if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier)
  1872. {
  1873. struct VSTDeleter : public CallbackMessage
  1874. {
  1875. @@ -1115,7 +1113,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1876. void cleanup()
  1877. {
  1878. - if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */)
  1879. + if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier)
  1880. {
  1881. #if JUCE_MAC
  1882. if (vstModule->resFileId != 0)
  1883. @@ -1140,16 +1138,16 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1884. {
  1885. if (auto* newEffect = constructEffect (newModule))
  1886. {
  1887. - newEffect->resvd2 = 0;
  1888. + newEffect->hostSpace2 = 0;
  1889. - newEffect->dispatcher (newEffect, Vst2::effIdentify, 0, 0, nullptr, 0);
  1890. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0);
  1891. auto blockSize = jmax (32, initialBlockSize);
  1892. - newEffect->dispatcher (newEffect, Vst2::effSetSampleRate, 0, 0, nullptr, static_cast<float> (initialSampleRate));
  1893. - newEffect->dispatcher (newEffect, Vst2::effSetBlockSize, 0, blockSize, nullptr, 0);
  1894. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, static_cast<float> (initialSampleRate));
  1895. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetBlockSize, 0, blockSize, nullptr, 0);
  1896. - newEffect->dispatcher (newEffect, Vst2::effOpen, 0, 0, nullptr, 0);
  1897. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0);
  1898. BusesProperties ioConfig = queryBusIO (newEffect);
  1899. return new VSTPluginInstance (newModule, ioConfig, newEffect, initialSampleRate, blockSize);
  1900. @@ -1165,7 +1163,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1901. {
  1902. char buffer[512] = { 0 };
  1903. - dispatch (Vst2::effGetEffectName, 0, 0, buffer, 0);
  1904. + dispatch (Vst2::plugInOpcodeGetPlugInName, 0, 0, buffer, 0);
  1905. desc.descriptiveName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim();
  1906. @@ -1182,7 +1180,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1907. {
  1908. char buffer[512] = { 0 };
  1909. - dispatch (Vst2::effGetVendorString, 0, 0, buffer, 0);
  1910. + dispatch (Vst2::plugInOpcodeGetManufacturerName, 0, 0, buffer, 0);
  1911. desc.manufacturerName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim();
  1912. }
  1913. @@ -1196,7 +1194,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1914. {
  1915. if (vstEffect != nullptr)
  1916. {
  1917. - vstEffect->resvd2 = (pointer_sized_int) (pointer_sized_int) this;
  1918. + vstEffect->hostSpace2 = (pointer_sized_int) (pointer_sized_int) this;
  1919. initialise (initialSampleRate, initialBlockSize);
  1920. return true;
  1921. }
  1922. @@ -1222,25 +1220,25 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1923. setRateAndBufferSizeDetails (initialSampleRate, initialBlockSize);
  1924. - dispatch (Vst2::effIdentify, 0, 0, nullptr, 0);
  1925. + dispatch (Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0);
  1926. if (getSampleRate() > 0)
  1927. - dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) getSampleRate());
  1928. + dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) getSampleRate());
  1929. if (getBlockSize() > 0)
  1930. - dispatch (Vst2::effSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0);
  1931. + dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0);
  1932. - dispatch (Vst2::effOpen, 0, 0, nullptr, 0);
  1933. + dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0);
  1934. setRateAndBufferSizeDetails (getSampleRate(), getBlockSize());
  1935. if (getNumPrograms() > 1)
  1936. setCurrentProgram (0);
  1937. else
  1938. - dispatch (Vst2::effSetProgram, 0, 0, nullptr, 0);
  1939. + dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, 0, nullptr, 0);
  1940. - for (int i = vstEffect->numInputs; --i >= 0;) dispatch (Vst2::effConnectInput, i, 1, nullptr, 0);
  1941. - for (int i = vstEffect->numOutputs; --i >= 0;) dispatch (Vst2::effConnectOutput, i, 1, nullptr, 0);
  1942. + for (int i = vstEffect->numInputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectInput, i, 1, nullptr, 0);
  1943. + for (int i = vstEffect->numOutputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectOutput, i, 1, nullptr, 0);
  1944. if (getVstCategory() != Vst2::kPlugCategShell) // (workaround for Waves 5 plugins which crash during this call)
  1945. updateStoredProgramNames();
  1946. @@ -1251,7 +1249,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1947. usesCocoaNSView = ((unsigned int) pluginCanDo ("hasCockosViewAsConfig") & 0xffff0000ul) == 0xbeef0000ul;
  1948. #endif
  1949. - setLatencySamples (vstEffect->initialDelay);
  1950. + setLatencySamples (vstEffect->latency);
  1951. }
  1952. void* getPlatformSpecificData() override { return vstEffect; }
  1953. @@ -1262,7 +1260,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1954. {
  1955. char buffer[512] = { 0 };
  1956. - if (dispatch (Vst2::effGetProductString, 0, 0, buffer, 0) != 0)
  1957. + if (dispatch (Vst2::plugInOpcodeGetManufacturerProductName, 0, 0, buffer, 0) != 0)
  1958. {
  1959. String productName = String::createStringFromData (buffer, (int) sizeof (buffer));
  1960. @@ -1276,7 +1274,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1961. int getUID() const
  1962. {
  1963. - int uid = vstEffect != nullptr ? vstEffect->uniqueID : 0;
  1964. + int uid = vstEffect != nullptr ? vstEffect->plugInIdentifier : 0;
  1965. if (uid == 0)
  1966. uid = vstModule->file.hashCode();
  1967. @@ -1289,10 +1287,10 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1968. if (vstEffect == nullptr)
  1969. return 0.0;
  1970. - if ((vstEffect->flags & Vst2::effFlagsNoSoundInStop) != 0)
  1971. + if ((vstEffect->flags & 512) != 0)
  1972. return 0.0;
  1973. - auto tailSize = dispatch (Vst2::effGetTailSize, 0, 0, nullptr, 0);
  1974. + auto tailSize = dispatch (Vst2::plugInOpcodeGetTailSize, 0, 0, nullptr, 0);
  1975. auto sampleRate = getSampleRate();
  1976. // remain backward compatible with old JUCE plug-ins: anything larger
  1977. @@ -1312,11 +1310,11 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1978. bool producesMidi() const override { return pluginCanDo ("sendVstMidiEvent") > 0; }
  1979. bool supportsMPE() const override { return pluginCanDo ("MPE") > 0; }
  1980. - Vst2::VstPlugCategory getVstCategory() const noexcept { return (Vst2::VstPlugCategory) dispatch (Vst2::effGetPlugCategory, 0, 0, nullptr, 0); }
  1981. + Vst2::VstPlugInCategory getVstCategory() const noexcept { return (Vst2::VstPlugInCategory) dispatch (Vst2::plugInOpcodeGetPlugInCategory, 0, 0, nullptr, 0); }
  1982. - bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsIsSynth) != 0); }
  1983. + bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagIsSynth) != 0); }
  1984. - int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::effCanDo, 0, 0, (void*) text, 0); }
  1985. + int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::plugInOpcodeCanPlugInDo, 0, 0, (void*) text, 0); }
  1986. //==============================================================================
  1987. void prepareToPlay (double rate, int samplesPerBlockExpected) override
  1988. @@ -1331,17 +1329,17 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1989. SpeakerMappings::VstSpeakerConfigurationHolder inArr (getChannelLayoutOfBus (true, 0));
  1990. SpeakerMappings::VstSpeakerConfigurationHolder outArr (getChannelLayoutOfBus (false, 0));
  1991. - dispatch (Vst2::effSetSpeakerArrangement, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f);
  1992. + dispatch (Vst2::plugInOpcodeSetSpeakerConfiguration, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f);
  1993. }
  1994. - vstHostTime.tempo = 120.0;
  1995. - vstHostTime.timeSigNumerator = 4;
  1996. - vstHostTime.timeSigDenominator = 4;
  1997. + vstHostTime.tempoBPM = 120.0;
  1998. + vstHostTime.timeSignatureNumerator = 4;
  1999. + vstHostTime.timeSignatureDenominator = 4;
  2000. vstHostTime.sampleRate = rate;
  2001. - vstHostTime.samplePos = 0;
  2002. - vstHostTime.flags = Vst2::kVstNanosValid
  2003. - | Vst2::kVstAutomationWriting
  2004. - | Vst2::kVstAutomationReading;
  2005. + vstHostTime.samplePosition = 0;
  2006. + vstHostTime.flags = Vst2::vstTimingInfoFlagNanosecondsValid
  2007. + | Vst2::vstTimingInfoFlagAutomationWriteModeActive
  2008. + | Vst2::vstTimingInfoFlagAutomationReadModeActive;
  2009. initialise (rate, samplesPerBlockExpected);
  2010. @@ -1356,18 +1354,18 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2011. incomingMidi.clear();
  2012. - dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) rate);
  2013. - dispatch (Vst2::effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0);
  2014. + dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) rate);
  2015. + dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0);
  2016. if (supportsDoublePrecisionProcessing())
  2017. {
  2018. - int32 vstPrecision = isUsingDoublePrecision() ? Vst2::kVstProcessPrecision64
  2019. - : Vst2::kVstProcessPrecision32;
  2020. + int32 vstPrecision = isUsingDoublePrecision() ? Vst2::vstProcessingSampleTypeDouble
  2021. + : Vst2::vstProcessingSampleTypeFloat;
  2022. - dispatch (Vst2::effSetProcessPrecision, 0, (pointer_sized_int) vstPrecision, nullptr, 0);
  2023. + dispatch (Vst2::plugInOpcodeSetSampleFloatType, 0, (pointer_sized_int) vstPrecision, nullptr, 0);
  2024. }
  2025. - auto maxChannels = jmax (1, jmax (vstEffect->numInputs, vstEffect->numOutputs));
  2026. + auto maxChannels = jmax (1, jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels));
  2027. tmpBufferFloat .setSize (maxChannels, samplesPerBlockExpected);
  2028. tmpBufferDouble.setSize (maxChannels, samplesPerBlockExpected);
  2029. @@ -1375,7 +1373,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2030. channelBufferFloat .calloc (static_cast<size_t> (maxChannels));
  2031. channelBufferDouble.calloc (static_cast<size_t> (maxChannels));
  2032. - outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputs), samplesPerBlockExpected);
  2033. + outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputChannels), samplesPerBlockExpected);
  2034. if (! isPowerOn)
  2035. setPower (true);
  2036. @@ -1391,9 +1389,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2037. }
  2038. }
  2039. - dispatch (Vst2::effStartProcess, 0, 0, nullptr, 0);
  2040. + dispatch (Vst2::plugInOpcodeStartProcess, 0, 0, nullptr, 0);
  2041. - setLatencySamples (vstEffect->initialDelay);
  2042. + setLatencySamples (vstEffect->latency);
  2043. }
  2044. }
  2045. @@ -1401,7 +1399,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2046. {
  2047. if (initialised)
  2048. {
  2049. - dispatch (Vst2::effStopProcess, 0, 0, nullptr, 0);
  2050. + dispatch (Vst2::plugInOpcodeStopProcess, 0, 0, nullptr, 0);
  2051. setPower (false);
  2052. }
  2053. @@ -1454,8 +1452,8 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2054. //==============================================================================
  2055. bool supportsDoublePrecisionProcessing() const override
  2056. {
  2057. - return ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0
  2058. - && (vstEffect->flags & Vst2::effFlagsCanDoubleReplacing) != 0);
  2059. + return ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0
  2060. + && (vstEffect->flags & Vst2::vstEffectFlagInplaceDoubleAudio) != 0);
  2061. }
  2062. AudioProcessorParameter* getBypassParameter() const override { return vstSupportsBypass ? bypassParam.get() : nullptr; }
  2063. @@ -1473,15 +1471,15 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2064. if (numInputBuses > 1 || numOutputBuses > 1)
  2065. return (layouts == getBusesLayout());
  2066. - return (layouts.getNumChannels (true, 0) <= vstEffect->numInputs
  2067. - && layouts.getNumChannels (false, 0) <= vstEffect->numOutputs);
  2068. + return (layouts.getNumChannels (true, 0) <= vstEffect->numInputChannels
  2069. + && layouts.getNumChannels (false, 0) <= vstEffect->numOutputChannels);
  2070. }
  2071. //==============================================================================
  2072. #if JUCE_IOS || JUCE_ANDROID
  2073. bool hasEditor() const override { return false; }
  2074. #else
  2075. - bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsHasEditor) != 0; }
  2076. + bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagHasEditor) != 0; }
  2077. #endif
  2078. AudioProcessorEditor* createEditor() override;
  2079. @@ -1491,9 +1489,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2080. {
  2081. if (isValidChannel (index, true))
  2082. {
  2083. - Vst2::VstPinProperties pinProps;
  2084. - if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0)
  2085. - return String (pinProps.label, sizeof (pinProps.label));
  2086. + Vst2::VstPinInfo pinProps;
  2087. + if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  2088. + return String (pinProps.text, sizeof (pinProps.text));
  2089. }
  2090. return {};
  2091. @@ -1504,9 +1502,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2092. if (! isValidChannel (index, true))
  2093. return false;
  2094. - Vst2::VstPinProperties pinProps;
  2095. - if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0)
  2096. - return (pinProps.flags & Vst2::kVstPinIsStereo) != 0;
  2097. + Vst2::VstPinInfo pinProps;
  2098. + if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  2099. + return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0;
  2100. return true;
  2101. }
  2102. @@ -1515,9 +1513,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2103. {
  2104. if (isValidChannel (index, false))
  2105. {
  2106. - Vst2::VstPinProperties pinProps;
  2107. - if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0)
  2108. - return String (pinProps.label, sizeof (pinProps.label));
  2109. + Vst2::VstPinInfo pinProps;
  2110. + if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  2111. + return String (pinProps.text, sizeof (pinProps.text));
  2112. }
  2113. return {};
  2114. @@ -1528,9 +1526,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2115. if (! isValidChannel (index, false))
  2116. return false;
  2117. - Vst2::VstPinProperties pinProps;
  2118. - if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0)
  2119. - return (pinProps.flags & Vst2::kVstPinIsStereo) != 0;
  2120. + Vst2::VstPinInfo pinProps;
  2121. + if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  2122. + return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0;
  2123. return true;
  2124. }
  2125. @@ -1545,12 +1543,12 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2126. int getNumPrograms() override { return vstEffect != nullptr ? jmax (0, vstEffect->numPrograms) : 0; }
  2127. // NB: some plugs return negative numbers from this function.
  2128. - int getCurrentProgram() override { return (int) dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); }
  2129. + int getCurrentProgram() override { return (int) dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, 0, 0); }
  2130. void setCurrentProgram (int newIndex) override
  2131. {
  2132. if (getNumPrograms() > 0 && newIndex != getCurrentProgram())
  2133. - dispatch (Vst2::effSetProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), nullptr, 0);
  2134. + dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), 0, 0);
  2135. }
  2136. const String getProgramName (int index) override
  2137. @@ -1564,7 +1562,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2138. {
  2139. char nm[264] = { 0 };
  2140. - if (dispatch (Vst2::effGetProgramNameIndexed, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0)
  2141. + if (dispatch (Vst2::plugInOpcodeGetProgramName, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0)
  2142. return String::fromUTF8 (nm).trim();
  2143. }
  2144. }
  2145. @@ -1577,7 +1575,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2146. if (index >= 0 && index == getCurrentProgram())
  2147. {
  2148. if (getNumPrograms() > 0 && newName != getCurrentProgramName())
  2149. - dispatch (Vst2::effSetProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f);
  2150. + dispatch (Vst2::plugInOpcodeSetCurrentProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f);
  2151. }
  2152. else
  2153. {
  2154. @@ -1595,7 +1593,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2155. //==============================================================================
  2156. void timerCallback() override
  2157. {
  2158. - if (dispatch (Vst2::effIdle, 0, 0, nullptr, 0) == 0)
  2159. + if (dispatch (Vst2::plugInOpcodeIdle, 0, 0, nullptr, 0) == 0)
  2160. stopTimer();
  2161. }
  2162. @@ -1609,7 +1607,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2163. {
  2164. switch (opcode)
  2165. {
  2166. - case Vst2::audioMasterAutomate:
  2167. + case Vst2::hostOpcodeParameterChanged:
  2168. if (auto* param = getParameters()[index])
  2169. param->sendValueChangedMessageToListeners (opt);
  2170. else
  2171. @@ -1617,23 +1615,23 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2172. break;
  2173. - case Vst2::audioMasterProcessEvents: handleMidiFromPlugin ((const Vst2::VstEvents*) ptr); break;
  2174. - case Vst2::audioMasterGetTime: return getVSTTime();
  2175. - case Vst2::audioMasterIdle: handleIdle(); break;
  2176. - case Vst2::audioMasterSizeWindow: setWindowSize (index, (int) value); return 1;
  2177. - case Vst2::audioMasterUpdateDisplay: triggerAsyncUpdate(); break;
  2178. - case Vst2::audioMasterIOChanged: setLatencySamples (vstEffect->initialDelay); break;
  2179. - case Vst2::audioMasterNeedIdle: startTimer (50); break;
  2180. + case Vst2::hostOpcodePreAudioProcessingEvents: handleMidiFromPlugin ((const Vst2::VstEventBlock*) ptr); break;
  2181. + case Vst2::hostOpcodeGetTimingInfo: return getVSTTime();
  2182. + case Vst2::hostOpcodeIdle: handleIdle(); break;
  2183. + case Vst2::hostOpcodeWindowSize: setWindowSize (index, (int) value); return 1;
  2184. + case Vst2::hostOpcodeUpdateView: triggerAsyncUpdate(); break;
  2185. + case Vst2::hostOpcodeIOModified: setLatencySamples (vstEffect->latency); break;
  2186. + case Vst2::hostOpcodeNeedsIdle: startTimer (50); break;
  2187. - case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue);
  2188. - case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue);
  2189. - case Vst2::audioMasterWantMidi: wantsMidiMessages = true; break;
  2190. - case Vst2::audioMasterGetDirectory: return getVstDirectory();
  2191. + case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue);
  2192. + case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue);
  2193. + case Vst2::hostOpcodePlugInWantsMidi: wantsMidiMessages = true; break;
  2194. + case Vst2::hostOpcodeGetDirectory: return getVstDirectory();
  2195. - case Vst2::audioMasterTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0);
  2196. - case Vst2::audioMasterGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0);
  2197. + case Vst2::hostOpcodeTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0);
  2198. + case Vst2::hostOpcodeGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0);
  2199. - case Vst2::audioMasterBeginEdit:
  2200. + case Vst2::hostOpcodeParameterChangeGestureBegin:
  2201. if (auto* param = getParameters()[index])
  2202. param->beginChangeGesture();
  2203. else
  2204. @@ -1641,7 +1639,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2205. break;
  2206. - case Vst2::audioMasterEndEdit:
  2207. + case Vst2::hostOpcodeParameterChangeGestureEnd:
  2208. if (auto* param = getParameters()[index])
  2209. param->endChangeGesture();
  2210. else
  2211. @@ -1649,28 +1647,28 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2212. break;
  2213. - case Vst2::audioMasterPinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true)
  2214. - case Vst2::audioMasterGetCurrentProcessLevel: return isNonRealtime() ? 4 : 0;
  2215. + case Vst2::hostOpcodePinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true)
  2216. + case Vst2::hostOpcodeGetCurrentAudioProcessingLevel: return isNonRealtime() ? 4 : 0;
  2217. // none of these are handled (yet)...
  2218. - case Vst2::audioMasterSetTime:
  2219. - case Vst2::audioMasterGetParameterQuantization:
  2220. - case Vst2::audioMasterGetInputLatency:
  2221. - case Vst2::audioMasterGetOutputLatency:
  2222. - case Vst2::audioMasterGetPreviousPlug:
  2223. - case Vst2::audioMasterGetNextPlug:
  2224. - case Vst2::audioMasterWillReplaceOrAccumulate:
  2225. - case Vst2::audioMasterOfflineStart:
  2226. - case Vst2::audioMasterOfflineRead:
  2227. - case Vst2::audioMasterOfflineWrite:
  2228. - case Vst2::audioMasterOfflineGetCurrentPass:
  2229. - case Vst2::audioMasterOfflineGetCurrentMetaPass:
  2230. - case Vst2::audioMasterGetOutputSpeakerArrangement:
  2231. - case Vst2::audioMasterVendorSpecific:
  2232. - case Vst2::audioMasterSetIcon:
  2233. - case Vst2::audioMasterGetLanguage:
  2234. - case Vst2::audioMasterOpenWindow:
  2235. - case Vst2::audioMasterCloseWindow:
  2236. + case Vst2::hostOpcodeSetTime:
  2237. + case Vst2::hostOpcodeGetParameterInterval:
  2238. + case Vst2::hostOpcodeGetInputLatency:
  2239. + case Vst2::hostOpcodeGetOutputLatency:
  2240. + case Vst2::hostOpcodeGetPreviousPlugIn:
  2241. + case Vst2::hostOpcodeGetNextPlugIn:
  2242. + case Vst2::hostOpcodeWillReplace:
  2243. + case Vst2::hostOpcodeOfflineStart:
  2244. + case Vst2::hostOpcodeOfflineReadSource:
  2245. + case Vst2::hostOpcodeOfflineWrite:
  2246. + case Vst2::hostOpcodeOfflineGetCurrentPass:
  2247. + case Vst2::hostOpcodeOfflineGetCurrentMetaPass:
  2248. + case Vst2::hostOpcodeGetOutputSpeakerConfiguration:
  2249. + case Vst2::hostOpcodeManufacturerSpecific:
  2250. + case Vst2::hostOpcodeSetIcon:
  2251. + case Vst2::hostOpcodeGetLanguage:
  2252. + case Vst2::hostOpcodeOpenEditorWindow:
  2253. + case Vst2::hostOpcodeCloseEditorWindow:
  2254. break;
  2255. default:
  2256. @@ -1685,19 +1683,19 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2257. {
  2258. switch (opcode)
  2259. {
  2260. - case Vst2::audioMasterCanDo: return handleCanDo ((const char*) ptr);
  2261. - case Vst2::audioMasterVersion: return 2400;
  2262. - case Vst2::audioMasterCurrentId: return shellUIDToCreate;
  2263. - case Vst2::audioMasterGetNumAutomatableParameters: return 0;
  2264. - case Vst2::audioMasterGetAutomationState: return 1;
  2265. - case Vst2::audioMasterGetVendorVersion: return 0x0101;
  2266. + case Vst2::hostOpcodeCanHostDo: return handleCanDo ((const char*) ptr);
  2267. + case Vst2::hostOpcodeVstVersion: return 2400;
  2268. + case Vst2::hostOpcodeCurrentId: return shellUIDToCreate;
  2269. + case Vst2::hostOpcodeGetNumberOfAutomatableParameters: return 0;
  2270. + case Vst2::hostOpcodeGetAutomationState: return 1;
  2271. + case Vst2::hostOpcodeGetManufacturerVersion: return 0x0101;
  2272. - case Vst2::audioMasterGetVendorString:
  2273. - case Vst2::audioMasterGetProductString: return getHostName ((char*) ptr);
  2274. + case Vst2::hostOpcodeGetManufacturerName:
  2275. + case Vst2::hostOpcodeGetProductName: return getHostName ((char*) ptr);
  2276. - case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue;
  2277. - case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue;
  2278. - case Vst2::audioMasterSetOutputSampleRate: return 0;
  2279. + case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue;
  2280. + case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue;
  2281. + case Vst2::hostOpcodeSetOutputSampleRate: return 0;
  2282. default:
  2283. DBG ("*** Unhandled VST Callback: " + String ((int) opcode));
  2284. @@ -1726,7 +1724,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2285. UseResFile (vstModule->resFileId);
  2286. #endif
  2287. - result = vstEffect->dispatcher (vstEffect, opcode, index, value, ptr, opt);
  2288. + result = vstEffect->dispatchFunction (vstEffect, opcode, index, value, ptr, opt);
  2289. #if JUCE_MAC
  2290. auto newResFile = CurResFile();
  2291. @@ -1932,14 +1930,14 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2292. return true;
  2293. }
  2294. - bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsProgramChunks) != 0; }
  2295. + bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagDataInChunks) != 0; }
  2296. bool getChunkData (MemoryBlock& mb, bool isPreset, int maxSizeMB) const
  2297. {
  2298. if (usesChunks())
  2299. {
  2300. void* data = nullptr;
  2301. - auto bytes = (size_t) dispatch (Vst2::effGetChunk, isPreset ? 1 : 0, 0, &data, 0.0f);
  2302. + auto bytes = (size_t) dispatch (Vst2::plugInOpcodeGetData, isPreset ? 1 : 0, 0, &data, 0.0f);
  2303. if (data != nullptr && bytes <= (size_t) maxSizeMB * 1024 * 1024)
  2304. {
  2305. @@ -1957,7 +1955,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2306. {
  2307. if (size > 0 && usesChunks())
  2308. {
  2309. - dispatch (Vst2::effSetChunk, isPreset ? 1 : 0, size, (void*) data, 0.0f);
  2310. + dispatch (Vst2::plugInOpcodeSetData, isPreset ? 1 : 0, size, (void*) data, 0.0f);
  2311. if (! isPreset)
  2312. updateStoredProgramNames();
  2313. @@ -1968,7 +1966,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  2314. return false;
  2315. }
  2316. - Vst2::AEffect* vstEffect;
  2317. + Vst2::VstEffectInterface* vstEffect;
  2318. ModuleHandle::Ptr vstModule;
  2319. std::unique_ptr<VSTPluginFormat::ExtraFunctions> extraFunctions;
  2320. @@ -1991,7 +1989,7 @@ private:
  2321. currentValue = (newValue != 0.0f);
  2322. if (parent.vstSupportsBypass)
  2323. - parent.dispatch (Vst2::effSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f);
  2324. + parent.dispatch (Vst2::plugInOpcodeSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f);
  2325. }
  2326. float getValueForText (const String& text) const override
  2327. @@ -2038,7 +2036,7 @@ private:
  2328. CriticalSection midiInLock;
  2329. MidiBuffer incomingMidi;
  2330. VSTMidiEventList midiEventsToSend;
  2331. - Vst2::VstTimeInfo vstHostTime;
  2332. + Vst2::VstTimingInformation vstHostTime;
  2333. AudioBuffer<float> tmpBufferFloat;
  2334. HeapBlock<float*> channelBufferFloat;
  2335. @@ -2075,7 +2073,7 @@ private:
  2336. if (auto* app = JUCEApplicationBase::getInstance())
  2337. hostName = app->getApplicationName();
  2338. - hostName.copyToUTF8 (name, (size_t) jmin (Vst2::kVstMaxVendorStrLen, Vst2::kVstMaxProductStrLen) - 1);
  2339. + hostName.copyToUTF8 (name, (size_t) jmin (Vst2::vstMaxManufacturerStringLength, Vst2::vstMaxPlugInNameStringLength) - 1);
  2340. return 1;
  2341. }
  2342. @@ -2096,7 +2094,7 @@ private:
  2343. #if JUCE_MAC
  2344. if (getActiveEditor() != nullptr)
  2345. - dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0);
  2346. + dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0);
  2347. #endif
  2348. Timer::callPendingTimersSynchronously();
  2349. @@ -2131,9 +2129,9 @@ private:
  2350. }
  2351. //==============================================================================
  2352. - static Vst2::AEffect* constructEffect (const ModuleHandle::Ptr& module)
  2353. + static Vst2::VstEffectInterface* constructEffect (const ModuleHandle::Ptr& module)
  2354. {
  2355. - Vst2::AEffect* effect = nullptr;
  2356. + Vst2::VstEffectInterface* effect = nullptr;
  2357. try
  2358. {
  2359. const IdleCallRecursionPreventer icrp;
  2360. @@ -2150,10 +2148,10 @@ private:
  2361. JUCE_VST_WRAPPER_INVOKE_MAIN
  2362. }
  2363. - if (effect != nullptr && effect->magic == 0x56737450 /* 'VstP' */)
  2364. + if (effect != nullptr && effect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier)
  2365. {
  2366. - jassert (effect->resvd2 == 0);
  2367. - jassert (effect->object != nullptr);
  2368. + jassert (effect->hostSpace2 == 0);
  2369. + jassert (effect->effectPointer != 0);
  2370. _fpreset(); // some dodgy plugs mess around with this
  2371. }
  2372. @@ -2168,11 +2166,11 @@ private:
  2373. return effect;
  2374. }
  2375. - static BusesProperties queryBusIO (Vst2::AEffect* effect)
  2376. + static BusesProperties queryBusIO (Vst2::VstEffectInterface* effect)
  2377. {
  2378. BusesProperties returnValue;
  2379. - if (effect->numInputs == 0 && effect->numOutputs == 0)
  2380. + if (effect->numInputChannels == 0 && effect->numOutputChannels == 0)
  2381. return returnValue;
  2382. // Workaround for old broken JUCE plug-ins which would return an invalid
  2383. @@ -2183,14 +2181,14 @@ private:
  2384. // plug-in is reporting.
  2385. if (! pluginHasDefaultChannelLayouts (effect))
  2386. {
  2387. - SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputs));
  2388. - SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputs));
  2389. + SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputChannels));
  2390. + SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputChannels));
  2391. - effect->dispatcher (effect, Vst2::effSetSpeakerArrangement, 0,
  2392. + effect->dispatchFunction (effect, Vst2::plugInOpcodeSetSpeakerConfiguration, 0,
  2393. (pointer_sized_int) &canonicalIn.get(), (void*) &canonicalOut.get(), 0.0f);
  2394. }
  2395. - HeapBlock<Vst2::VstSpeakerArrangement> inArrBlock (1, true), outArrBlock (1, true);
  2396. + HeapBlock<Vst2::VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true);
  2397. auto* inArr = inArrBlock.get();
  2398. auto* outArr = outArrBlock.get();
  2399. @@ -2201,35 +2199,35 @@ private:
  2400. for (int dir = 0; dir < 2; ++dir)
  2401. {
  2402. const bool isInput = (dir == 0);
  2403. - const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties);
  2404. - const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs);
  2405. - const Vst2::VstSpeakerArrangement* arr = (isInput ? inArr : outArr);
  2406. + const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties);
  2407. + const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels);
  2408. + const Vst2::VstSpeakerConfiguration* arr = (isInput ? inArr : outArr);
  2409. bool busAdded = false;
  2410. - Vst2::VstPinProperties pinProps;
  2411. + Vst2::VstPinInfo pinProps;
  2412. AudioChannelSet layout;
  2413. for (int ch = 0; ch < maxChannels; ch += layout.size())
  2414. {
  2415. - if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  2416. + if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  2417. break;
  2418. - if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0)
  2419. + if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0)
  2420. {
  2421. - layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.arrangementType, 0);
  2422. + layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.configurationType, 0);
  2423. if (layout.isDisabled())
  2424. break;
  2425. }
  2426. else if (arr == nullptr)
  2427. {
  2428. - layout = ((pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono());
  2429. + layout = ((pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono());
  2430. }
  2431. else
  2432. break;
  2433. busAdded = true;
  2434. - returnValue.addBus (isInput, pinProps.label, layout, true);
  2435. + returnValue.addBus (isInput, pinProps.text, layout, true);
  2436. }
  2437. // no buses?
  2438. @@ -2237,8 +2235,8 @@ private:
  2439. {
  2440. String busName = (isInput ? "Input" : "Output");
  2441. - if (effect->dispatcher (effect, opcode, 0, 0, &pinProps, 0.0f) != 0)
  2442. - busName = pinProps.label;
  2443. + if (effect->dispatchFunction (effect, opcode, 0, 0, &pinProps, 0.0f) != 0)
  2444. + busName = pinProps.text;
  2445. if (arr != nullptr)
  2446. layout = SpeakerMappings::vstArrangementTypeToChannelSet (*arr);
  2447. @@ -2252,9 +2250,9 @@ private:
  2448. return returnValue;
  2449. }
  2450. - static bool pluginHasDefaultChannelLayouts (Vst2::AEffect* effect)
  2451. + static bool pluginHasDefaultChannelLayouts (Vst2::VstEffectInterface* effect)
  2452. {
  2453. - HeapBlock<Vst2::VstSpeakerArrangement> inArrBlock (1, true), outArrBlock (1, true);
  2454. + HeapBlock<Vst2::VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true);
  2455. auto* inArr = inArrBlock.get();
  2456. auto* outArr = outArrBlock.get();
  2457. @@ -2265,40 +2263,40 @@ private:
  2458. for (int dir = 0; dir < 2; ++dir)
  2459. {
  2460. const bool isInput = (dir == 0);
  2461. - const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties);
  2462. - const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs);
  2463. + const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties);
  2464. + const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels);
  2465. int channels = 1;
  2466. for (int ch = 0; ch < maxChannels; ch += channels)
  2467. {
  2468. - Vst2::VstPinProperties pinProps;
  2469. + Vst2::VstPinInfo pinProps;
  2470. - if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  2471. + if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  2472. return false;
  2473. - if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0)
  2474. + if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0)
  2475. return true;
  2476. - channels = (pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? 2 : 1;
  2477. + channels = (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? 2 : 1;
  2478. }
  2479. }
  2480. return false;
  2481. }
  2482. - static bool getSpeakerArrangementWrapper (Vst2::AEffect* effect,
  2483. - Vst2::VstSpeakerArrangement* inArr,
  2484. - Vst2::VstSpeakerArrangement* outArr)
  2485. + static bool getSpeakerArrangementWrapper (Vst2::VstEffectInterface* effect,
  2486. + Vst2::VstSpeakerConfiguration* inArr,
  2487. + Vst2::VstSpeakerConfiguration* outArr)
  2488. {
  2489. // Workaround: unfortunately old JUCE VST-2 plug-ins had a bug and would crash if
  2490. // you try to get the speaker arrangement when there are no input channels present.
  2491. // Hopefully, one day (when there are no more old JUCE plug-ins around), we can
  2492. // comment out the next two lines.
  2493. - if (effect->numInputs == 0)
  2494. + if (effect->numInputChannels == 0)
  2495. return false;
  2496. - return (effect->dispatcher (effect, Vst2::effGetSpeakerArrangement, 0,
  2497. + return (effect->dispatchFunction (effect, Vst2::plugInOpcodeGetSpeakerArrangement, 0,
  2498. reinterpret_cast<pointer_sized_int> (&inArr), &outArr, 0.0f) != 0);
  2499. }
  2500. @@ -2332,57 +2330,57 @@ private:
  2501. if (currentPlayHead->getCurrentPosition (position))
  2502. {
  2503. - vstHostTime.samplePos = (double) position.timeInSamples;
  2504. - vstHostTime.tempo = position.bpm;
  2505. - vstHostTime.timeSigNumerator = position.timeSigNumerator;
  2506. - vstHostTime.timeSigDenominator = position.timeSigDenominator;
  2507. - vstHostTime.ppqPos = position.ppqPosition;
  2508. - vstHostTime.barStartPos = position.ppqPositionOfLastBarStart;
  2509. - vstHostTime.flags |= Vst2::kVstTempoValid
  2510. - | Vst2::kVstTimeSigValid
  2511. - | Vst2::kVstPpqPosValid
  2512. - | Vst2::kVstBarsValid;
  2513. + vstHostTime.samplePosition = (double) position.timeInSamples;
  2514. + vstHostTime.tempoBPM = position.bpm;
  2515. + vstHostTime.timeSignatureNumerator = position.timeSigNumerator;
  2516. + vstHostTime.timeSignatureDenominator = position.timeSigDenominator;
  2517. + vstHostTime.musicalPosition = position.ppqPosition;
  2518. + vstHostTime.lastBarPosition = position.ppqPositionOfLastBarStart;
  2519. + vstHostTime.flags |= Vst2::vstTimingInfoFlagTempoValid
  2520. + | Vst2::vstTimingInfoFlagTimeSignatureValid
  2521. + | Vst2::vstTimingInfoFlagMusicalPositionValid
  2522. + | Vst2::vstTimingInfoFlagLastBarPositionValid;
  2523. int32 newTransportFlags = 0;
  2524. - if (position.isPlaying) newTransportFlags |= Vst2::kVstTransportPlaying;
  2525. - if (position.isRecording) newTransportFlags |= Vst2::kVstTransportRecording;
  2526. + if (position.isPlaying) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyPlaying;
  2527. + if (position.isRecording) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyRecording;
  2528. - if (newTransportFlags != (vstHostTime.flags & (Vst2::kVstTransportPlaying
  2529. - | Vst2::kVstTransportRecording)))
  2530. - vstHostTime.flags = (vstHostTime.flags & ~(Vst2::kVstTransportPlaying | Vst2::kVstTransportRecording)) | newTransportFlags | Vst2::kVstTransportChanged;
  2531. + if (newTransportFlags != (vstHostTime.flags & (Vst2::vstTimingInfoFlagCurrentlyPlaying
  2532. + | Vst2::vstTimingInfoFlagCurrentlyRecording)))
  2533. + vstHostTime.flags = (vstHostTime.flags & ~(Vst2::vstTimingInfoFlagCurrentlyPlaying | Vst2::vstTimingInfoFlagCurrentlyRecording)) | newTransportFlags | Vst2::vstTimingInfoFlagTransportChanged;
  2534. else
  2535. - vstHostTime.flags &= ~Vst2::kVstTransportChanged;
  2536. + vstHostTime.flags &= ~Vst2::vstTimingInfoFlagTransportChanged;
  2537. switch (position.frameRate)
  2538. {
  2539. - case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::kVstSmpte24fps, 24.0, position.timeInSeconds); break;
  2540. - case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::kVstSmpte25fps, 25.0, position.timeInSeconds); break;
  2541. - case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::kVstSmpte30fps, 30.0, position.timeInSeconds); break;
  2542. - case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::kVstSmpte60fps, 60.0, position.timeInSeconds); break;
  2543. -
  2544. - case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::kVstSmpte239fps, 24.0, position.timeInSeconds); break;
  2545. - case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997fps, 30.0, position.timeInSeconds); break;
  2546. - case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997dfps, 30.0, position.timeInSeconds); break;
  2547. - case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte30dfps, 30.0, position.timeInSeconds); break;
  2548. - case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte599fps, 60.0, position.timeInSeconds); break;
  2549. + case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::vstSmpteRateFps24, 24.0, position.timeInSeconds); break;
  2550. + case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::vstSmpteRateFps25, 25.0, position.timeInSeconds); break;
  2551. + case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::vstSmpteRateFps30, 30.0, position.timeInSeconds); break;
  2552. + case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::vstSmpteRateFps60, 60.0, position.timeInSeconds); break;
  2553. +
  2554. + case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps239, 24.0, position.timeInSeconds); break;
  2555. + case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997, 30.0, position.timeInSeconds); break;
  2556. + case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997drop, 30.0, position.timeInSeconds); break;
  2557. + case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps30drop, 30.0, position.timeInSeconds); break;
  2558. + case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps599, 60.0, position.timeInSeconds); break;
  2559. case AudioPlayHead::fpsUnknown:
  2560. default: break;
  2561. }
  2562. if (position.isLooping)
  2563. {
  2564. - vstHostTime.cycleStartPos = position.ppqLoopStart;
  2565. - vstHostTime.cycleEndPos = position.ppqLoopEnd;
  2566. - vstHostTime.flags |= (Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive);
  2567. + vstHostTime.loopStartPosition = position.ppqLoopStart;
  2568. + vstHostTime.loopEndPosition = position.ppqLoopEnd;
  2569. + vstHostTime.flags |= (Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive);
  2570. }
  2571. else
  2572. {
  2573. - vstHostTime.flags &= ~(Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive);
  2574. + vstHostTime.flags &= ~(Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive);
  2575. }
  2576. }
  2577. }
  2578. - vstHostTime.nanoSeconds = getVSTHostTimeNanoseconds();
  2579. + vstHostTime.systemTimeNanoseconds = getVSTHostTimeNanoseconds();
  2580. if (wantsMidiMessages)
  2581. {
  2582. @@ -2393,13 +2391,13 @@ private:
  2583. midiEventsToSend.addEvent (metadata.data, metadata.numBytes,
  2584. jlimit (0, numSamples - 1, metadata.samplePosition));
  2585. - vstEffect->dispatcher (vstEffect, Vst2::effProcessEvents, 0, 0, midiEventsToSend.events, 0);
  2586. + vstEffect->dispatchFunction (vstEffect, Vst2::plugInOpcodePreAudioProcessingEvents, 0, 0, midiEventsToSend.events, 0);
  2587. }
  2588. _clearfp();
  2589. // always ensure that the buffer is at least as large as the maximum number of channels
  2590. - auto maxChannels = jmax (vstEffect->numInputs, vstEffect->numOutputs);
  2591. + auto maxChannels = jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels);
  2592. auto channels = channelBuffer.get();
  2593. if (numChannels < maxChannels)
  2594. @@ -2438,35 +2436,35 @@ private:
  2595. //==============================================================================
  2596. inline void invokeProcessFunction (AudioBuffer<float>& buffer, int32 sampleFrames)
  2597. {
  2598. - if ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0)
  2599. + if ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0)
  2600. {
  2601. - vstEffect->processReplacing (vstEffect, buffer.getArrayOfWritePointers(),
  2602. + vstEffect->processAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(),
  2603. buffer.getArrayOfWritePointers(), sampleFrames);
  2604. }
  2605. else
  2606. {
  2607. - outOfPlaceBuffer.setSize (vstEffect->numOutputs, sampleFrames);
  2608. + outOfPlaceBuffer.setSize (vstEffect->numOutputChannels, sampleFrames);
  2609. outOfPlaceBuffer.clear();
  2610. - vstEffect->process (vstEffect, buffer.getArrayOfWritePointers(),
  2611. - outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames);
  2612. + vstEffect->processAudioFunction (vstEffect, buffer.getArrayOfWritePointers(),
  2613. + outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames);
  2614. - for (int i = vstEffect->numOutputs; --i >= 0;)
  2615. + for (int i = vstEffect->numOutputChannels; --i >= 0;)
  2616. buffer.copyFrom (i, 0, outOfPlaceBuffer.getReadPointer (i), sampleFrames);
  2617. }
  2618. }
  2619. inline void invokeProcessFunction (AudioBuffer<double>& buffer, int32 sampleFrames)
  2620. {
  2621. - vstEffect->processDoubleReplacing (vstEffect, buffer.getArrayOfWritePointers(),
  2622. + vstEffect->processDoubleAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(),
  2623. buffer.getArrayOfWritePointers(), sampleFrames);
  2624. }
  2625. //==============================================================================
  2626. void setHostTimeFrameRate (long frameRateIndex, double frameRate, double currentTime) noexcept
  2627. {
  2628. - vstHostTime.flags |= Vst2::kVstSmpteValid;
  2629. - vstHostTime.smpteFrameRate = (int32) frameRateIndex;
  2630. + vstHostTime.flags |= Vst2::vstTimingInfoFlagSmpteValid;
  2631. + vstHostTime.smpteRate = (int32) frameRateIndex;
  2632. vstHostTime.smpteOffset = (int32) (currentTime * 80.0 * frameRate + 0.5);
  2633. }
  2634. @@ -2497,7 +2495,7 @@ private:
  2635. if (vstEffect == nullptr)
  2636. return {};
  2637. - jassert (index >= 0 && index < vstEffect->numParams);
  2638. + jassert (index >= 0 && index < vstEffect->numParameters);
  2639. char nm[256] = { 0 };
  2640. dispatch (opcode, index, 0, nm, 0);
  2641. return String::createStringFromData (nm, (int) sizeof (nm)).trim();
  2642. @@ -2511,7 +2509,7 @@ private:
  2643. {
  2644. {
  2645. char nm[256] = { 0 };
  2646. - dispatch (Vst2::effGetProgramName, 0, 0, nm, 0);
  2647. + dispatch (Vst2::plugInOpcodeGetCurrentProgramName, 0, 0, nm, 0);
  2648. progName = String::createStringFromData (nm, (int) sizeof (nm)).trim();
  2649. }
  2650. @@ -2555,7 +2553,7 @@ private:
  2651. char nm[256] = { 0 };
  2652. // only do this if the plugin can't use indexed names..
  2653. - if (dispatch (Vst2::effGetProgramNameIndexed, 0, -1, nm, 0) == 0)
  2654. + if (dispatch (Vst2::plugInOpcodeGetProgramName, 0, -1, nm, 0) == 0)
  2655. {
  2656. auto oldProgram = getCurrentProgram();
  2657. MemoryBlock oldSettings;
  2658. @@ -2573,7 +2571,7 @@ private:
  2659. }
  2660. }
  2661. - void handleMidiFromPlugin (const Vst2::VstEvents* events)
  2662. + void handleMidiFromPlugin (const Vst2::VstEventBlock* events)
  2663. {
  2664. if (events != nullptr)
  2665. {
  2666. @@ -2620,11 +2618,11 @@ private:
  2667. }
  2668. //==============================================================================
  2669. - int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->version : 0; }
  2670. + int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->plugInVersion : 0; }
  2671. String getVersion() const
  2672. {
  2673. - auto v = (unsigned int) dispatch (Vst2::effGetVendorVersion, 0, 0, nullptr, 0);
  2674. + auto v = (unsigned int) dispatch (Vst2::plugInOpcodeGetManufacturerVersion, 0, 0, nullptr, 0);
  2675. String s;
  2676. @@ -2692,7 +2690,6 @@ private:
  2677. case Vst2::kPlugCategOfflineProcess: return "Offline Process";
  2678. case Vst2::kPlugCategShell: return "Shell";
  2679. case Vst2::kPlugCategUnknown: return "Unknown";
  2680. - case Vst2::kPlugCategMaxCount:
  2681. default: break;
  2682. }
  2683. @@ -2701,7 +2698,7 @@ private:
  2684. void setPower (const bool on)
  2685. {
  2686. - dispatch (Vst2::effMainsChanged, 0, on ? 1 : 0, nullptr, 0);
  2687. + dispatch (Vst2::plugInOpcodeResumeSuspend, 0, on ? 1 : 0, nullptr, 0);
  2688. isPowerOn = on;
  2689. }
  2690. @@ -2768,11 +2765,11 @@ public:
  2691. activeVSTWindows.add (this);
  2692. - Vst2::ERect* rect = nullptr;
  2693. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2694. + Vst2::VstEditorBounds* rect = nullptr;
  2695. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2696. if (rect != nullptr)
  2697. - setSize (rect->right - rect->left, rect->bottom - rect->top);
  2698. + setSize (rect->rightmost - rect->leftmost, rect->lower - rect->upper);
  2699. else
  2700. setSize (1, 1);
  2701. @@ -2944,7 +2941,7 @@ public:
  2702. nativeScaleFactor = (float) newScaleFactor;
  2703. if (pluginRespondsToDPIChanges)
  2704. - dispatch (Vst2::effVendorSpecific,
  2705. + dispatch (Vst2::plugInOpcodeManufacturerSpecific,
  2706. (int) ByteOrder::bigEndianInt ("PreS"),
  2707. (int) ByteOrder::bigEndianInt ("AeCs"),
  2708. nullptr, nativeScaleFactor);
  2709. @@ -2973,7 +2970,7 @@ public:
  2710. if (! reentrantGuard)
  2711. {
  2712. reentrantGuard = true;
  2713. - plugin.dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0);
  2714. + plugin.dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0);
  2715. reentrantGuard = false;
  2716. }
  2717. @@ -3005,7 +3002,7 @@ public:
  2718. activeVSTWindows.add (this);
  2719. #if JUCE_MAC
  2720. - dispatch (Vst2::effEditTop, 0, 0, nullptr, 0);
  2721. + dispatch (Vst2::plugInOpcodeeffEditorTop, 0, 0, nullptr, 0);
  2722. #endif
  2723. }
  2724. @@ -3035,24 +3032,24 @@ private:
  2725. isOpen = true;
  2726. - Vst2::ERect* rect = nullptr;
  2727. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2728. - dispatch (Vst2::effEditOpen, 0, 0, parentWindow, 0);
  2729. + Vst2::VstEditorBounds* rect = nullptr;
  2730. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2731. + dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, parentWindow, 0);
  2732. // do this before and after like in the steinberg example
  2733. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2734. - dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code
  2735. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2736. + dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code
  2737. // Install keyboard hooks
  2738. - pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0);
  2739. + pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0);
  2740. // double-check it's not too tiny
  2741. int w = 250, h = 150;
  2742. if (rect != nullptr)
  2743. {
  2744. - w = rect->right - rect->left;
  2745. - h = rect->bottom - rect->top;
  2746. + w = rect->rightmost - rect->leftmost;
  2747. + h = rect->lower - rect->upper;
  2748. if (w == 0 || h == 0)
  2749. {
  2750. @@ -3083,14 +3080,14 @@ private:
  2751. if (auto* peer = getTopLevelComponent()->getPeer())
  2752. setScaleFactorAndDispatchMessage (peer->getPlatformScaleFactor());
  2753. - Vst2::ERect* rect = nullptr;
  2754. + Vst2::VstEditorBounds* rect = nullptr;
  2755. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2756. - dispatch (Vst2::effEditOpen, 0, 0, getWindowHandle(), 0);
  2757. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); // do this before and after like in the steinberg example
  2758. - dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code
  2759. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2760. + dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, getWindowHandle(), 0);
  2761. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); // do this before and after like in the steinberg example
  2762. + dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code
  2763. - pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0);
  2764. + pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0);
  2765. #if JUCE_WINDOWS
  2766. originalWndProc = 0;
  2767. @@ -3120,8 +3117,8 @@ private:
  2768. if (rect != nullptr)
  2769. {
  2770. - auto rw = rect->right - rect->left;
  2771. - auto rh = rect->bottom - rect->top;
  2772. + auto rw = rect->rightmost - rect->leftmost;
  2773. + auto rh = rect->lower - rect->upper;
  2774. if ((rw > 50 && rh > 50 && rw < 2000 && rh < 2000 && (! isWithin (w, rw, 2) || ! isWithin (h, rh, 2)))
  2775. || ((w == 0 && rw > 0) || (h == 0 && rh > 0)))
  2776. @@ -3156,8 +3153,8 @@ private:
  2777. if (rect != nullptr)
  2778. {
  2779. - w = rect->right - rect->left;
  2780. - h = rect->bottom - rect->top;
  2781. + w = rect->rightmost - rect->leftmost;
  2782. + h = rect->lower - rect->upper;
  2783. if (w == 0 || h == 0)
  2784. {
  2785. @@ -3206,7 +3203,7 @@ private:
  2786. JUCE_VST_LOG ("Closing VST UI: " + plugin.getName());
  2787. isOpen = false;
  2788. - dispatch (Vst2::effEditClose, 0, 0, nullptr, 0);
  2789. + dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, nullptr, 0);
  2790. stopTimer();
  2791. #if JUCE_WINDOWS
  2792. @@ -3249,11 +3246,11 @@ private:
  2793. {
  2794. if (! pluginRespondsToDPIChanges)
  2795. {
  2796. - Vst2::ERect* rect = nullptr;
  2797. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2798. + Vst2::VstEditorBounds* rect = nullptr;
  2799. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2800. - auto w = roundToInt ((rect->right - rect->left) / nativeScaleFactor);
  2801. - auto h = roundToInt ((rect->bottom - rect->top) / nativeScaleFactor);
  2802. + auto w = roundToInt ((rect->rightmost - rect->leftmost) / nativeScaleFactor);
  2803. + auto h = roundToInt ((rect->lower - rect->upper) / nativeScaleFactor);
  2804. if (! isWindowSizeCorrectForPlugin (w, h))
  2805. {
  2806. @@ -3332,17 +3329,17 @@ private:
  2807. if (owner.isOpen)
  2808. {
  2809. owner.isOpen = false;
  2810. - owner.dispatch (Vst2::effEditClose, 0, 0, 0, 0);
  2811. - owner.dispatch (Vst2::effEditSleep, 0, 0, 0, 0);
  2812. + owner.dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, 0, 0);
  2813. + owner.dispatch (Vst2::plugInOpcodeSleepEditor, 0, 0, 0, 0);
  2814. }
  2815. }
  2816. bool getEmbeddedViewSize (int& w, int& h) override
  2817. {
  2818. - Vst2::ERect* rect = nullptr;
  2819. - owner.dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2820. - w = rect->right - rect->left;
  2821. - h = rect->bottom - rect->top;
  2822. + Vst2::VstEditorBounds* rect = nullptr;
  2823. + owner.dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2824. + w = rect->rightmost - rect->leftmost;
  2825. + h = rect->lower - rect->upper;
  2826. return true;
  2827. }
  2828. @@ -3352,7 +3349,7 @@ private:
  2829. {
  2830. alreadyInside = true;
  2831. getTopLevelComponent()->toFront (true);
  2832. - owner.dispatch (Vst2::effEditMouse, x, y, 0, 0);
  2833. + owner.dispatch (Vst2::plugInOpcodeGetMouse, x, y, 0, 0);
  2834. alreadyInside = false;
  2835. }
  2836. else
  2837. @@ -3366,13 +3363,13 @@ private:
  2838. if (auto* peer = getPeer())
  2839. {
  2840. auto pos = peer->globalToLocal (getScreenPosition());
  2841. - Vst2::ERect r;
  2842. - r.left = (int16) pos.getX();
  2843. - r.top = (int16) pos.getY();
  2844. - r.right = (int16) (r.left + getWidth());
  2845. - r.bottom = (int16) (r.top + getHeight());
  2846. + Vst2::VstEditorBounds r;
  2847. + r.leftmost = (int16) pos.getX();
  2848. + r.upper = (int16) pos.getY();
  2849. + r.rightmost = (int16) (r.leftmost + getWidth());
  2850. + r.lower = (int16) (r.upper + getHeight());
  2851. - owner.dispatch (Vst2::effEditDraw, 0, 0, &r, 0);
  2852. + owner.dispatch (Vst2::plugInOpcodeDrawEditor, 0, 0, &r, 0);
  2853. }
  2854. }
  2855. @@ -3439,10 +3436,10 @@ AudioProcessorEditor* VSTPluginInstance::createEditor()
  2856. //==============================================================================
  2857. // entry point for all callbacks from the plugin
  2858. -static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt)
  2859. +static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt)
  2860. {
  2861. if (effect != nullptr)
  2862. - if (auto* instance = (VSTPluginInstance*) (effect->resvd2))
  2863. + if (auto* instance = (VSTPluginInstance*) (effect->hostSpace2))
  2864. return instance->handleCallback (opcode, index, value, ptr, opt);
  2865. return VSTPluginInstance::handleGeneralCallback (opcode, index, value, ptr, opt);
  2866. @@ -3493,7 +3490,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& result
  2867. // Normal plugin...
  2868. results.add (new PluginDescription (desc));
  2869. - instance->dispatch (Vst2::effOpen, 0, 0, nullptr, 0);
  2870. + instance->dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0);
  2871. }
  2872. else
  2873. {
  2874. @@ -3501,7 +3498,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& result
  2875. for (;;)
  2876. {
  2877. char shellEffectName [256] = { 0 };
  2878. - auto uid = (int) instance->dispatch (Vst2::effShellGetNextPlugin, 0, 0, shellEffectName, 0);
  2879. + auto uid = (int) instance->dispatch (Vst2::plugInOpcodeNextPlugInUniqueID, 0, 0, shellEffectName, 0);
  2880. if (uid == 0)
  2881. break;
  2882. @@ -3724,8 +3721,8 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct
  2883. AudioPluginInstance* VSTPluginFormat::getPluginInstanceFromVstEffectInterface (void* aEffect)
  2884. {
  2885. - if (auto* vstAEffect = reinterpret_cast<Vst2::AEffect*> (aEffect))
  2886. - if (auto* instanceVST = reinterpret_cast<VSTPluginInstance*> (vstAEffect->resvd2))
  2887. + if (auto* vstAEffect = reinterpret_cast<Vst2::VstEffectInterface*> (aEffect))
  2888. + if (auto* instanceVST = reinterpret_cast<VSTPluginInstance*> (vstAEffect->hostSpace2))
  2889. return dynamic_cast<AudioPluginInstance*> (instanceVST);
  2890. return nullptr;