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.

2781 lines
152KB

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