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.

2840 lines
153KB

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