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.

2992 lines
174KB

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