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.

2797 lines
154KB

  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 58b34493b..8683dc728 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. @@ -288,7 +280,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. @@ -319,41 +311,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. @@ -397,7 +389,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. @@ -532,7 +524,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. @@ -561,7 +553,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. @@ -572,7 +564,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. @@ -584,7 +576,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. @@ -603,16 +595,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. @@ -626,7 +618,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. @@ -653,28 +645,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. @@ -682,34 +674,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. @@ -721,14 +713,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. @@ -748,7 +740,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. @@ -764,7 +756,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. @@ -778,19 +770,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. @@ -806,7 +798,7 @@ public:
  293. hostChangeUpdater.update (details);
  294. }
  295. - bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const
  296. + bool getPinProperties (Vst2::VstPinInfo& properties, bool direction, int index) const
  297. {
  298. if (processor->isMidiEffect())
  299. return false;
  300. @@ -815,9 +807,9 @@ public:
  301. // fill with default
  302. properties.flags = 0;
  303. - properties.label[0] = 0;
  304. - properties.shortLabel[0] = 0;
  305. - properties.arrangementType = Vst2::kSpeakerArrEmpty;
  306. + properties.text[0] = 0;
  307. + properties.shortText[0] = 0;
  308. + properties.configurationType = Vst2::vstSpeakerConfigTypeEmpty;
  309. if ((channelIdx = processor->getOffsetInBusBufferForAbsoluteChannelIndex (direction, index, busIdx)) >= 0)
  310. {
  311. @@ -825,8 +817,8 @@ public:
  312. auto& channelSet = bus.getCurrentLayout();
  313. auto channelType = channelSet.getTypeOfChannel (channelIdx);
  314. - properties.flags = Vst2::kVstPinIsActive | Vst2::kVstPinUseSpeaker;
  315. - properties.arrangementType = SpeakerMappings::channelSetToVstArrangementType (channelSet);
  316. + properties.flags = Vst2::vstPinInfoFlagIsActive | Vst2::vstPinInfoFlagValid;
  317. + properties.configurationType = SpeakerMappings::channelSetToVstArrangementType (channelSet);
  318. String label = bus.getName();
  319. #ifdef JucePlugin_PreferredChannelConfigurations
  320. @@ -836,8 +828,8 @@ public:
  321. label += " " + AudioChannelSet::getAbbreviatedChannelTypeName (channelType);
  322. #endif
  323. - label.copyToUTF8 (properties.label, (size_t) (Vst2::kVstMaxLabelLen + 1));
  324. - label.copyToUTF8 (properties.shortLabel, (size_t) (Vst2::kVstMaxShortLabelLen + 1));
  325. + label.copyToUTF8 (properties.text, (size_t) (Vst2::vstMaxParameterOrPinLabelLength + 1));
  326. + label.copyToUTF8 (properties.shortText, (size_t) (Vst2::vstMaxParameterOrPinShortLabelLength + 1));
  327. if (channelType == AudioChannelSet::left
  328. || channelType == AudioChannelSet::leftSurround
  329. @@ -847,7 +839,7 @@ public:
  330. || channelType == AudioChannelSet::topRearLeft
  331. || channelType == AudioChannelSet::leftSurroundRear
  332. || channelType == AudioChannelSet::wideLeft)
  333. - properties.flags |= Vst2::kVstPinIsStereo;
  334. + properties.flags |= Vst2::vstPinInfoFlagIsStereo;
  335. return true;
  336. }
  337. @@ -882,15 +874,15 @@ public:
  338. void setHasEditorFlag (bool shouldSetHasEditor)
  339. {
  340. - auto hasEditor = (vstEffect.flags & Vst2::effFlagsHasEditor) != 0;
  341. + auto hasEditor = (vstEffect.flags & Vst2::vstEffectFlagHasEditor) != 0;
  342. if (shouldSetHasEditor == hasEditor)
  343. return;
  344. if (shouldSetHasEditor)
  345. - vstEffect.flags |= Vst2::effFlagsHasEditor;
  346. + vstEffect.flags |= Vst2::vstEffectFlagHasEditor;
  347. else
  348. - vstEffect.flags &= ~Vst2::effFlagsHasEditor;
  349. + vstEffect.flags &= ~Vst2::vstEffectFlagHasEditor;
  350. }
  351. void createEditorComp()
  352. @@ -957,59 +949,59 @@ public:
  353. switch (opCode)
  354. {
  355. - case Vst2::effOpen: return handleOpen (args);
  356. - case Vst2::effClose: return handleClose (args);
  357. - case Vst2::effSetProgram: return handleSetCurrentProgram (args);
  358. - case Vst2::effGetProgram: return handleGetCurrentProgram (args);
  359. - case Vst2::effSetProgramName: return handleSetCurrentProgramName (args);
  360. - case Vst2::effGetProgramName: return handleGetCurrentProgramName (args);
  361. - case Vst2::effGetParamLabel: return handleGetParameterLabel (args);
  362. - case Vst2::effGetParamDisplay: return handleGetParameterText (args);
  363. - case Vst2::effGetParamName: return handleGetParameterName (args);
  364. - case Vst2::effSetSampleRate: return handleSetSampleRate (args);
  365. - case Vst2::effSetBlockSize: return handleSetBlockSize (args);
  366. - case Vst2::effMainsChanged: return handleResumeSuspend (args);
  367. - case Vst2::effEditGetRect: return handleGetEditorBounds (args);
  368. - case Vst2::effEditOpen: return handleOpenEditor (args);
  369. - case Vst2::effEditClose: return handleCloseEditor (args);
  370. - case Vst2::effIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf");
  371. - case Vst2::effGetChunk: return handleGetData (args);
  372. - case Vst2::effSetChunk: return handleSetData (args);
  373. - case Vst2::effProcessEvents: return handlePreAudioProcessingEvents (args);
  374. - case Vst2::effCanBeAutomated: return handleIsParameterAutomatable (args);
  375. - case Vst2::effString2Parameter: return handleParameterValueForText (args);
  376. - case Vst2::effGetProgramNameIndexed: return handleGetProgramName (args);
  377. - case Vst2::effGetInputProperties: return handleGetInputPinProperties (args);
  378. - case Vst2::effGetOutputProperties: return handleGetOutputPinProperties (args);
  379. - case Vst2::effGetPlugCategory: return handleGetPlugInCategory (args);
  380. - case Vst2::effSetSpeakerArrangement: return handleSetSpeakerConfiguration (args);
  381. - case Vst2::effSetBypass: return handleSetBypass (args);
  382. - case Vst2::effGetEffectName: return handleGetPlugInName (args);
  383. - case Vst2::effGetProductString: return handleGetPlugInName (args);
  384. - case Vst2::effGetVendorString: return handleGetManufacturerName (args);
  385. - case Vst2::effGetVendorVersion: return handleGetManufacturerVersion (args);
  386. - case Vst2::effVendorSpecific: return handleManufacturerSpecific (args);
  387. - case Vst2::effCanDo: return handleCanPlugInDo (args);
  388. - case Vst2::effGetTailSize: return handleGetTailSize (args);
  389. - case Vst2::effKeysRequired: return handleKeyboardFocusRequired (args);
  390. - case Vst2::effGetVstVersion: return handleGetVstInterfaceVersion (args);
  391. - case Vst2::effGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args);
  392. - case Vst2::effGetSpeakerArrangement: return handleGetSpeakerConfiguration (args);
  393. - case Vst2::effSetTotalSampleToProcess: return handleSetNumberOfSamplesToProcess (args);
  394. - case Vst2::effSetProcessPrecision: return handleSetSampleFloatType (args);
  395. - case Vst2::effGetNumMidiInputChannels: return handleGetNumMidiInputChannels();
  396. - case Vst2::effGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels();
  397. - default: return 0;
  398. - }
  399. - }
  400. -
  401. - static pointer_sized_int dispatcherCB (Vst2::AEffect* vstInterface, int32 opCode, int32 index,
  402. + case Vst2::plugInOpcodeOpen: return handleOpen (args);
  403. + case Vst2::plugInOpcodeClose: return handleClose (args);
  404. + case Vst2::plugInOpcodeSetCurrentProgram: return handleSetCurrentProgram (args);
  405. + case Vst2::plugInOpcodeGetCurrentProgram: return handleGetCurrentProgram (args);
  406. + case Vst2::plugInOpcodeSetCurrentProgramName: return handleSetCurrentProgramName (args);
  407. + case Vst2::plugInOpcodeGetCurrentProgramName: return handleGetCurrentProgramName (args);
  408. + case Vst2::plugInOpcodeGetParameterLabel: return handleGetParameterLabel (args);
  409. + case Vst2::plugInOpcodeGetParameterText: return handleGetParameterText (args);
  410. + case Vst2::plugInOpcodeGetParameterName: return handleGetParameterName (args);
  411. + case Vst2::plugInOpcodeSetSampleRate: return handleSetSampleRate (args);
  412. + case Vst2::plugInOpcodeSetBlockSize: return handleSetBlockSize (args);
  413. + case Vst2::plugInOpcodeResumeSuspend: return handleResumeSuspend (args);
  414. + case Vst2::plugInOpcodeGetEditorBounds: return handleGetEditorBounds (args);
  415. + case Vst2::plugInOpcodeOpenEditor: return handleOpenEditor (args);
  416. + case Vst2::plugInOpcodeCloseEditor: return handleCloseEditor (args);
  417. + case Vst2::plugInOpcodeIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf");
  418. + case Vst2::plugInOpcodeGetData: return handleGetData (args);
  419. + case Vst2::plugInOpcodeSetData: return handleSetData (args);
  420. + case Vst2::plugInOpcodePreAudioProcessingEvents: return handlePreAudioProcessingEvents (args);
  421. + case Vst2::plugInOpcodeIsParameterAutomatable: return handleIsParameterAutomatable (args);
  422. + case Vst2::plugInOpcodeParameterValueForText: return handleParameterValueForText (args);
  423. + case Vst2::plugInOpcodeGetProgramName: return handleGetProgramName (args);
  424. + case Vst2::plugInOpcodeGetInputPinProperties: return handleGetInputPinProperties (args);
  425. + case Vst2::plugInOpcodeGetOutputPinProperties: return handleGetOutputPinProperties (args);
  426. + case Vst2::plugInOpcodeGetPlugInCategory: return handleGetPlugInCategory (args);
  427. + case Vst2::plugInOpcodeSetSpeakerConfiguration: return handleSetSpeakerConfiguration (args);
  428. + case Vst2::plugInOpcodeSetBypass: return handleSetBypass (args);
  429. + case Vst2::plugInOpcodeGetPlugInName: return handleGetPlugInName (args);
  430. + case Vst2::plugInOpcodeGetManufacturerProductName: return handleGetPlugInName (args);
  431. + case Vst2::plugInOpcodeGetManufacturerName: return handleGetManufacturerName (args);
  432. + case Vst2::plugInOpcodeGetManufacturerVersion: return handleGetManufacturerVersion (args);
  433. + case Vst2::plugInOpcodeManufacturerSpecific: return handleManufacturerSpecific (args);
  434. + case Vst2::plugInOpcodeCanPlugInDo: return handleCanPlugInDo (args);
  435. + case Vst2::plugInOpcodeGetTailSize: return handleGetTailSize (args);
  436. + case Vst2::plugInOpcodeKeyboardFocusRequired: return handleKeyboardFocusRequired (args);
  437. + case Vst2::plugInOpcodeGetVstInterfaceVersion: return handleGetVstInterfaceVersion (args);
  438. + case Vst2::plugInOpcodeGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args);
  439. + case Vst2::plugInOpcodeGetSpeakerArrangement: return handleGetSpeakerConfiguration (args);
  440. + case Vst2::plugInOpcodeSetNumberOfSamplesToProcess: return handleSetNumberOfSamplesToProcess (args);
  441. + case Vst2::plugInOpcodeSetSampleFloatType: return handleSetSampleFloatType (args);
  442. + case Vst2::pluginOpcodeGetNumMidiInputChannels: return handleGetNumMidiInputChannels();
  443. + case Vst2::pluginOpcodeGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels();
  444. + default: return 0;
  445. + }
  446. + }
  447. +
  448. + static pointer_sized_int dispatcherCB (Vst2::VstEffectInterface* vstInterface, int32 opCode, int32 index,
  449. pointer_sized_int value, void* ptr, float opt)
  450. {
  451. auto* wrapper = getWrapper (vstInterface);
  452. VstOpCodeArguments args = { index, value, ptr, opt };
  453. - if (opCode == Vst2::effClose)
  454. + if (opCode == Vst2::plugInOpcodeClose)
  455. {
  456. wrapper->dispatcher (opCode, args);
  457. delete wrapper;
  458. @@ -1056,7 +1048,7 @@ public:
  459. g.fillAll (Colours::black);
  460. }
  461. - void getEditorBounds (Vst2::ERect& bounds)
  462. + void getEditorBounds (Vst2::VstEditorBounds& bounds)
  463. {
  464. auto editorBounds = getSizeToContainChild();
  465. bounds = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() });
  466. @@ -1183,8 +1175,8 @@ public:
  467. auto rect = convertToHostBounds ({ 0, 0, (int16) editorBounds.getHeight(), (int16) editorBounds.getWidth() });
  468. X11Symbols::getInstance()->xResizeWindow (display, (Window) getWindowHandle(),
  469. - static_cast<unsigned int> (rect.right - rect.left),
  470. - static_cast<unsigned int> (rect.bottom - rect.top));
  471. + static_cast<unsigned int> (rect.rightmost - rect.leftmost),
  472. + static_cast<unsigned int> (rect.lower - rect.upper));
  473. #else
  474. setSize (editorBounds.getWidth(), editorBounds.getHeight());
  475. #endif
  476. @@ -1199,20 +1191,20 @@ public:
  477. void resizeHostWindow (int newWidth, int newHeight)
  478. {
  479. auto rect = convertToHostBounds ({ 0, 0, (int16) newHeight, (int16) newWidth });
  480. - newWidth = rect.right - rect.left;
  481. - newHeight = rect.bottom - rect.top;
  482. + newWidth = rect.rightmost - rect.leftmost;
  483. + newHeight = rect.lower - rect.upper;
  484. bool sizeWasSuccessful = false;
  485. if (auto host = wrapper.hostCallback)
  486. {
  487. - auto status = host (wrapper.getAEffect(), Vst2::audioMasterCanDo, 0, 0, const_cast<char*> ("sizeWindow"), 0);
  488. + auto status = host (wrapper.getAEffect(), Vst2::hostOpcodeCanHostDo, 0, 0, const_cast<char*> ("sizeWindow"), 0);
  489. if (status == (pointer_sized_int) 1 || getHostType().isAbletonLive())
  490. {
  491. const ScopedValueSetter<bool> resizingParentSetter (resizingParent, true);
  492. - sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow,
  493. + sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::hostOpcodeWindowSize,
  494. newWidth, newHeight, nullptr, 0) != 0);
  495. }
  496. }
  497. @@ -1339,17 +1331,17 @@ public:
  498. private:
  499. //==============================================================================
  500. - static Vst2::ERect convertToHostBounds (const Vst2::ERect& rect)
  501. + static Vst2::VstEditorBounds convertToHostBounds (const Vst2::VstEditorBounds& rect)
  502. {
  503. auto desktopScale = Desktop::getInstance().getGlobalScaleFactor();
  504. if (approximatelyEqual (desktopScale, 1.0f))
  505. return rect;
  506. - return { (int16) roundToInt (rect.top * desktopScale),
  507. - (int16) roundToInt (rect.left * desktopScale),
  508. - (int16) roundToInt (rect.bottom * desktopScale),
  509. - (int16) roundToInt (rect.right * desktopScale) };
  510. + return { (int16) roundToInt (rect.upper * desktopScale),
  511. + (int16) roundToInt (rect.leftmost * desktopScale),
  512. + (int16) roundToInt (rect.lower * desktopScale),
  513. + (int16) roundToInt (rect.rightmost * desktopScale)};
  514. }
  515. //==============================================================================
  516. @@ -1385,7 +1377,7 @@ private:
  517. void update (const ChangeDetails& details)
  518. {
  519. if (details.latencyChanged)
  520. - owner.vstEffect.initialDelay = owner.processor->getLatencySamples();
  521. + owner.vstEffect.latency = owner.processor->getLatencySamples();
  522. if (details.parameterInfoChanged || details.programChanged)
  523. triggerAsyncUpdate();
  524. @@ -1396,20 +1388,20 @@ private:
  525. {
  526. if (auto* callback = owner.hostCallback)
  527. {
  528. - callback (&owner.vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, nullptr, 0);
  529. - callback (&owner.vstEffect, Vst2::audioMasterIOChanged, 0, 0, nullptr, 0);
  530. + callback (&owner.vstEffect, Vst2::hostOpcodeUpdateView, 0, 0, nullptr, 0);
  531. + callback (&owner.vstEffect, Vst2::hostOpcodeIOModified, 0, 0, nullptr, 0);
  532. }
  533. }
  534. JuceVSTWrapper& owner;
  535. };
  536. - static JuceVSTWrapper* getWrapper (Vst2::AEffect* v) noexcept { return static_cast<JuceVSTWrapper*> (v->object); }
  537. + static JuceVSTWrapper* getWrapper (Vst2::VstEffectInterface* v) noexcept { return static_cast<JuceVSTWrapper*> (v->effectPointer); }
  538. bool isProcessLevelOffline()
  539. {
  540. return hostCallback != nullptr
  541. - && (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, nullptr, 0) == 4;
  542. + && (int32) hostCallback (&vstEffect, Vst2::hostOpcodeGetCurrentAudioProcessingLevel, 0, 0, nullptr, 0) == 4;
  543. }
  544. static int32 convertHexVersionToDecimal (const unsigned int hexVersion)
  545. @@ -1477,8 +1469,8 @@ private:
  546. tmpBuffers.release();
  547. if (processor != nullptr)
  548. - tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputs
  549. - + vstEffect.numOutputs);
  550. + tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputChannels
  551. + + vstEffect.numOutputChannels);
  552. }
  553. void deleteTempChannels()
  554. @@ -1638,7 +1630,7 @@ private:
  555. if (editorComp != nullptr)
  556. {
  557. editorComp->getEditorBounds (editorRect);
  558. - *((Vst2::ERect**) args.ptr) = &editorRect;
  559. + *((Vst2::VstEditorBounds**) args.ptr) = &editorRect;
  560. return (pointer_sized_int) &editorRect;
  561. }
  562. @@ -1728,7 +1720,7 @@ private:
  563. pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args)
  564. {
  565. #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect
  566. - VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents);
  567. + VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEventBlock*) args.ptr, midiEvents);
  568. return 1;
  569. #else
  570. ignoreUnused (args);
  571. @@ -1779,12 +1771,12 @@ private:
  572. pointer_sized_int handleGetInputPinProperties (VstOpCodeArguments args)
  573. {
  574. - return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, true, args.index)) ? 1 : 0;
  575. + return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, true, args.index)) ? 1 : 0;
  576. }
  577. pointer_sized_int handleGetOutputPinProperties (VstOpCodeArguments args)
  578. {
  579. - return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, false, args.index)) ? 1 : 0;
  580. + return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, false, args.index)) ? 1 : 0;
  581. }
  582. pointer_sized_int handleGetPlugInCategory (VstOpCodeArguments)
  583. @@ -1794,8 +1786,8 @@ private:
  584. pointer_sized_int handleSetSpeakerConfiguration (VstOpCodeArguments args)
  585. {
  586. - auto* pluginInput = reinterpret_cast<Vst2::VstSpeakerArrangement*> (args.value);
  587. - auto* pluginOutput = reinterpret_cast<Vst2::VstSpeakerArrangement*> (args.ptr);
  588. + auto* pluginInput = reinterpret_cast<Vst2::VstSpeakerConfiguration*> (args.value);
  589. + auto* pluginOutput = reinterpret_cast<Vst2::VstSpeakerConfiguration*> (args.ptr);
  590. if (processor->isMidiEffect())
  591. return 0;
  592. @@ -1806,29 +1798,29 @@ private:
  593. if (pluginInput != nullptr && pluginInput->type >= 0)
  594. {
  595. // inconsistent request?
  596. - if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numChannels)
  597. + if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numberOfChannels)
  598. return 0;
  599. }
  600. if (pluginOutput != nullptr && pluginOutput->type >= 0)
  601. {
  602. // inconsistent request?
  603. - if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numChannels)
  604. + if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numberOfChannels)
  605. return 0;
  606. }
  607. - if (pluginInput != nullptr && pluginInput->numChannels > 0 && numIns == 0)
  608. + if (pluginInput != nullptr && pluginInput->numberOfChannels > 0 && numIns == 0)
  609. return 0;
  610. - if (pluginOutput != nullptr && pluginOutput->numChannels > 0 && numOuts == 0)
  611. + if (pluginOutput != nullptr && pluginOutput->numberOfChannels > 0 && numOuts == 0)
  612. return 0;
  613. auto layouts = processor->getBusesLayout();
  614. - if (pluginInput != nullptr && pluginInput-> numChannels >= 0 && numIns > 0)
  615. + if (pluginInput != nullptr && pluginInput-> numberOfChannels >= 0 && numIns > 0)
  616. layouts.getChannelSet (true, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput);
  617. - if (pluginOutput != nullptr && pluginOutput->numChannels >= 0 && numOuts > 0)
  618. + if (pluginOutput != nullptr && pluginOutput->numberOfChannels >= 0 && numOuts > 0)
  619. layouts.getChannelSet (false, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput);
  620. #ifdef JucePlugin_PreferredChannelConfigurations
  621. @@ -1876,7 +1868,7 @@ private:
  622. && args.value == (int32) ByteOrder::bigEndianInt ("AeCs"))
  623. return handleSetContentScaleFactor (args.opt);
  624. - if (args.index == Vst2::effGetParamDisplay)
  625. + if (args.index == Vst2::plugInOpcodeGetParameterText)
  626. return handleCockosGetParameterText (args.value, args.ptr, args.opt);
  627. if (auto callbackHandler = dynamic_cast<VSTCallbackHandler*> (processor))
  628. @@ -1971,7 +1963,7 @@ private:
  629. pointer_sized_int handleGetVstInterfaceVersion (VstOpCodeArguments)
  630. {
  631. - return kVstVersion;
  632. + return Vst2::juceVstInterfaceVersion;
  633. }
  634. pointer_sized_int handleGetCurrentMidiProgram (VstOpCodeArguments)
  635. @@ -1981,8 +1973,8 @@ private:
  636. pointer_sized_int handleGetSpeakerConfiguration (VstOpCodeArguments args)
  637. {
  638. - auto** pluginInput = reinterpret_cast<Vst2::VstSpeakerArrangement**> (args.value);
  639. - auto** pluginOutput = reinterpret_cast<Vst2::VstSpeakerArrangement**> (args.ptr);
  640. + auto** pluginInput = reinterpret_cast<Vst2::VstSpeakerConfiguration**> (args.value);
  641. + auto** pluginOutput = reinterpret_cast<Vst2::VstSpeakerConfiguration**> (args.ptr);
  642. if (pluginHasSidechainsOrAuxs() || processor->isMidiEffect())
  643. return false;
  644. @@ -1990,10 +1982,10 @@ private:
  645. auto inputLayout = processor->getChannelLayoutOfBus (true, 0);
  646. auto outputLayout = processor->getChannelLayoutOfBus (false, 0);
  647. - auto speakerBaseSize = sizeof (Vst2::VstSpeakerArrangement) - (sizeof (Vst2::VstSpeakerProperties) * 8);
  648. + auto speakerBaseSize = sizeof (Vst2::VstSpeakerConfiguration) - (sizeof (Vst2::VstIndividualSpeakerInfo) * 8);
  649. - cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (Vst2::VstSpeakerArrangement)), 1);
  650. - cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (Vst2::VstSpeakerArrangement)), 1);
  651. + cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1);
  652. + cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1);
  653. *pluginInput = cachedInArrangement. getData();
  654. *pluginOutput = cachedOutArrangement.getData();
  655. @@ -2015,7 +2007,7 @@ private:
  656. {
  657. if (processor != nullptr)
  658. {
  659. - processor->setProcessingPrecision ((args.value == Vst2::kVstProcessPrecision64
  660. + processor->setProcessingPrecision ((args.value == Vst2::vstProcessingSampleTypeDouble
  661. && processor->supportsDoublePrecisionProcessing())
  662. ? AudioProcessor::doublePrecision
  663. : AudioProcessor::singlePrecision);
  664. @@ -2089,16 +2081,16 @@ private:
  665. }
  666. //==============================================================================
  667. - Vst2::audioMasterCallback hostCallback;
  668. + Vst2::VstHostCallback hostCallback;
  669. AudioProcessor* processor = {};
  670. double sampleRate = 44100.0;
  671. int32 blockSize = 1024;
  672. - Vst2::AEffect vstEffect;
  673. + Vst2::VstEffectInterface vstEffect;
  674. CriticalSection stateInformationLock;
  675. juce::MemoryBlock chunkMemory;
  676. uint32 chunkMemoryTime = 0;
  677. std::unique_ptr<EditorCompWrapper> editorComp;
  678. - Vst2::ERect editorRect;
  679. + Vst2::VstEditorBounds editorRect;
  680. MidiBuffer midiEvents;
  681. VSTMidiEventList outgoingEvents;
  682. @@ -2123,7 +2115,7 @@ private:
  683. VstTempBuffers<double> doubleTempBuffers;
  684. int maxNumInChannels = 0, maxNumOutChannels = 0;
  685. - HeapBlock<Vst2::VstSpeakerArrangement> cachedInArrangement, cachedOutArrangement;
  686. + HeapBlock<Vst2::VstSpeakerConfiguration> cachedInArrangement, cachedOutArrangement;
  687. ThreadLocalValue<bool> inParameterChangedCallback;
  688. @@ -2137,7 +2129,7 @@ private:
  689. //==============================================================================
  690. namespace
  691. {
  692. - Vst2::AEffect* pluginEntryPoint (Vst2::audioMasterCallback audioMaster)
  693. + Vst2::VstEffectInterface* pluginEntryPoint (Vst2::VstHostCallback audioMaster)
  694. {
  695. JUCE_AUTORELEASEPOOL
  696. {
  697. @@ -2145,7 +2137,7 @@ namespace
  698. try
  699. {
  700. - if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0)
  701. + if (audioMaster (nullptr, Vst2::hostOpcodeVstVersion, 0, 0, nullptr, 0) != 0)
  702. {
  703. #if JUCE_LINUX
  704. MessageManagerLock mmLock;
  705. @@ -2182,8 +2174,8 @@ namespace
  706. // Mac startup code..
  707. #if JUCE_MAC
  708. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
  709. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
  710. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster);
  711. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster)
  712. {
  713. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  714. @@ -2191,8 +2183,8 @@ namespace
  715. return pluginEntryPoint (audioMaster);
  716. }
  717. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster);
  718. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster)
  719. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster);
  720. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster)
  721. {
  722. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  723. @@ -2204,8 +2196,8 @@ namespace
  724. // Linux startup code..
  725. #elif JUCE_LINUX
  726. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
  727. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
  728. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster);
  729. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster)
  730. {
  731. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  732. @@ -2213,8 +2205,8 @@ namespace
  733. return pluginEntryPoint (audioMaster);
  734. }
  735. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) asm ("main");
  736. - JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster)
  737. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) asm ("main");
  738. + JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster)
  739. {
  740. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  741. @@ -2229,7 +2221,7 @@ namespace
  742. // Win32 startup code..
  743. #else
  744. - extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
  745. + extern "C" __declspec (dllexport) Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster)
  746. {
  747. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  748. @@ -2237,7 +2229,7 @@ namespace
  749. }
  750. #if ! defined (JUCE_64BIT) && JUCE_MSVC // (can't compile this on win64, but it's not needed anyway with VST2.4)
  751. - extern "C" __declspec (dllexport) int main (Vst2::audioMasterCallback audioMaster)
  752. + extern "C" __declspec (dllexport) int main (Vst2::VstHostCallback audioMaster)
  753. {
  754. PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST;
  755. diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  756. index f0013bf3e..7909098c9 100644
  757. --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  758. +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  759. @@ -61,10 +61,7 @@
  760. #define __cdecl
  761. #endif
  762. - namespace Vst2
  763. - {
  764. - #include "pluginterfaces/vst2.x/vstfxstore.h"
  765. - }
  766. + #include <juce_audio_processors/format_types/juce_VSTInterface.h>
  767. #endif
  768. @@ -2047,16 +2044,16 @@ public:
  769. bool loadVST2CcnKBlock (const char* data, int size)
  770. {
  771. - auto* bank = reinterpret_cast<const Vst2::fxBank*> (data);
  772. + auto* bank = reinterpret_cast<const vst2FxBank*> (data);
  773. - jassert (ByteOrder::bigEndianInt ("CcnK") == htonl ((uint32) bank->chunkMagic));
  774. - jassert (ByteOrder::bigEndianInt ("FBCh") == htonl ((uint32) bank->fxMagic));
  775. - jassert (htonl ((uint32) bank->version) == 1 || htonl ((uint32) bank->version) == 2);
  776. + jassert (ByteOrder::bigEndianInt ("CcnK") == htonl ((uint32) bank->magic1));
  777. + jassert (ByteOrder::bigEndianInt ("FBCh") == htonl ((uint32) bank->magic2));
  778. + jassert (htonl ((uint32) bank->version1) == 1 || htonl ((uint32) bank->version1) == 2);
  779. jassert (JucePlugin_VSTUniqueID == htonl ((uint32) bank->fxID));
  780. - setStateInformation (bank->content.data.chunk,
  781. - jmin ((int) (size - (bank->content.data.chunk - data)),
  782. - (int) htonl ((uint32) bank->content.data.size)));
  783. + setStateInformation (bank->chunk,
  784. + jmin ((int) (size - (bank->chunk - data)),
  785. + (int) htonl ((uint32) bank->chunkSize)));
  786. return true;
  787. }
  788. @@ -2252,16 +2249,16 @@ public:
  789. return status;
  790. const int bankBlockSize = 160;
  791. - Vst2::fxBank bank;
  792. + vst2FxBank bank;
  793. zerostruct (bank);
  794. - bank.chunkMagic = (int32) htonl (ByteOrder::bigEndianInt ("CcnK"));
  795. - bank.byteSize = (int32) htonl (bankBlockSize - 8 + (unsigned int) mem.getSize());
  796. - bank.fxMagic = (int32) htonl (ByteOrder::bigEndianInt ("FBCh"));
  797. - bank.version = (int32) htonl (2);
  798. - bank.fxID = (int32) htonl (JucePlugin_VSTUniqueID);
  799. - bank.fxVersion = (int32) htonl (JucePlugin_VersionCode);
  800. - bank.content.data.size = (int32) htonl ((unsigned int) mem.getSize());
  801. + bank.magic1 = (int32) htonl (ByteOrder::bigEndianInt ("CcnK"));
  802. + bank.size = (int32) htonl (bankBlockSize - 8 + (unsigned int) mem.getSize());
  803. + bank.magic2 = (int32) htonl (ByteOrder::bigEndianInt ("FBCh"));
  804. + bank.version1 = (int32) htonl (2);
  805. + bank.fxID = (int32) htonl (JucePlugin_VSTUniqueID);
  806. + bank.version2 = (int32) htonl (JucePlugin_VersionCode);
  807. + bank.chunkSize = (int32) htonl ((unsigned int) mem.getSize());
  808. status = state->write (&bank, bankBlockSize);
  809. diff --git a/modules/juce_audio_processors/format_types/juce_VSTCommon.h b/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  810. index e3bd4edc4..b948abe2b 100644
  811. --- a/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  812. +++ b/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  813. @@ -58,25 +58,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  814. static AudioChannelSet vstArrangementTypeToChannelSet (int32 arr, int fallbackNumChannels)
  815. {
  816. - if (arr == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled();
  817. - else if (arr == Vst2::kSpeakerArrMono) return AudioChannelSet::mono();
  818. - else if (arr == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo();
  819. - else if (arr == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR();
  820. - else if (arr == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS();
  821. - else if (arr == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS();
  822. - else if (arr == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0();
  823. - else if (arr == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1();
  824. - else if (arr == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0();
  825. - else if (arr == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1();
  826. - else if (arr == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music();
  827. - else if (arr == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music();
  828. - else if (arr == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0();
  829. - else if (arr == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS();
  830. - else if (arr == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1();
  831. - else if (arr == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS();
  832. - else if (arr == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic();
  833. -
  834. - for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m)
  835. + if (arr == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled();
  836. + else if (arr == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono();
  837. + else if (arr == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo();
  838. + else if (arr == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR();
  839. + else if (arr == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS();
  840. + else if (arr == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS();
  841. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0();
  842. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1();
  843. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0();
  844. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1();
  845. + else if (arr == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music();
  846. + else if (arr == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music();
  847. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0();
  848. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS();
  849. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1();
  850. + else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS();
  851. + else if (arr == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic();
  852. +
  853. + for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m)
  854. {
  855. if (m->vst2 == arr)
  856. {
  857. @@ -92,53 +92,53 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  858. return AudioChannelSet::discreteChannels (fallbackNumChannels);
  859. }
  860. - static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr)
  861. + static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr)
  862. {
  863. - return vstArrangementTypeToChannelSet (arr.type, arr.numChannels);
  864. + return vstArrangementTypeToChannelSet (arr.type, arr.numberOfChannels);
  865. }
  866. static int32 channelSetToVstArrangementType (AudioChannelSet channels)
  867. {
  868. - if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty;
  869. - else if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono;
  870. - else if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo;
  871. - else if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine;
  872. - else if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music;
  873. - else if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine;
  874. - else if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50;
  875. - else if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51;
  876. - else if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine;
  877. - else if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine;
  878. - else if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music;
  879. - else if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music;
  880. - else if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music;
  881. - else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine;
  882. - else if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music;
  883. - else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine;
  884. - else if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music;
  885. + if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty;
  886. + else if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono;
  887. + else if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR;
  888. + else if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC;
  889. + else if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS;
  890. + else if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS;
  891. + else if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs;
  892. + else if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs;
  893. + else if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs;
  894. + else if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs;
  895. + else if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr;
  896. + else if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr;
  897. + else if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr;
  898. + else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc;
  899. + else if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr;
  900. + else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc;
  901. + else if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs;
  902. if (channels == AudioChannelSet::disabled())
  903. - return Vst2::kSpeakerArrEmpty;
  904. + return Vst2::vstSpeakerConfigTypeEmpty;
  905. auto chans = channels.getChannelTypes();
  906. - for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m)
  907. + for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m)
  908. if (m->matches (chans))
  909. return m->vst2;
  910. - return Vst2::kSpeakerArrUserDefined;
  911. + return Vst2::vstSpeakerConfigTypeUser;
  912. }
  913. - static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerArrangement& result)
  914. + static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerConfiguration& result)
  915. {
  916. result.type = channelSetToVstArrangementType (channels);
  917. - result.numChannels = channels.size();
  918. + result.numberOfChannels = channels.size();
  919. - for (int i = 0; i < result.numChannels; ++i)
  920. + for (int i = 0; i < result.numberOfChannels; ++i)
  921. {
  922. auto& speaker = result.speakers[i];
  923. - zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties));
  924. + zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo));
  925. speaker.type = getSpeakerType (channels.getTypeOfChannel (i));
  926. }
  927. }
  928. @@ -152,7 +152,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  929. clear();
  930. }
  931. - VstSpeakerConfigurationHolder (const Vst2::VstSpeakerArrangement& vstConfig)
  932. + VstSpeakerConfigurationHolder (const Vst2::VstSpeakerConfiguration& vstConfig)
  933. {
  934. operator= (vstConfig);
  935. }
  936. @@ -171,29 +171,29 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  937. VstSpeakerConfigurationHolder (const AudioChannelSet& channels)
  938. {
  939. auto numberOfChannels = channels.size();
  940. - Vst2::VstSpeakerArrangement& dst = *allocate (numberOfChannels);
  941. + Vst2::VstSpeakerConfiguration& dst = *allocate (numberOfChannels);
  942. dst.type = channelSetToVstArrangementType (channels);
  943. - dst.numChannels = numberOfChannels;
  944. + dst.numberOfChannels = numberOfChannels;
  945. - for (int i = 0; i < dst.numChannels; ++i)
  946. + for (int i = 0; i < dst.numberOfChannels; ++i)
  947. {
  948. - Vst2::VstSpeakerProperties& speaker = dst.speakers[i];
  949. + Vst2::VstIndividualSpeakerInfo& speaker = dst.speakers[i];
  950. - zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties));
  951. + zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo));
  952. speaker.type = getSpeakerType (channels.getTypeOfChannel (i));
  953. }
  954. }
  955. VstSpeakerConfigurationHolder& operator= (const VstSpeakerConfigurationHolder& vstConfig) { return operator=(vstConfig.get()); }
  956. - VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerArrangement& vstConfig)
  957. + VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerConfiguration& vstConfig)
  958. {
  959. - Vst2::VstSpeakerArrangement& dst = *allocate (vstConfig.numChannels);
  960. + Vst2::VstSpeakerConfiguration& dst = *allocate (vstConfig.numberOfChannels);
  961. dst.type = vstConfig.type;
  962. - dst.numChannels = vstConfig.numChannels;
  963. + dst.numberOfChannels = vstConfig.numberOfChannels;
  964. - for (int i = 0; i < dst.numChannels; ++i)
  965. + for (int i = 0; i < dst.numberOfChannels; ++i)
  966. dst.speakers[i] = vstConfig.speakers[i];
  967. return *this;
  968. @@ -207,17 +207,17 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  969. return *this;
  970. }
  971. - const Vst2::VstSpeakerArrangement& get() const { return *storage.get(); }
  972. + const Vst2::VstSpeakerConfiguration& get() const { return *storage.get(); }
  973. private:
  974. JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder)
  975. - HeapBlock<Vst2::VstSpeakerArrangement> storage;
  976. + HeapBlock<Vst2::VstSpeakerConfiguration> storage;
  977. - Vst2::VstSpeakerArrangement* allocate (int numChannels)
  978. + Vst2::VstSpeakerConfiguration* allocate (int numChannels)
  979. {
  980. - auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties)
  981. - + sizeof (Vst2::VstSpeakerArrangement);
  982. + auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstIndividualSpeakerInfo)
  983. + + sizeof (Vst2::VstSpeakerConfiguration);
  984. storage.malloc (1, arrangementSize);
  985. return storage.get();
  986. @@ -225,10 +225,10 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  987. void clear()
  988. {
  989. - Vst2::VstSpeakerArrangement& dst = *allocate (0);
  990. + Vst2::VstSpeakerConfiguration& dst = *allocate (0);
  991. - dst.type = Vst2::kSpeakerArrEmpty;
  992. - dst.numChannels = 0;
  993. + dst.type = Vst2::vstSpeakerConfigTypeEmpty;
  994. + dst.numberOfChannels = 0;
  995. }
  996. };
  997. @@ -236,36 +236,36 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  998. {
  999. static const Mapping mappings[] =
  1000. {
  1001. - { Vst2::kSpeakerArrMono, { centre, unknown } },
  1002. - { Vst2::kSpeakerArrStereo, { left, right, unknown } },
  1003. - { Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } },
  1004. - { Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } },
  1005. - { Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } },
  1006. - { Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } },
  1007. - { Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } },
  1008. - { Vst2::kSpeakerArr30Music, { left, right, surround, unknown } },
  1009. - { Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } },
  1010. - { Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } },
  1011. - { Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } },
  1012. - { Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } },
  1013. - { Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } },
  1014. - { Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } },
  1015. - { Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } },
  1016. - { Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } },
  1017. - { Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } },
  1018. - { Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1019. - { Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } },
  1020. - { Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1021. - { Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  1022. - { Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1023. - { Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  1024. - { Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1025. - { Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  1026. - { Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  1027. - { Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  1028. - { Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  1029. - { Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } },
  1030. - { Vst2::kSpeakerArrEmpty, { unknown } }
  1031. + { Vst2::vstSpeakerConfigTypeMono, { centre, unknown } },
  1032. + { Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } },
  1033. + { Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } },
  1034. + { Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } },
  1035. + { Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } },
  1036. + { Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } },
  1037. + { Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } },
  1038. + { Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } },
  1039. + { Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } },
  1040. + { Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } },
  1041. + { Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } },
  1042. + { Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } },
  1043. + { Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } },
  1044. + { Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } },
  1045. + { Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } },
  1046. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } },
  1047. + { Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } },
  1048. + { Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1049. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } },
  1050. + { Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1051. + { Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  1052. + { Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1053. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
  1054. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
  1055. + { Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  1056. + { Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  1057. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
  1058. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
  1059. + { Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } },
  1060. + { Vst2::vstSpeakerConfigTypeEmpty, { unknown } }
  1061. };
  1062. return mappings;
  1063. @@ -275,25 +275,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  1064. {
  1065. static const std::map<AudioChannelSet::ChannelType, int32> speakerTypeMap =
  1066. {
  1067. - { AudioChannelSet::left, Vst2::kSpeakerL },
  1068. - { AudioChannelSet::right, Vst2::kSpeakerR },
  1069. - { AudioChannelSet::centre, Vst2::kSpeakerC },
  1070. - { AudioChannelSet::LFE, Vst2::kSpeakerLfe },
  1071. - { AudioChannelSet::leftSurround, Vst2::kSpeakerLs },
  1072. - { AudioChannelSet::rightSurround, Vst2::kSpeakerRs },
  1073. - { AudioChannelSet::leftCentre, Vst2::kSpeakerLc },
  1074. - { AudioChannelSet::rightCentre, Vst2::kSpeakerRc },
  1075. - { AudioChannelSet::surround, Vst2::kSpeakerS },
  1076. - { AudioChannelSet::leftSurroundRear, Vst2::kSpeakerSl },
  1077. - { AudioChannelSet::rightSurroundRear, Vst2::kSpeakerSr },
  1078. - { AudioChannelSet::topMiddle, Vst2::kSpeakerTm },
  1079. - { AudioChannelSet::topFrontLeft, Vst2::kSpeakerTfl },
  1080. - { AudioChannelSet::topFrontCentre, Vst2::kSpeakerTfc },
  1081. - { AudioChannelSet::topFrontRight, Vst2::kSpeakerTfr },
  1082. - { AudioChannelSet::topRearLeft, Vst2::kSpeakerTrl },
  1083. - { AudioChannelSet::topRearCentre, Vst2::kSpeakerTrc },
  1084. - { AudioChannelSet::topRearRight, Vst2::kSpeakerTrr },
  1085. - { AudioChannelSet::LFE2, Vst2::kSpeakerLfe2 }
  1086. + { AudioChannelSet::left, Vst2::vstIndividualSpeakerTypeLeft },
  1087. + { AudioChannelSet::right, Vst2::vstIndividualSpeakerTypeRight },
  1088. + { AudioChannelSet::centre, Vst2::vstIndividualSpeakerTypeCentre },
  1089. + { AudioChannelSet::LFE, Vst2::vstIndividualSpeakerTypeLFE },
  1090. + { AudioChannelSet::leftSurround, Vst2::vstIndividualSpeakerTypeLeftSurround },
  1091. + { AudioChannelSet::rightSurround, Vst2::vstIndividualSpeakerTypeRightSurround },
  1092. + { AudioChannelSet::leftCentre, Vst2::vstIndividualSpeakerTypeLeftCentre },
  1093. + { AudioChannelSet::rightCentre, Vst2::vstIndividualSpeakerTypeRightCentre },
  1094. + { AudioChannelSet::surround, Vst2::vstIndividualSpeakerTypeSurround },
  1095. + { AudioChannelSet::leftSurroundRear, Vst2::vstIndividualSpeakerTypeLeftRearSurround },
  1096. + { AudioChannelSet::rightSurroundRear, Vst2::vstIndividualSpeakerTypeRightRearSurround },
  1097. + { AudioChannelSet::topMiddle, Vst2::vstIndividualSpeakerTypeTopMiddle },
  1098. + { AudioChannelSet::topFrontLeft, Vst2::vstIndividualSpeakerTypeTopFrontLeft },
  1099. + { AudioChannelSet::topFrontCentre, Vst2::vstIndividualSpeakerTypeTopFrontCentre },
  1100. + { AudioChannelSet::topFrontRight, Vst2::vstIndividualSpeakerTypeTopFrontRight },
  1101. + { AudioChannelSet::topRearLeft, Vst2::vstIndividualSpeakerTypeTopRearLeft },
  1102. + { AudioChannelSet::topRearCentre, Vst2::vstIndividualSpeakerTypeTopRearCentre },
  1103. + { AudioChannelSet::topRearRight, Vst2::vstIndividualSpeakerTypeTopRearRight },
  1104. + { AudioChannelSet::LFE2, Vst2::vstIndividualSpeakerTypeLFE2 }
  1105. };
  1106. if (speakerTypeMap.find (type) == speakerTypeMap.end())
  1107. @@ -306,25 +306,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
  1108. {
  1109. switch (type)
  1110. {
  1111. - case Vst2::kSpeakerL: return AudioChannelSet::left;
  1112. - case Vst2::kSpeakerR: return AudioChannelSet::right;
  1113. - case Vst2::kSpeakerC: return AudioChannelSet::centre;
  1114. - case Vst2::kSpeakerLfe: return AudioChannelSet::LFE;
  1115. - case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround;
  1116. - case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround;
  1117. - case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre;
  1118. - case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre;
  1119. - case Vst2::kSpeakerS: return AudioChannelSet::surround;
  1120. - case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear;
  1121. - case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear;
  1122. - case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle;
  1123. - case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft;
  1124. - case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre;
  1125. - case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight;
  1126. - case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft;
  1127. - case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre;
  1128. - case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight;
  1129. - case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2;
  1130. + case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left;
  1131. + case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right;
  1132. + case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre;
  1133. + case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE;
  1134. + case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround;
  1135. + case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround;
  1136. + case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre;
  1137. + case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre;
  1138. + case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround;
  1139. + case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear;
  1140. + case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear;
  1141. + case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle;
  1142. + case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft;
  1143. + case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre;
  1144. + case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight;
  1145. + case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft;
  1146. + case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre;
  1147. + case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight;
  1148. + case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2;
  1149. default: break;
  1150. }
  1151. diff --git a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  1152. index 49f0d3b3b..6e99d63d0 100644
  1153. --- a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  1154. +++ b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  1155. @@ -57,7 +57,7 @@ public:
  1156. numEventsUsed = 0;
  1157. if (events != nullptr)
  1158. - events->numEvents = 0;
  1159. + events->numberOfEvents = 0;
  1160. }
  1161. void addEvent (const void* const midiData, int numBytes, int frameOffset)
  1162. @@ -66,50 +66,50 @@ public:
  1163. void* const ptr = (Vst2::VstMidiEvent*) (events->events [numEventsUsed]);
  1164. auto* const e = (Vst2::VstMidiEvent*) ptr;
  1165. - events->numEvents = ++numEventsUsed;
  1166. + events->numberOfEvents = ++numEventsUsed;
  1167. if (numBytes <= 4)
  1168. {
  1169. - if (e->type == Vst2::kVstSysExType)
  1170. + if (e->type == Vst2::vstSysExEventType)
  1171. {
  1172. - delete[] (((Vst2::VstMidiSysexEvent*) ptr)->sysexDump);
  1173. - e->type = Vst2::kVstMidiType;
  1174. - e->byteSize = sizeof (Vst2::VstMidiEvent);
  1175. - e->noteLength = 0;
  1176. - e->noteOffset = 0;
  1177. - e->detune = 0;
  1178. - e->noteOffVelocity = 0;
  1179. + delete[] (((Vst2::VstSysExEvent*) ptr)->sysExDump);
  1180. + e->type = Vst2::vstMidiEventType;
  1181. + e->size = sizeof (Vst2::VstMidiEvent);
  1182. + e->noteSampleLength = 0;
  1183. + e->noteSampleOffset = 0;
  1184. + e->tuning = 0;
  1185. + e->noteVelocityOff = 0;
  1186. }
  1187. - e->deltaFrames = frameOffset;
  1188. + e->sampleOffset = frameOffset;
  1189. memcpy (e->midiData, midiData, (size_t) numBytes);
  1190. }
  1191. else
  1192. {
  1193. - auto* const se = (Vst2::VstMidiSysexEvent*) ptr;
  1194. + auto* const se = (Vst2::VstSysExEvent*) ptr;
  1195. - if (se->type == Vst2::kVstSysExType)
  1196. - delete[] se->sysexDump;
  1197. + if (se->type == Vst2::vstSysExEventType)
  1198. + delete[] se->sysExDump;
  1199. - se->sysexDump = new char [(size_t) numBytes];
  1200. - memcpy (se->sysexDump, midiData, (size_t) numBytes);
  1201. + se->sysExDump = new char [(size_t) numBytes];
  1202. + memcpy (se->sysExDump, midiData, (size_t) numBytes);
  1203. - se->type = Vst2::kVstSysExType;
  1204. - se->byteSize = sizeof (Vst2::VstMidiSysexEvent);
  1205. - se->deltaFrames = frameOffset;
  1206. + se->type = Vst2::vstSysExEventType;
  1207. + se->size = sizeof (Vst2::VstSysExEvent);
  1208. + se->offsetSamples = frameOffset;
  1209. se->flags = 0;
  1210. - se->dumpBytes = numBytes;
  1211. - se->resvd1 = 0;
  1212. - se->resvd2 = 0;
  1213. + se->sysExDumpSize = numBytes;
  1214. + se->future1 = 0;
  1215. + se->future2 = 0;
  1216. }
  1217. }
  1218. //==============================================================================
  1219. // Handy method to pull the events out of an event buffer supplied by the host
  1220. // or plugin.
  1221. - static void addEventsToMidiBuffer (const Vst2::VstEvents* events, MidiBuffer& dest)
  1222. + static void addEventsToMidiBuffer (const Vst2::VstEventBlock* events, MidiBuffer& dest)
  1223. {
  1224. - for (int i = 0; i < events->numEvents; ++i)
  1225. + for (int i = 0; i < events->numberOfEvents; ++i)
  1226. {
  1227. const Vst2::VstEvent* const e = events->events[i];
  1228. @@ -117,17 +117,17 @@ public:
  1229. {
  1230. const void* const ptr = events->events[i];
  1231. - if (e->type == Vst2::kVstMidiType)
  1232. + if (e->type == Vst2::vstMidiEventType)
  1233. {
  1234. dest.addEvent ((const juce::uint8*) ((const Vst2::VstMidiEvent*) ptr)->midiData,
  1235. - 4, e->deltaFrames);
  1236. + 4, e->sampleOffset);
  1237. }
  1238. - else if (e->type == Vst2::kVstSysExType)
  1239. + else if (e->type == Vst2::vstSysExEventType)
  1240. {
  1241. - const auto* se = (const Vst2::VstMidiSysexEvent*) ptr;
  1242. - dest.addEvent ((const juce::uint8*) se->sysexDump,
  1243. - (int) se->dumpBytes,
  1244. - e->deltaFrames);
  1245. + const auto* se = (const Vst2::VstSysExEvent*) ptr;
  1246. + dest.addEvent ((const juce::uint8*) se->sysExDump,
  1247. + (int) se->sysExDumpSize,
  1248. + e->sampleOffset);
  1249. }
  1250. }
  1251. }
  1252. @@ -168,25 +168,25 @@ public:
  1253. }
  1254. //==============================================================================
  1255. - HeapBlock<Vst2::VstEvents> events;
  1256. + HeapBlock<Vst2::VstEventBlock> events;
  1257. private:
  1258. int numEventsUsed, numEventsAllocated;
  1259. static Vst2::VstEvent* allocateVSTEvent()
  1260. {
  1261. - auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstMidiSysexEvent) ? sizeof (Vst2::VstMidiEvent)
  1262. - : sizeof (Vst2::VstMidiSysexEvent));
  1263. - e->type = Vst2::kVstMidiType;
  1264. - e->byteSize = sizeof (Vst2::VstMidiEvent);
  1265. + auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstSysExEvent) ? sizeof (Vst2::VstMidiEvent)
  1266. + : sizeof (Vst2::VstSysExEvent));
  1267. + e->type = Vst2::vstMidiEventType;
  1268. + e->size = sizeof (Vst2::VstMidiEvent);
  1269. return e;
  1270. }
  1271. static void freeVSTEvent (Vst2::VstEvent* e)
  1272. {
  1273. - if (e->type == Vst2::kVstSysExType)
  1274. + if (e->type == Vst2::vstSysExEventType)
  1275. {
  1276. - delete[] (reinterpret_cast<Vst2::VstMidiSysexEvent*> (e)->sysexDump);
  1277. + delete[] (reinterpret_cast<Vst2::VstSysExEvent*> (e)->sysExDump);
  1278. }
  1279. std::free (e);
  1280. diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  1281. index 2716d8b70..620ba9874 100644
  1282. --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  1283. +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  1284. @@ -37,7 +37,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant")
  1285. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996)
  1286. #define VST_FORCE_DEPRECATED 0
  1287. -#define JUCE_VSTINTERFACE_H_INCLUDED 1
  1288. namespace Vst2
  1289. {
  1290. @@ -46,8 +45,7 @@ namespace Vst2
  1291. // paths or use the "VST (Legacy) SDK Folder" field in the Projucer. The VST2
  1292. // SDK can be obtained from the vstsdk3610_11_06_2018_build_37 (or older) VST3
  1293. // SDK or JUCE version 5.3.2.
  1294. -#include <pluginterfaces/vst2.x/aeffect.h>
  1295. -#include <pluginterfaces/vst2.x/aeffectx.h>
  1296. +#include "../../juce_audio_processors/format_types/juce_VSTInterface.h"
  1297. }
  1298. #include "juce_VSTCommon.h"
  1299. @@ -77,7 +75,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4355)
  1300. #endif
  1301. #ifndef JUCE_VST_WRAPPER_INVOKE_MAIN
  1302. -#define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain ((Vst2::audioMasterCallback) &audioMaster);
  1303. + #define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain (&audioMaster);
  1304. #endif
  1305. //==============================================================================
  1306. @@ -217,8 +215,8 @@ namespace
  1307. }
  1308. //==============================================================================
  1309. -typedef Vst2::AEffect* (VSTCALLBACK *MainCall) (Vst2::audioMasterCallback);
  1310. -static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect*, int32, int32, pointer_sized_int, void*, float);
  1311. +typedef Vst2::VstEffectInterface* (VSTINTERFACECALL *MainCall) (Vst2::VstHostCallback);
  1312. +static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface*, int32, int32, pointer_sized_int, void*, float);
  1313. //==============================================================================
  1314. // Change this to disable logging of various VST activities
  1315. @@ -686,9 +684,9 @@ struct ModuleHandle : public ReferenceCountedObject
  1316. module.close();
  1317. }
  1318. - void closeEffect (Vst2::AEffect* eff)
  1319. + void closeEffect (Vst2::VstEffectInterface* eff)
  1320. {
  1321. - eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0);
  1322. + eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0);
  1323. }
  1324. #if JUCE_WINDOWS
  1325. @@ -812,9 +810,9 @@ struct ModuleHandle : public ReferenceCountedObject
  1326. }
  1327. }
  1328. - void closeEffect (Vst2::AEffect* eff)
  1329. + void closeEffect (Vst2::VstEffectInterface* eff)
  1330. {
  1331. - eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0);
  1332. + eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0);
  1333. }
  1334. #endif
  1335. @@ -866,7 +864,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1336. {
  1337. const ScopedLock sl (pluginInstance.lock);
  1338. - return effect->getParameter (effect, getParameterIndex());
  1339. + return effect->getParameterValueFunction (effect, getParameterIndex());
  1340. }
  1341. return 0.0f;
  1342. @@ -878,8 +876,8 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1343. {
  1344. const ScopedLock sl (pluginInstance.lock);
  1345. - if (effect->getParameter (effect, getParameterIndex()) != newValue)
  1346. - effect->setParameter (effect, getParameterIndex(), newValue);
  1347. + if (effect->getParameterValueFunction (effect, getParameterIndex()) != newValue)
  1348. + effect->setParameterValueFunction (effect, getParameterIndex(), newValue);
  1349. }
  1350. }
  1351. @@ -912,7 +910,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1352. if (valueType != nullptr || ! vstValueStrings.isEmpty())
  1353. return getText (getValue(), 1024);
  1354. - return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::effGetParamDisplay);
  1355. + return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::plugInOpcodeGetParameterText);
  1356. }
  1357. float getDefaultValue() const override
  1358. @@ -924,7 +922,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1359. {
  1360. if (name.isEmpty())
  1361. return pluginInstance.getTextForOpcode (getParameterIndex(),
  1362. - Vst2::effGetParamName);
  1363. + Vst2::plugInOpcodeGetParameterName);
  1364. if (name.length() <= maximumStringLength)
  1365. return name;
  1366. @@ -944,7 +942,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1367. String getLabel() const override
  1368. {
  1369. return label.isEmpty() ? pluginInstance.getTextForOpcode (getParameterIndex(),
  1370. - Vst2::effGetParamLabel)
  1371. + Vst2::plugInOpcodeGetParameterLabel)
  1372. : label;
  1373. }
  1374. @@ -986,7 +984,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1375. const VSTXMLInfo::ValueType* const valueType;
  1376. };
  1377. - VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::AEffect* effect,
  1378. + VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::VstEffectInterface* effect,
  1379. double sampleRateToUse, int blockSizeToUse)
  1380. : AudioPluginInstance (ioConfig),
  1381. vstEffect (effect),
  1382. @@ -1009,13 +1007,13 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1383. {
  1384. AudioProcessorParameterGroup newParameterTree;
  1385. - for (int i = 0; i < vstEffect->numParams; ++i)
  1386. + for (int i = 0; i < vstEffect->numParameters; ++i)
  1387. {
  1388. String paramName;
  1389. Array<String> shortParamNames;
  1390. float defaultValue = 0;
  1391. String label;
  1392. - bool isAutomatable = dispatch (Vst2::effCanBeAutomated, i, 0, nullptr, 0) != 0;
  1393. + bool isAutomatable = dispatch (Vst2::plugInOpcodeIsParameterAutomatable, i, 0, nullptr, 0) != 0;
  1394. bool isDiscrete = false;
  1395. int numSteps = AudioProcessor::getDefaultNumParameterSteps();
  1396. bool isBoolSwitch = false;
  1397. @@ -1083,7 +1081,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1398. ~VSTPluginInstance() override
  1399. {
  1400. - if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */)
  1401. + if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier)
  1402. {
  1403. struct VSTDeleter : public CallbackMessage
  1404. {
  1405. @@ -1116,7 +1114,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1406. void cleanup()
  1407. {
  1408. - if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */)
  1409. + if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier)
  1410. {
  1411. #if JUCE_MAC
  1412. if (vstModule->resFileId != 0)
  1413. @@ -1141,16 +1139,16 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1414. {
  1415. if (auto* newEffect = constructEffect (newModule))
  1416. {
  1417. - newEffect->resvd2 = 0;
  1418. + newEffect->hostSpace2 = 0;
  1419. - newEffect->dispatcher (newEffect, Vst2::effIdentify, 0, 0, nullptr, 0);
  1420. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0);
  1421. auto blockSize = jmax (32, initialBlockSize);
  1422. - newEffect->dispatcher (newEffect, Vst2::effSetSampleRate, 0, 0, nullptr, static_cast<float> (initialSampleRate));
  1423. - newEffect->dispatcher (newEffect, Vst2::effSetBlockSize, 0, blockSize, nullptr, 0);
  1424. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, static_cast<float> (initialSampleRate));
  1425. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetBlockSize, 0, blockSize, nullptr, 0);
  1426. - newEffect->dispatcher (newEffect, Vst2::effOpen, 0, 0, nullptr, 0);
  1427. + newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0);
  1428. BusesProperties ioConfig = queryBusIO (newEffect);
  1429. return new VSTPluginInstance (newModule, ioConfig, newEffect, initialSampleRate, blockSize);
  1430. @@ -1166,7 +1164,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1431. {
  1432. char buffer[512] = { 0 };
  1433. - dispatch (Vst2::effGetEffectName, 0, 0, buffer, 0);
  1434. + dispatch (Vst2::plugInOpcodeGetPlugInName, 0, 0, buffer, 0);
  1435. desc.descriptiveName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim();
  1436. @@ -1183,7 +1181,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1437. {
  1438. char buffer[512] = { 0 };
  1439. - dispatch (Vst2::effGetVendorString, 0, 0, buffer, 0);
  1440. + dispatch (Vst2::plugInOpcodeGetManufacturerName, 0, 0, buffer, 0);
  1441. desc.manufacturerName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim();
  1442. }
  1443. @@ -1197,7 +1195,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1444. {
  1445. if (vstEffect != nullptr)
  1446. {
  1447. - vstEffect->resvd2 = (pointer_sized_int) (pointer_sized_int) this;
  1448. + vstEffect->hostSpace2 = (pointer_sized_int) (pointer_sized_int) this;
  1449. initialise (initialSampleRate, initialBlockSize);
  1450. return true;
  1451. }
  1452. @@ -1223,25 +1221,25 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1453. setRateAndBufferSizeDetails (initialSampleRate, initialBlockSize);
  1454. - dispatch (Vst2::effIdentify, 0, 0, nullptr, 0);
  1455. + dispatch (Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0);
  1456. if (getSampleRate() > 0)
  1457. - dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) getSampleRate());
  1458. + dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) getSampleRate());
  1459. if (getBlockSize() > 0)
  1460. - dispatch (Vst2::effSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0);
  1461. + dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0);
  1462. - dispatch (Vst2::effOpen, 0, 0, nullptr, 0);
  1463. + dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0);
  1464. setRateAndBufferSizeDetails (getSampleRate(), getBlockSize());
  1465. if (getNumPrograms() > 1)
  1466. setCurrentProgram (0);
  1467. else
  1468. - dispatch (Vst2::effSetProgram, 0, 0, nullptr, 0);
  1469. + dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, 0, nullptr, 0);
  1470. - for (int i = vstEffect->numInputs; --i >= 0;) dispatch (Vst2::effConnectInput, i, 1, nullptr, 0);
  1471. - for (int i = vstEffect->numOutputs; --i >= 0;) dispatch (Vst2::effConnectOutput, i, 1, nullptr, 0);
  1472. + for (int i = vstEffect->numInputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectInput, i, 1, nullptr, 0);
  1473. + for (int i = vstEffect->numOutputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectOutput, i, 1, nullptr, 0);
  1474. if (getVstCategory() != Vst2::kPlugCategShell) // (workaround for Waves 5 plugins which crash during this call)
  1475. updateStoredProgramNames();
  1476. @@ -1252,7 +1250,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1477. usesCocoaNSView = ((unsigned int) pluginCanDo ("hasCockosViewAsConfig") & 0xffff0000ul) == 0xbeef0000ul;
  1478. #endif
  1479. - setLatencySamples (vstEffect->initialDelay);
  1480. + setLatencySamples (vstEffect->latency);
  1481. }
  1482. void* getPlatformSpecificData() override { return vstEffect; }
  1483. @@ -1263,7 +1261,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1484. {
  1485. char buffer[512] = { 0 };
  1486. - if (dispatch (Vst2::effGetProductString, 0, 0, buffer, 0) != 0)
  1487. + if (dispatch (Vst2::plugInOpcodeGetManufacturerProductName, 0, 0, buffer, 0) != 0)
  1488. {
  1489. String productName = String::createStringFromData (buffer, (int) sizeof (buffer));
  1490. @@ -1277,7 +1275,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1491. int getUID() const
  1492. {
  1493. - int uid = vstEffect != nullptr ? vstEffect->uniqueID : 0;
  1494. + int uid = vstEffect != nullptr ? vstEffect->plugInIdentifier : 0;
  1495. if (uid == 0)
  1496. uid = vstModule->file.hashCode();
  1497. @@ -1290,10 +1288,10 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1498. if (vstEffect == nullptr)
  1499. return 0.0;
  1500. - if ((vstEffect->flags & Vst2::effFlagsNoSoundInStop) != 0)
  1501. + if ((vstEffect->flags & 512) != 0)
  1502. return 0.0;
  1503. - auto tailSize = dispatch (Vst2::effGetTailSize, 0, 0, nullptr, 0);
  1504. + auto tailSize = dispatch (Vst2::plugInOpcodeGetTailSize, 0, 0, nullptr, 0);
  1505. auto sampleRate = getSampleRate();
  1506. // remain backward compatible with old JUCE plug-ins: anything larger
  1507. @@ -1313,11 +1311,11 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1508. bool producesMidi() const override { return pluginCanDo ("sendVstMidiEvent") > 0; }
  1509. bool supportsMPE() const override { return pluginCanDo ("MPE") > 0; }
  1510. - Vst2::VstPlugCategory getVstCategory() const noexcept { return (Vst2::VstPlugCategory) dispatch (Vst2::effGetPlugCategory, 0, 0, nullptr, 0); }
  1511. + Vst2::VstPlugInCategory getVstCategory() const noexcept { return (Vst2::VstPlugInCategory) dispatch (Vst2::plugInOpcodeGetPlugInCategory, 0, 0, nullptr, 0); }
  1512. - bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsIsSynth) != 0); }
  1513. + bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagIsSynth) != 0); }
  1514. - int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::effCanDo, 0, 0, (void*) text, 0); }
  1515. + int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::plugInOpcodeCanPlugInDo, 0, 0, (void*) text, 0); }
  1516. //==============================================================================
  1517. void prepareToPlay (double rate, int samplesPerBlockExpected) override
  1518. @@ -1332,17 +1330,17 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1519. SpeakerMappings::VstSpeakerConfigurationHolder inArr (getChannelLayoutOfBus (true, 0));
  1520. SpeakerMappings::VstSpeakerConfigurationHolder outArr (getChannelLayoutOfBus (false, 0));
  1521. - dispatch (Vst2::effSetSpeakerArrangement, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f);
  1522. + dispatch (Vst2::plugInOpcodeSetSpeakerConfiguration, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f);
  1523. }
  1524. - vstHostTime.tempo = 120.0;
  1525. - vstHostTime.timeSigNumerator = 4;
  1526. - vstHostTime.timeSigDenominator = 4;
  1527. + vstHostTime.tempoBPM = 120.0;
  1528. + vstHostTime.timeSignatureNumerator = 4;
  1529. + vstHostTime.timeSignatureDenominator = 4;
  1530. vstHostTime.sampleRate = rate;
  1531. - vstHostTime.samplePos = 0;
  1532. - vstHostTime.flags = Vst2::kVstNanosValid
  1533. - | Vst2::kVstAutomationWriting
  1534. - | Vst2::kVstAutomationReading;
  1535. + vstHostTime.samplePosition = 0;
  1536. + vstHostTime.flags = Vst2::vstTimingInfoFlagNanosecondsValid
  1537. + | Vst2::vstTimingInfoFlagAutomationWriteModeActive
  1538. + | Vst2::vstTimingInfoFlagAutomationReadModeActive;
  1539. initialise (rate, samplesPerBlockExpected);
  1540. @@ -1357,18 +1355,18 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1541. incomingMidi.clear();
  1542. - dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) rate);
  1543. - dispatch (Vst2::effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0);
  1544. + dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) rate);
  1545. + dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0);
  1546. if (supportsDoublePrecisionProcessing())
  1547. {
  1548. - int32 vstPrecision = isUsingDoublePrecision() ? Vst2::kVstProcessPrecision64
  1549. - : Vst2::kVstProcessPrecision32;
  1550. + int32 vstPrecision = isUsingDoublePrecision() ? Vst2::vstProcessingSampleTypeDouble
  1551. + : Vst2::vstProcessingSampleTypeFloat;
  1552. - dispatch (Vst2::effSetProcessPrecision, 0, (pointer_sized_int) vstPrecision, nullptr, 0);
  1553. + dispatch (Vst2::plugInOpcodeSetSampleFloatType, 0, (pointer_sized_int) vstPrecision, nullptr, 0);
  1554. }
  1555. - auto maxChannels = jmax (1, jmax (vstEffect->numInputs, vstEffect->numOutputs));
  1556. + auto maxChannels = jmax (1, jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels));
  1557. tmpBufferFloat .setSize (maxChannels, samplesPerBlockExpected);
  1558. tmpBufferDouble.setSize (maxChannels, samplesPerBlockExpected);
  1559. @@ -1376,7 +1374,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1560. channelBufferFloat .calloc (static_cast<size_t> (maxChannels));
  1561. channelBufferDouble.calloc (static_cast<size_t> (maxChannels));
  1562. - outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputs), samplesPerBlockExpected);
  1563. + outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputChannels), samplesPerBlockExpected);
  1564. if (! isPowerOn)
  1565. setPower (true);
  1566. @@ -1392,9 +1390,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1567. }
  1568. }
  1569. - dispatch (Vst2::effStartProcess, 0, 0, nullptr, 0);
  1570. + dispatch (Vst2::plugInOpcodeStartProcess, 0, 0, nullptr, 0);
  1571. - setLatencySamples (vstEffect->initialDelay);
  1572. + setLatencySamples (vstEffect->latency);
  1573. }
  1574. }
  1575. @@ -1402,7 +1400,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1576. {
  1577. if (initialised)
  1578. {
  1579. - dispatch (Vst2::effStopProcess, 0, 0, nullptr, 0);
  1580. + dispatch (Vst2::plugInOpcodeStopProcess, 0, 0, nullptr, 0);
  1581. setPower (false);
  1582. }
  1583. @@ -1455,8 +1453,8 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1584. //==============================================================================
  1585. bool supportsDoublePrecisionProcessing() const override
  1586. {
  1587. - return ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0
  1588. - && (vstEffect->flags & Vst2::effFlagsCanDoubleReplacing) != 0);
  1589. + return ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0
  1590. + && (vstEffect->flags & Vst2::vstEffectFlagInplaceDoubleAudio) != 0);
  1591. }
  1592. AudioProcessorParameter* getBypassParameter() const override { return vstSupportsBypass ? bypassParam.get() : nullptr; }
  1593. @@ -1474,15 +1472,15 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1594. if (numInputBuses > 1 || numOutputBuses > 1)
  1595. return (layouts == getBusesLayout());
  1596. - return (layouts.getNumChannels (true, 0) <= vstEffect->numInputs
  1597. - && layouts.getNumChannels (false, 0) <= vstEffect->numOutputs);
  1598. + return (layouts.getNumChannels (true, 0) <= vstEffect->numInputChannels
  1599. + && layouts.getNumChannels (false, 0) <= vstEffect->numOutputChannels);
  1600. }
  1601. //==============================================================================
  1602. #if JUCE_IOS || JUCE_ANDROID
  1603. bool hasEditor() const override { return false; }
  1604. #else
  1605. - bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsHasEditor) != 0; }
  1606. + bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagHasEditor) != 0; }
  1607. #endif
  1608. AudioProcessorEditor* createEditor() override;
  1609. @@ -1492,9 +1490,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1610. {
  1611. if (isValidChannel (index, true))
  1612. {
  1613. - Vst2::VstPinProperties pinProps;
  1614. - if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0)
  1615. - return String (pinProps.label, sizeof (pinProps.label));
  1616. + Vst2::VstPinInfo pinProps;
  1617. + if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  1618. + return String (pinProps.text, sizeof (pinProps.text));
  1619. }
  1620. return {};
  1621. @@ -1505,9 +1503,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1622. if (! isValidChannel (index, true))
  1623. return false;
  1624. - Vst2::VstPinProperties pinProps;
  1625. - if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0)
  1626. - return (pinProps.flags & Vst2::kVstPinIsStereo) != 0;
  1627. + Vst2::VstPinInfo pinProps;
  1628. + if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  1629. + return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0;
  1630. return true;
  1631. }
  1632. @@ -1516,9 +1514,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1633. {
  1634. if (isValidChannel (index, false))
  1635. {
  1636. - Vst2::VstPinProperties pinProps;
  1637. - if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0)
  1638. - return String (pinProps.label, sizeof (pinProps.label));
  1639. + Vst2::VstPinInfo pinProps;
  1640. + if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  1641. + return String (pinProps.text, sizeof (pinProps.text));
  1642. }
  1643. return {};
  1644. @@ -1529,9 +1527,9 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1645. if (! isValidChannel (index, false))
  1646. return false;
  1647. - Vst2::VstPinProperties pinProps;
  1648. - if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0)
  1649. - return (pinProps.flags & Vst2::kVstPinIsStereo) != 0;
  1650. + Vst2::VstPinInfo pinProps;
  1651. + if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0)
  1652. + return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0;
  1653. return true;
  1654. }
  1655. @@ -1546,12 +1544,12 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1656. int getNumPrograms() override { return vstEffect != nullptr ? jmax (0, vstEffect->numPrograms) : 0; }
  1657. // NB: some plugs return negative numbers from this function.
  1658. - int getCurrentProgram() override { return (int) dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); }
  1659. + int getCurrentProgram() override { return (int) dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, 0, 0); }
  1660. void setCurrentProgram (int newIndex) override
  1661. {
  1662. if (getNumPrograms() > 0 && newIndex != getCurrentProgram())
  1663. - dispatch (Vst2::effSetProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), nullptr, 0);
  1664. + dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), 0, 0);
  1665. }
  1666. const String getProgramName (int index) override
  1667. @@ -1565,7 +1563,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1668. {
  1669. char nm[264] = { 0 };
  1670. - if (dispatch (Vst2::effGetProgramNameIndexed, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0)
  1671. + if (dispatch (Vst2::plugInOpcodeGetProgramName, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0)
  1672. return String::fromUTF8 (nm).trim();
  1673. }
  1674. }
  1675. @@ -1578,7 +1576,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1676. if (index >= 0 && index == getCurrentProgram())
  1677. {
  1678. if (getNumPrograms() > 0 && newName != getCurrentProgramName())
  1679. - dispatch (Vst2::effSetProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f);
  1680. + dispatch (Vst2::plugInOpcodeSetCurrentProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f);
  1681. }
  1682. else
  1683. {
  1684. @@ -1596,7 +1594,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1685. //==============================================================================
  1686. void timerCallback() override
  1687. {
  1688. - if (dispatch (Vst2::effIdle, 0, 0, nullptr, 0) == 0)
  1689. + if (dispatch (Vst2::plugInOpcodeIdle, 0, 0, nullptr, 0) == 0)
  1690. stopTimer();
  1691. }
  1692. @@ -1610,7 +1608,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1693. {
  1694. switch (opcode)
  1695. {
  1696. - case Vst2::audioMasterAutomate:
  1697. + case Vst2::hostOpcodeParameterChanged:
  1698. if (auto* param = getParameters()[index])
  1699. param->sendValueChangedMessageToListeners (opt);
  1700. else
  1701. @@ -1618,23 +1616,23 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1702. break;
  1703. - case Vst2::audioMasterProcessEvents: handleMidiFromPlugin ((const Vst2::VstEvents*) ptr); break;
  1704. - case Vst2::audioMasterGetTime: return getVSTTime();
  1705. - case Vst2::audioMasterIdle: handleIdle(); break;
  1706. - case Vst2::audioMasterSizeWindow: setWindowSize (index, (int) value); return 1;
  1707. - case Vst2::audioMasterUpdateDisplay: triggerAsyncUpdate(); break;
  1708. - case Vst2::audioMasterIOChanged: setLatencySamples (vstEffect->initialDelay); break;
  1709. - case Vst2::audioMasterNeedIdle: startTimer (50); break;
  1710. + case Vst2::hostOpcodePreAudioProcessingEvents: handleMidiFromPlugin ((const Vst2::VstEventBlock*) ptr); break;
  1711. + case Vst2::hostOpcodeGetTimingInfo: return getVSTTime();
  1712. + case Vst2::hostOpcodeIdle: handleIdle(); break;
  1713. + case Vst2::hostOpcodeWindowSize: setWindowSize (index, (int) value); return 1;
  1714. + case Vst2::hostOpcodeUpdateView: triggerAsyncUpdate(); break;
  1715. + case Vst2::hostOpcodeIOModified: setLatencySamples (vstEffect->latency); break;
  1716. + case Vst2::hostOpcodeNeedsIdle: startTimer (50); break;
  1717. - case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue);
  1718. - case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue);
  1719. - case Vst2::audioMasterWantMidi: wantsMidiMessages = true; break;
  1720. - case Vst2::audioMasterGetDirectory: return getVstDirectory();
  1721. + case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue);
  1722. + case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue);
  1723. + case Vst2::hostOpcodePlugInWantsMidi: wantsMidiMessages = true; break;
  1724. + case Vst2::hostOpcodeGetDirectory: return getVstDirectory();
  1725. - case Vst2::audioMasterTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0);
  1726. - case Vst2::audioMasterGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0);
  1727. + case Vst2::hostOpcodeTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0);
  1728. + case Vst2::hostOpcodeGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0);
  1729. - case Vst2::audioMasterBeginEdit:
  1730. + case Vst2::hostOpcodeParameterChangeGestureBegin:
  1731. if (auto* param = getParameters()[index])
  1732. param->beginChangeGesture();
  1733. else
  1734. @@ -1642,7 +1640,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1735. break;
  1736. - case Vst2::audioMasterEndEdit:
  1737. + case Vst2::hostOpcodeParameterChangeGestureEnd:
  1738. if (auto* param = getParameters()[index])
  1739. param->endChangeGesture();
  1740. else
  1741. @@ -1650,28 +1648,28 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1742. break;
  1743. - case Vst2::audioMasterPinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true)
  1744. - case Vst2::audioMasterGetCurrentProcessLevel: return isNonRealtime() ? 4 : 0;
  1745. + case Vst2::hostOpcodePinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true)
  1746. + case Vst2::hostOpcodeGetCurrentAudioProcessingLevel: return isNonRealtime() ? 4 : 0;
  1747. // none of these are handled (yet)...
  1748. - case Vst2::audioMasterSetTime:
  1749. - case Vst2::audioMasterGetParameterQuantization:
  1750. - case Vst2::audioMasterGetInputLatency:
  1751. - case Vst2::audioMasterGetOutputLatency:
  1752. - case Vst2::audioMasterGetPreviousPlug:
  1753. - case Vst2::audioMasterGetNextPlug:
  1754. - case Vst2::audioMasterWillReplaceOrAccumulate:
  1755. - case Vst2::audioMasterOfflineStart:
  1756. - case Vst2::audioMasterOfflineRead:
  1757. - case Vst2::audioMasterOfflineWrite:
  1758. - case Vst2::audioMasterOfflineGetCurrentPass:
  1759. - case Vst2::audioMasterOfflineGetCurrentMetaPass:
  1760. - case Vst2::audioMasterGetOutputSpeakerArrangement:
  1761. - case Vst2::audioMasterVendorSpecific:
  1762. - case Vst2::audioMasterSetIcon:
  1763. - case Vst2::audioMasterGetLanguage:
  1764. - case Vst2::audioMasterOpenWindow:
  1765. - case Vst2::audioMasterCloseWindow:
  1766. + case Vst2::hostOpcodeSetTime:
  1767. + case Vst2::hostOpcodeGetParameterInterval:
  1768. + case Vst2::hostOpcodeGetInputLatency:
  1769. + case Vst2::hostOpcodeGetOutputLatency:
  1770. + case Vst2::hostOpcodeGetPreviousPlugIn:
  1771. + case Vst2::hostOpcodeGetNextPlugIn:
  1772. + case Vst2::hostOpcodeWillReplace:
  1773. + case Vst2::hostOpcodeOfflineStart:
  1774. + case Vst2::hostOpcodeOfflineReadSource:
  1775. + case Vst2::hostOpcodeOfflineWrite:
  1776. + case Vst2::hostOpcodeOfflineGetCurrentPass:
  1777. + case Vst2::hostOpcodeOfflineGetCurrentMetaPass:
  1778. + case Vst2::hostOpcodeGetOutputSpeakerConfiguration:
  1779. + case Vst2::hostOpcodeManufacturerSpecific:
  1780. + case Vst2::hostOpcodeSetIcon:
  1781. + case Vst2::hostOpcodeGetLanguage:
  1782. + case Vst2::hostOpcodeOpenEditorWindow:
  1783. + case Vst2::hostOpcodeCloseEditorWindow:
  1784. break;
  1785. default:
  1786. @@ -1686,19 +1684,19 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1787. {
  1788. switch (opcode)
  1789. {
  1790. - case Vst2::audioMasterCanDo: return handleCanDo ((const char*) ptr);
  1791. - case Vst2::audioMasterVersion: return 2400;
  1792. - case Vst2::audioMasterCurrentId: return shellUIDToCreate;
  1793. - case Vst2::audioMasterGetNumAutomatableParameters: return 0;
  1794. - case Vst2::audioMasterGetAutomationState: return 1;
  1795. - case Vst2::audioMasterGetVendorVersion: return 0x0101;
  1796. + case Vst2::hostOpcodeCanHostDo: return handleCanDo ((const char*) ptr);
  1797. + case Vst2::hostOpcodeVstVersion: return 2400;
  1798. + case Vst2::hostOpcodeCurrentId: return shellUIDToCreate;
  1799. + case Vst2::hostOpcodeGetNumberOfAutomatableParameters: return 0;
  1800. + case Vst2::hostOpcodeGetAutomationState: return 1;
  1801. + case Vst2::hostOpcodeGetManufacturerVersion: return 0x0101;
  1802. - case Vst2::audioMasterGetVendorString:
  1803. - case Vst2::audioMasterGetProductString: return getHostName ((char*) ptr);
  1804. + case Vst2::hostOpcodeGetManufacturerName:
  1805. + case Vst2::hostOpcodeGetProductName: return getHostName ((char*) ptr);
  1806. - case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue;
  1807. - case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue;
  1808. - case Vst2::audioMasterSetOutputSampleRate: return 0;
  1809. + case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue;
  1810. + case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue;
  1811. + case Vst2::hostOpcodeSetOutputSampleRate: return 0;
  1812. default:
  1813. DBG ("*** Unhandled VST Callback: " + String ((int) opcode));
  1814. @@ -1727,7 +1725,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1815. UseResFile (vstModule->resFileId);
  1816. #endif
  1817. - result = vstEffect->dispatcher (vstEffect, opcode, index, value, ptr, opt);
  1818. + result = vstEffect->dispatchFunction (vstEffect, opcode, index, value, ptr, opt);
  1819. #if JUCE_MAC
  1820. auto newResFile = CurResFile();
  1821. @@ -1933,14 +1931,14 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1822. return true;
  1823. }
  1824. - bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsProgramChunks) != 0; }
  1825. + bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagDataInChunks) != 0; }
  1826. bool getChunkData (MemoryBlock& mb, bool isPreset, int maxSizeMB) const
  1827. {
  1828. if (usesChunks())
  1829. {
  1830. void* data = nullptr;
  1831. - auto bytes = (size_t) dispatch (Vst2::effGetChunk, isPreset ? 1 : 0, 0, &data, 0.0f);
  1832. + auto bytes = (size_t) dispatch (Vst2::plugInOpcodeGetData, isPreset ? 1 : 0, 0, &data, 0.0f);
  1833. if (data != nullptr && bytes <= (size_t) maxSizeMB * 1024 * 1024)
  1834. {
  1835. @@ -1958,7 +1956,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1836. {
  1837. if (size > 0 && usesChunks())
  1838. {
  1839. - dispatch (Vst2::effSetChunk, isPreset ? 1 : 0, size, (void*) data, 0.0f);
  1840. + dispatch (Vst2::plugInOpcodeSetData, isPreset ? 1 : 0, size, (void*) data, 0.0f);
  1841. if (! isPreset)
  1842. updateStoredProgramNames();
  1843. @@ -1969,7 +1967,7 @@ struct VSTPluginInstance : public AudioPluginInstance,
  1844. return false;
  1845. }
  1846. - Vst2::AEffect* vstEffect;
  1847. + Vst2::VstEffectInterface* vstEffect;
  1848. ModuleHandle::Ptr vstModule;
  1849. std::unique_ptr<VSTPluginFormat::ExtraFunctions> extraFunctions;
  1850. @@ -1992,7 +1990,7 @@ private:
  1851. currentValue = (newValue != 0.0f);
  1852. if (parent.vstSupportsBypass)
  1853. - parent.dispatch (Vst2::effSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f);
  1854. + parent.dispatch (Vst2::plugInOpcodeSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f);
  1855. }
  1856. float getValueForText (const String& text) const override
  1857. @@ -2039,7 +2037,7 @@ private:
  1858. CriticalSection midiInLock;
  1859. MidiBuffer incomingMidi;
  1860. VSTMidiEventList midiEventsToSend;
  1861. - Vst2::VstTimeInfo vstHostTime;
  1862. + Vst2::VstTimingInformation vstHostTime;
  1863. AudioBuffer<float> tmpBufferFloat;
  1864. HeapBlock<float*> channelBufferFloat;
  1865. @@ -2076,7 +2074,7 @@ private:
  1866. if (auto* app = JUCEApplicationBase::getInstance())
  1867. hostName = app->getApplicationName();
  1868. - hostName.copyToUTF8 (name, (size_t) jmin (Vst2::kVstMaxVendorStrLen, Vst2::kVstMaxProductStrLen) - 1);
  1869. + hostName.copyToUTF8 (name, (size_t) jmin (Vst2::vstMaxManufacturerStringLength, Vst2::vstMaxPlugInNameStringLength) - 1);
  1870. return 1;
  1871. }
  1872. @@ -2097,7 +2095,7 @@ private:
  1873. #if JUCE_MAC
  1874. if (getActiveEditor() != nullptr)
  1875. - dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0);
  1876. + dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0);
  1877. #endif
  1878. Timer::callPendingTimersSynchronously();
  1879. @@ -2132,9 +2130,9 @@ private:
  1880. }
  1881. //==============================================================================
  1882. - static Vst2::AEffect* constructEffect (const ModuleHandle::Ptr& module)
  1883. + static Vst2::VstEffectInterface* constructEffect (const ModuleHandle::Ptr& module)
  1884. {
  1885. - Vst2::AEffect* effect = nullptr;
  1886. + Vst2::VstEffectInterface* effect = nullptr;
  1887. try
  1888. {
  1889. const IdleCallRecursionPreventer icrp;
  1890. @@ -2151,10 +2149,10 @@ private:
  1891. JUCE_VST_WRAPPER_INVOKE_MAIN
  1892. }
  1893. - if (effect != nullptr && effect->magic == 0x56737450 /* 'VstP' */)
  1894. + if (effect != nullptr && effect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier)
  1895. {
  1896. - jassert (effect->resvd2 == 0);
  1897. - jassert (effect->object != nullptr);
  1898. + jassert (effect->hostSpace2 == 0);
  1899. + jassert (effect->effectPointer != 0);
  1900. _fpreset(); // some dodgy plugs mess around with this
  1901. }
  1902. @@ -2169,11 +2167,11 @@ private:
  1903. return effect;
  1904. }
  1905. - static BusesProperties queryBusIO (Vst2::AEffect* effect)
  1906. + static BusesProperties queryBusIO (Vst2::VstEffectInterface* effect)
  1907. {
  1908. BusesProperties returnValue;
  1909. - if (effect->numInputs == 0 && effect->numOutputs == 0)
  1910. + if (effect->numInputChannels == 0 && effect->numOutputChannels == 0)
  1911. return returnValue;
  1912. // Workaround for old broken JUCE plug-ins which would return an invalid
  1913. @@ -2184,14 +2182,14 @@ private:
  1914. // plug-in is reporting.
  1915. if (! pluginHasDefaultChannelLayouts (effect))
  1916. {
  1917. - SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputs));
  1918. - SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputs));
  1919. + SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputChannels));
  1920. + SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputChannels));
  1921. - effect->dispatcher (effect, Vst2::effSetSpeakerArrangement, 0,
  1922. + effect->dispatchFunction (effect, Vst2::plugInOpcodeSetSpeakerConfiguration, 0,
  1923. (pointer_sized_int) &canonicalIn.get(), (void*) &canonicalOut.get(), 0.0f);
  1924. }
  1925. - HeapBlock<Vst2::VstSpeakerArrangement> inArrBlock (1, true), outArrBlock (1, true);
  1926. + HeapBlock<Vst2::VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true);
  1927. auto* inArr = inArrBlock.get();
  1928. auto* outArr = outArrBlock.get();
  1929. @@ -2202,35 +2200,35 @@ private:
  1930. for (int dir = 0; dir < 2; ++dir)
  1931. {
  1932. const bool isInput = (dir == 0);
  1933. - const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties);
  1934. - const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs);
  1935. - const Vst2::VstSpeakerArrangement* arr = (isInput ? inArr : outArr);
  1936. + const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties);
  1937. + const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels);
  1938. + const Vst2::VstSpeakerConfiguration* arr = (isInput ? inArr : outArr);
  1939. bool busAdded = false;
  1940. - Vst2::VstPinProperties pinProps;
  1941. + Vst2::VstPinInfo pinProps;
  1942. AudioChannelSet layout;
  1943. for (int ch = 0; ch < maxChannels; ch += layout.size())
  1944. {
  1945. - if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  1946. + if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  1947. break;
  1948. - if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0)
  1949. + if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0)
  1950. {
  1951. - layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.arrangementType, 0);
  1952. + layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.configurationType, 0);
  1953. if (layout.isDisabled())
  1954. break;
  1955. }
  1956. else if (arr == nullptr)
  1957. {
  1958. - layout = ((pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono());
  1959. + layout = ((pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono());
  1960. }
  1961. else
  1962. break;
  1963. busAdded = true;
  1964. - returnValue.addBus (isInput, pinProps.label, layout, true);
  1965. + returnValue.addBus (isInput, pinProps.text, layout, true);
  1966. }
  1967. // no buses?
  1968. @@ -2238,8 +2236,8 @@ private:
  1969. {
  1970. String busName = (isInput ? "Input" : "Output");
  1971. - if (effect->dispatcher (effect, opcode, 0, 0, &pinProps, 0.0f) != 0)
  1972. - busName = pinProps.label;
  1973. + if (effect->dispatchFunction (effect, opcode, 0, 0, &pinProps, 0.0f) != 0)
  1974. + busName = pinProps.text;
  1975. if (arr != nullptr)
  1976. layout = SpeakerMappings::vstArrangementTypeToChannelSet (*arr);
  1977. @@ -2253,9 +2251,9 @@ private:
  1978. return returnValue;
  1979. }
  1980. - static bool pluginHasDefaultChannelLayouts (Vst2::AEffect* effect)
  1981. + static bool pluginHasDefaultChannelLayouts (Vst2::VstEffectInterface* effect)
  1982. {
  1983. - HeapBlock<Vst2::VstSpeakerArrangement> inArrBlock (1, true), outArrBlock (1, true);
  1984. + HeapBlock<Vst2::VstSpeakerConfiguration> inArrBlock (1, true), outArrBlock (1, true);
  1985. auto* inArr = inArrBlock.get();
  1986. auto* outArr = outArrBlock.get();
  1987. @@ -2266,40 +2264,40 @@ private:
  1988. for (int dir = 0; dir < 2; ++dir)
  1989. {
  1990. const bool isInput = (dir == 0);
  1991. - const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties);
  1992. - const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs);
  1993. + const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties);
  1994. + const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels);
  1995. int channels = 1;
  1996. for (int ch = 0; ch < maxChannels; ch += channels)
  1997. {
  1998. - Vst2::VstPinProperties pinProps;
  1999. + Vst2::VstPinInfo pinProps;
  2000. - if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  2001. + if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0)
  2002. return false;
  2003. - if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0)
  2004. + if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0)
  2005. return true;
  2006. - channels = (pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? 2 : 1;
  2007. + channels = (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? 2 : 1;
  2008. }
  2009. }
  2010. return false;
  2011. }
  2012. - static bool getSpeakerArrangementWrapper (Vst2::AEffect* effect,
  2013. - Vst2::VstSpeakerArrangement* inArr,
  2014. - Vst2::VstSpeakerArrangement* outArr)
  2015. + static bool getSpeakerArrangementWrapper (Vst2::VstEffectInterface* effect,
  2016. + Vst2::VstSpeakerConfiguration* inArr,
  2017. + Vst2::VstSpeakerConfiguration* outArr)
  2018. {
  2019. // Workaround: unfortunately old JUCE VST-2 plug-ins had a bug and would crash if
  2020. // you try to get the speaker arrangement when there are no input channels present.
  2021. // Hopefully, one day (when there are no more old JUCE plug-ins around), we can
  2022. // comment out the next two lines.
  2023. - if (effect->numInputs == 0)
  2024. + if (effect->numInputChannels == 0)
  2025. return false;
  2026. - return (effect->dispatcher (effect, Vst2::effGetSpeakerArrangement, 0,
  2027. + return (effect->dispatchFunction (effect, Vst2::plugInOpcodeGetSpeakerArrangement, 0,
  2028. reinterpret_cast<pointer_sized_int> (&inArr), &outArr, 0.0f) != 0);
  2029. }
  2030. @@ -2333,57 +2331,57 @@ private:
  2031. if (currentPlayHead->getCurrentPosition (position))
  2032. {
  2033. - vstHostTime.samplePos = (double) position.timeInSamples;
  2034. - vstHostTime.tempo = position.bpm;
  2035. - vstHostTime.timeSigNumerator = position.timeSigNumerator;
  2036. - vstHostTime.timeSigDenominator = position.timeSigDenominator;
  2037. - vstHostTime.ppqPos = position.ppqPosition;
  2038. - vstHostTime.barStartPos = position.ppqPositionOfLastBarStart;
  2039. - vstHostTime.flags |= Vst2::kVstTempoValid
  2040. - | Vst2::kVstTimeSigValid
  2041. - | Vst2::kVstPpqPosValid
  2042. - | Vst2::kVstBarsValid;
  2043. + vstHostTime.samplePosition = (double) position.timeInSamples;
  2044. + vstHostTime.tempoBPM = position.bpm;
  2045. + vstHostTime.timeSignatureNumerator = position.timeSigNumerator;
  2046. + vstHostTime.timeSignatureDenominator = position.timeSigDenominator;
  2047. + vstHostTime.musicalPosition = position.ppqPosition;
  2048. + vstHostTime.lastBarPosition = position.ppqPositionOfLastBarStart;
  2049. + vstHostTime.flags |= Vst2::vstTimingInfoFlagTempoValid
  2050. + | Vst2::vstTimingInfoFlagTimeSignatureValid
  2051. + | Vst2::vstTimingInfoFlagMusicalPositionValid
  2052. + | Vst2::vstTimingInfoFlagLastBarPositionValid;
  2053. int32 newTransportFlags = 0;
  2054. - if (position.isPlaying) newTransportFlags |= Vst2::kVstTransportPlaying;
  2055. - if (position.isRecording) newTransportFlags |= Vst2::kVstTransportRecording;
  2056. + if (position.isPlaying) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyPlaying;
  2057. + if (position.isRecording) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyRecording;
  2058. - if (newTransportFlags != (vstHostTime.flags & (Vst2::kVstTransportPlaying
  2059. - | Vst2::kVstTransportRecording)))
  2060. - vstHostTime.flags = (vstHostTime.flags & ~(Vst2::kVstTransportPlaying | Vst2::kVstTransportRecording)) | newTransportFlags | Vst2::kVstTransportChanged;
  2061. + if (newTransportFlags != (vstHostTime.flags & (Vst2::vstTimingInfoFlagCurrentlyPlaying
  2062. + | Vst2::vstTimingInfoFlagCurrentlyRecording)))
  2063. + vstHostTime.flags = (vstHostTime.flags & ~(Vst2::vstTimingInfoFlagCurrentlyPlaying | Vst2::vstTimingInfoFlagCurrentlyRecording)) | newTransportFlags | Vst2::vstTimingInfoFlagTransportChanged;
  2064. else
  2065. - vstHostTime.flags &= ~Vst2::kVstTransportChanged;
  2066. + vstHostTime.flags &= ~Vst2::vstTimingInfoFlagTransportChanged;
  2067. switch (position.frameRate)
  2068. {
  2069. - case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::kVstSmpte24fps, 24.0, position.timeInSeconds); break;
  2070. - case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::kVstSmpte25fps, 25.0, position.timeInSeconds); break;
  2071. - case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::kVstSmpte30fps, 30.0, position.timeInSeconds); break;
  2072. - case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::kVstSmpte60fps, 60.0, position.timeInSeconds); break;
  2073. -
  2074. - case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::kVstSmpte239fps, 24.0, position.timeInSeconds); break;
  2075. - case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997fps, 30.0, position.timeInSeconds); break;
  2076. - case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997dfps, 30.0, position.timeInSeconds); break;
  2077. - case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte30dfps, 30.0, position.timeInSeconds); break;
  2078. - case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte599fps, 60.0, position.timeInSeconds); break;
  2079. + case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::vstSmpteRateFps24, 24.0, position.timeInSeconds); break;
  2080. + case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::vstSmpteRateFps25, 25.0, position.timeInSeconds); break;
  2081. + case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::vstSmpteRateFps30, 30.0, position.timeInSeconds); break;
  2082. + case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::vstSmpteRateFps60, 60.0, position.timeInSeconds); break;
  2083. +
  2084. + case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps239, 24.0, position.timeInSeconds); break;
  2085. + case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997, 30.0, position.timeInSeconds); break;
  2086. + case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997drop, 30.0, position.timeInSeconds); break;
  2087. + case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps30drop, 30.0, position.timeInSeconds); break;
  2088. + case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps599, 60.0, position.timeInSeconds); break;
  2089. case AudioPlayHead::fpsUnknown:
  2090. default: break;
  2091. }
  2092. if (position.isLooping)
  2093. {
  2094. - vstHostTime.cycleStartPos = position.ppqLoopStart;
  2095. - vstHostTime.cycleEndPos = position.ppqLoopEnd;
  2096. - vstHostTime.flags |= (Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive);
  2097. + vstHostTime.loopStartPosition = position.ppqLoopStart;
  2098. + vstHostTime.loopEndPosition = position.ppqLoopEnd;
  2099. + vstHostTime.flags |= (Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive);
  2100. }
  2101. else
  2102. {
  2103. - vstHostTime.flags &= ~(Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive);
  2104. + vstHostTime.flags &= ~(Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive);
  2105. }
  2106. }
  2107. }
  2108. - vstHostTime.nanoSeconds = getVSTHostTimeNanoseconds();
  2109. + vstHostTime.systemTimeNanoseconds = getVSTHostTimeNanoseconds();
  2110. if (wantsMidiMessages)
  2111. {
  2112. @@ -2394,13 +2392,13 @@ private:
  2113. midiEventsToSend.addEvent (metadata.data, metadata.numBytes,
  2114. jlimit (0, numSamples - 1, metadata.samplePosition));
  2115. - vstEffect->dispatcher (vstEffect, Vst2::effProcessEvents, 0, 0, midiEventsToSend.events, 0);
  2116. + vstEffect->dispatchFunction (vstEffect, Vst2::plugInOpcodePreAudioProcessingEvents, 0, 0, midiEventsToSend.events, 0);
  2117. }
  2118. _clearfp();
  2119. // always ensure that the buffer is at least as large as the maximum number of channels
  2120. - auto maxChannels = jmax (vstEffect->numInputs, vstEffect->numOutputs);
  2121. + auto maxChannels = jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels);
  2122. auto channels = channelBuffer.get();
  2123. if (numChannels < maxChannels)
  2124. @@ -2439,35 +2437,35 @@ private:
  2125. //==============================================================================
  2126. inline void invokeProcessFunction (AudioBuffer<float>& buffer, int32 sampleFrames)
  2127. {
  2128. - if ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0)
  2129. + if ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0)
  2130. {
  2131. - vstEffect->processReplacing (vstEffect, buffer.getArrayOfWritePointers(),
  2132. + vstEffect->processAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(),
  2133. buffer.getArrayOfWritePointers(), sampleFrames);
  2134. }
  2135. else
  2136. {
  2137. - outOfPlaceBuffer.setSize (vstEffect->numOutputs, sampleFrames);
  2138. + outOfPlaceBuffer.setSize (vstEffect->numOutputChannels, sampleFrames);
  2139. outOfPlaceBuffer.clear();
  2140. - vstEffect->process (vstEffect, buffer.getArrayOfWritePointers(),
  2141. - outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames);
  2142. + vstEffect->processAudioFunction (vstEffect, buffer.getArrayOfWritePointers(),
  2143. + outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames);
  2144. - for (int i = vstEffect->numOutputs; --i >= 0;)
  2145. + for (int i = vstEffect->numOutputChannels; --i >= 0;)
  2146. buffer.copyFrom (i, 0, outOfPlaceBuffer.getReadPointer (i), sampleFrames);
  2147. }
  2148. }
  2149. inline void invokeProcessFunction (AudioBuffer<double>& buffer, int32 sampleFrames)
  2150. {
  2151. - vstEffect->processDoubleReplacing (vstEffect, buffer.getArrayOfWritePointers(),
  2152. + vstEffect->processDoubleAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(),
  2153. buffer.getArrayOfWritePointers(), sampleFrames);
  2154. }
  2155. //==============================================================================
  2156. void setHostTimeFrameRate (long frameRateIndex, double frameRate, double currentTime) noexcept
  2157. {
  2158. - vstHostTime.flags |= Vst2::kVstSmpteValid;
  2159. - vstHostTime.smpteFrameRate = (int32) frameRateIndex;
  2160. + vstHostTime.flags |= Vst2::vstTimingInfoFlagSmpteValid;
  2161. + vstHostTime.smpteRate = (int32) frameRateIndex;
  2162. vstHostTime.smpteOffset = (int32) (currentTime * 80.0 * frameRate + 0.5);
  2163. }
  2164. @@ -2498,7 +2496,7 @@ private:
  2165. if (vstEffect == nullptr)
  2166. return {};
  2167. - jassert (index >= 0 && index < vstEffect->numParams);
  2168. + jassert (index >= 0 && index < vstEffect->numParameters);
  2169. char nm[256] = { 0 };
  2170. dispatch (opcode, index, 0, nm, 0);
  2171. return String::createStringFromData (nm, (int) sizeof (nm)).trim();
  2172. @@ -2512,7 +2510,7 @@ private:
  2173. {
  2174. {
  2175. char nm[256] = { 0 };
  2176. - dispatch (Vst2::effGetProgramName, 0, 0, nm, 0);
  2177. + dispatch (Vst2::plugInOpcodeGetCurrentProgramName, 0, 0, nm, 0);
  2178. progName = String::createStringFromData (nm, (int) sizeof (nm)).trim();
  2179. }
  2180. @@ -2556,7 +2554,7 @@ private:
  2181. char nm[256] = { 0 };
  2182. // only do this if the plugin can't use indexed names..
  2183. - if (dispatch (Vst2::effGetProgramNameIndexed, 0, -1, nm, 0) == 0)
  2184. + if (dispatch (Vst2::plugInOpcodeGetProgramName, 0, -1, nm, 0) == 0)
  2185. {
  2186. auto oldProgram = getCurrentProgram();
  2187. MemoryBlock oldSettings;
  2188. @@ -2574,7 +2572,7 @@ private:
  2189. }
  2190. }
  2191. - void handleMidiFromPlugin (const Vst2::VstEvents* events)
  2192. + void handleMidiFromPlugin (const Vst2::VstEventBlock* events)
  2193. {
  2194. if (events != nullptr)
  2195. {
  2196. @@ -2621,11 +2619,11 @@ private:
  2197. }
  2198. //==============================================================================
  2199. - int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->version : 0; }
  2200. + int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->plugInVersion : 0; }
  2201. String getVersion() const
  2202. {
  2203. - auto v = (unsigned int) dispatch (Vst2::effGetVendorVersion, 0, 0, nullptr, 0);
  2204. + auto v = (unsigned int) dispatch (Vst2::plugInOpcodeGetManufacturerVersion, 0, 0, nullptr, 0);
  2205. String s;
  2206. @@ -2693,7 +2691,6 @@ private:
  2207. case Vst2::kPlugCategOfflineProcess: return "Offline Process";
  2208. case Vst2::kPlugCategShell: return "Shell";
  2209. case Vst2::kPlugCategUnknown: return "Unknown";
  2210. - case Vst2::kPlugCategMaxCount:
  2211. default: break;
  2212. }
  2213. @@ -2702,7 +2699,7 @@ private:
  2214. void setPower (const bool on)
  2215. {
  2216. - dispatch (Vst2::effMainsChanged, 0, on ? 1 : 0, nullptr, 0);
  2217. + dispatch (Vst2::plugInOpcodeResumeSuspend, 0, on ? 1 : 0, nullptr, 0);
  2218. isPowerOn = on;
  2219. }
  2220. @@ -2769,11 +2766,11 @@ public:
  2221. activeVSTWindows.add (this);
  2222. - Vst2::ERect* rect = nullptr;
  2223. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2224. + Vst2::VstEditorBounds* rect = nullptr;
  2225. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2226. if (rect != nullptr)
  2227. - setSize (rect->right - rect->left, rect->bottom - rect->top);
  2228. + setSize (rect->rightmost - rect->leftmost, rect->lower - rect->upper);
  2229. else
  2230. setSize (1, 1);
  2231. @@ -2943,7 +2940,7 @@ public:
  2232. nativeScaleFactor = (float) newScaleFactor;
  2233. if (pluginRespondsToDPIChanges)
  2234. - dispatch (Vst2::effVendorSpecific,
  2235. + dispatch (Vst2::plugInOpcodeManufacturerSpecific,
  2236. (int) ByteOrder::bigEndianInt ("PreS"),
  2237. (int) ByteOrder::bigEndianInt ("AeCs"),
  2238. nullptr, nativeScaleFactor);
  2239. @@ -2972,7 +2969,7 @@ public:
  2240. if (! reentrantGuard)
  2241. {
  2242. reentrantGuard = true;
  2243. - plugin.dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0);
  2244. + plugin.dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0);
  2245. reentrantGuard = false;
  2246. }
  2247. @@ -3004,7 +3001,7 @@ public:
  2248. activeVSTWindows.add (this);
  2249. #if JUCE_MAC
  2250. - dispatch (Vst2::effEditTop, 0, 0, nullptr, 0);
  2251. + dispatch (Vst2::plugInOpcodeeffEditorTop, 0, 0, nullptr, 0);
  2252. #endif
  2253. }
  2254. @@ -3034,24 +3031,24 @@ private:
  2255. isOpen = true;
  2256. - Vst2::ERect* rect = nullptr;
  2257. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2258. - dispatch (Vst2::effEditOpen, 0, 0, parentWindow, 0);
  2259. + Vst2::VstEditorBounds* rect = nullptr;
  2260. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2261. + dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, parentWindow, 0);
  2262. // do this before and after like in the steinberg example
  2263. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2264. - dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code
  2265. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2266. + dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code
  2267. // Install keyboard hooks
  2268. - pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0);
  2269. + pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0);
  2270. // double-check it's not too tiny
  2271. int w = 250, h = 150;
  2272. if (rect != nullptr)
  2273. {
  2274. - w = rect->right - rect->left;
  2275. - h = rect->bottom - rect->top;
  2276. + w = rect->rightmost - rect->leftmost;
  2277. + h = rect->lower - rect->upper;
  2278. if (w == 0 || h == 0)
  2279. {
  2280. @@ -3082,14 +3079,14 @@ private:
  2281. if (auto* peer = getTopLevelComponent()->getPeer())
  2282. setScaleFactorAndDispatchMessage (peer->getPlatformScaleFactor());
  2283. - Vst2::ERect* rect = nullptr;
  2284. + Vst2::VstEditorBounds* rect = nullptr;
  2285. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2286. - dispatch (Vst2::effEditOpen, 0, 0, getWindowHandle(), 0);
  2287. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); // do this before and after like in the steinberg example
  2288. - dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code
  2289. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2290. + dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, getWindowHandle(), 0);
  2291. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); // do this before and after like in the steinberg example
  2292. + dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code
  2293. - pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0);
  2294. + pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0);
  2295. #if JUCE_WINDOWS
  2296. originalWndProc = 0;
  2297. @@ -3119,8 +3116,8 @@ private:
  2298. if (rect != nullptr)
  2299. {
  2300. - auto rw = rect->right - rect->left;
  2301. - auto rh = rect->bottom - rect->top;
  2302. + auto rw = rect->rightmost - rect->leftmost;
  2303. + auto rh = rect->lower - rect->upper;
  2304. if ((rw > 50 && rh > 50 && rw < 2000 && rh < 2000 && (! isWithin (w, rw, 2) || ! isWithin (h, rh, 2)))
  2305. || ((w == 0 && rw > 0) || (h == 0 && rh > 0)))
  2306. @@ -3153,8 +3150,8 @@ private:
  2307. if (rect != nullptr)
  2308. {
  2309. - w = rect->right - rect->left;
  2310. - h = rect->bottom - rect->top;
  2311. + w = rect->rightmost - rect->leftmost;
  2312. + h = rect->lower - rect->upper;
  2313. if (w == 0 || h == 0)
  2314. {
  2315. @@ -3203,7 +3200,7 @@ private:
  2316. JUCE_VST_LOG ("Closing VST UI: " + plugin.getName());
  2317. isOpen = false;
  2318. - dispatch (Vst2::effEditClose, 0, 0, nullptr, 0);
  2319. + dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, nullptr, 0);
  2320. stopTimer();
  2321. #if JUCE_WINDOWS
  2322. @@ -3246,11 +3243,11 @@ private:
  2323. {
  2324. if (! pluginRespondsToDPIChanges)
  2325. {
  2326. - Vst2::ERect* rect = nullptr;
  2327. - dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2328. + Vst2::VstEditorBounds* rect = nullptr;
  2329. + dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2330. - auto w = roundToInt ((rect->right - rect->left) / nativeScaleFactor);
  2331. - auto h = roundToInt ((rect->bottom - rect->top) / nativeScaleFactor);
  2332. + auto w = roundToInt ((rect->rightmost - rect->leftmost) / nativeScaleFactor);
  2333. + auto h = roundToInt ((rect->lower - rect->upper) / nativeScaleFactor);
  2334. if (! isWindowSizeCorrectForPlugin (w, h))
  2335. {
  2336. @@ -3329,17 +3326,17 @@ private:
  2337. if (owner.isOpen)
  2338. {
  2339. owner.isOpen = false;
  2340. - owner.dispatch (Vst2::effEditClose, 0, 0, 0, 0);
  2341. - owner.dispatch (Vst2::effEditSleep, 0, 0, 0, 0);
  2342. + owner.dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, 0, 0);
  2343. + owner.dispatch (Vst2::plugInOpcodeSleepEditor, 0, 0, 0, 0);
  2344. }
  2345. }
  2346. bool getEmbeddedViewSize (int& w, int& h) override
  2347. {
  2348. - Vst2::ERect* rect = nullptr;
  2349. - owner.dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0);
  2350. - w = rect->right - rect->left;
  2351. - h = rect->bottom - rect->top;
  2352. + Vst2::VstEditorBounds* rect = nullptr;
  2353. + owner.dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0);
  2354. + w = rect->rightmost - rect->leftmost;
  2355. + h = rect->lower - rect->upper;
  2356. return true;
  2357. }
  2358. @@ -3349,7 +3346,7 @@ private:
  2359. {
  2360. alreadyInside = true;
  2361. getTopLevelComponent()->toFront (true);
  2362. - owner.dispatch (Vst2::effEditMouse, x, y, 0, 0);
  2363. + owner.dispatch (Vst2::plugInOpcodeGetMouse, x, y, 0, 0);
  2364. alreadyInside = false;
  2365. }
  2366. else
  2367. @@ -3363,13 +3360,13 @@ private:
  2368. if (auto* peer = getPeer())
  2369. {
  2370. auto pos = peer->globalToLocal (getScreenPosition());
  2371. - Vst2::ERect r;
  2372. - r.left = (int16) pos.getX();
  2373. - r.top = (int16) pos.getY();
  2374. - r.right = (int16) (r.left + getWidth());
  2375. - r.bottom = (int16) (r.top + getHeight());
  2376. + Vst2::VstEditorBounds r;
  2377. + r.leftmost = (int16) pos.getX();
  2378. + r.upper = (int16) pos.getY();
  2379. + r.rightmost = (int16) (r.leftmost + getWidth());
  2380. + r.lower = (int16) (r.upper + getHeight());
  2381. - owner.dispatch (Vst2::effEditDraw, 0, 0, &r, 0);
  2382. + owner.dispatch (Vst2::plugInOpcodeDrawEditor, 0, 0, &r, 0);
  2383. }
  2384. }
  2385. @@ -3436,10 +3433,10 @@ AudioProcessorEditor* VSTPluginInstance::createEditor()
  2386. //==============================================================================
  2387. // entry point for all callbacks from the plugin
  2388. -static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt)
  2389. +static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt)
  2390. {
  2391. if (effect != nullptr)
  2392. - if (auto* instance = (VSTPluginInstance*) (effect->resvd2))
  2393. + if (auto* instance = (VSTPluginInstance*) (effect->hostSpace2))
  2394. return instance->handleCallback (opcode, index, value, ptr, opt);
  2395. return VSTPluginInstance::handleGeneralCallback (opcode, index, value, ptr, opt);
  2396. @@ -3490,7 +3487,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& result
  2397. // Normal plugin...
  2398. results.add (new PluginDescription (desc));
  2399. - instance->dispatch (Vst2::effOpen, 0, 0, nullptr, 0);
  2400. + instance->dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0);
  2401. }
  2402. else
  2403. {
  2404. @@ -3498,7 +3495,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& result
  2405. for (;;)
  2406. {
  2407. char shellEffectName [256] = { 0 };
  2408. - auto uid = (int) instance->dispatch (Vst2::effShellGetNextPlugin, 0, 0, shellEffectName, 0);
  2409. + auto uid = (int) instance->dispatch (Vst2::plugInOpcodeNextPlugInUniqueID, 0, 0, shellEffectName, 0);
  2410. if (uid == 0)
  2411. break;
  2412. @@ -3721,8 +3718,8 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct
  2413. AudioPluginInstance* VSTPluginFormat::getPluginInstanceFromVstEffectInterface (void* aEffect)
  2414. {
  2415. - if (auto* vstAEffect = reinterpret_cast<Vst2::AEffect*> (aEffect))
  2416. - if (auto* instanceVST = reinterpret_cast<VSTPluginInstance*> (vstAEffect->resvd2))
  2417. + if (auto* vstAEffect = reinterpret_cast<Vst2::VstEffectInterface*> (aEffect))
  2418. + if (auto* instanceVST = reinterpret_cast<VSTPluginInstance*> (vstAEffect->hostSpace2))
  2419. return dynamic_cast<AudioPluginInstance*> (instanceVST);
  2420. return nullptr;