From eaa2a2d521e55c902e3e77dc81b05868cbf9021c Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 22 Jul 2020 22:40:59 +0100 Subject: [PATCH] Add patches folder from juce6 branch for juce-current Signed-off-by: falkTX --- libs/juce-current/patches/_haiku.patch | 205 ++ ...odevicemanager_prefer-jack-over-alsa.patch | 14 + .../audioprocessors_lv2-string-state.patch | 16 + .../patches/audioprocessors_lv2type.patch | 12 + .../audioprocessors_no-splash-screen.patch | 73 + ...audioprocessors_no-splash-screen_pt2.patch | 54 + .../patches/audioprocessors_nogui.patch | 145 + .../patches/childprocess_getpid.patch | 61 + .../dialogwindow_allow-native-titlebar.patch | 70 + .../patches/fix-for-temporary-windows.patch | 16 + .../patches/fix-linux-thread-priorities.patch | 16 + .../patches/fix-midi-message-constness.patch | 13 + .../patches/flac-assume-sse.patch | 80 + .../patches/juce_events-dispatch-public.patch | 20 + .../patches/juce_vst_interface.patch | 2991 ++++++++++++++++ libs/juce-current/patches/local-ladspa.patch | 13 + .../fix-distrho-juceplugin-includes.patch | 13 + .../maybe-not-needed/mingw-fixes.patch | 44 + .../maybe-not-needed/mingw-fixes_pt2.patch | 201 ++ .../mingw-fixes_temp-pt1.patch | 79 + .../maybe-not-needed/vst3-less-strict.patch | 14 + .../patches/mingw-fixes_pt1.patch | 14 + ...ux-native-dialog-without-modal-loops.patch | 37 + .../proper-posix-getExecutableFile.patch | 46 + .../osx-ui-processors-utils-separate.patch | 114 + .../patches/todo/juce_IIRFilterOld.cpp | 244 ++ .../patches/todo/juce_IIRFilterOld.h | 151 + .../patches/todo/juce_IIRFilterOld.patch | 24 + .../patches/use-mingw-std-threads.patch | 15 + .../patches/use-vfork+consistency.patch | 119 + .../patches/vst2-linux-fix-gui-init.patch | 13 + .../patches/vst2-linux-fix-scale-factor.patch | 76 + libs/juce-current/patches/vst2-support.patch | 3178 +++++++++++++++++ .../patches/vst2-support_pt2.patch | 47 + .../patches/vst3-linux-fix-scale-factor.patch | 53 + .../patches/vstwrapper-fixes.patch | 34 + 36 files changed, 8315 insertions(+) create mode 100644 libs/juce-current/patches/_haiku.patch create mode 100644 libs/juce-current/patches/audiodevicemanager_prefer-jack-over-alsa.patch create mode 100644 libs/juce-current/patches/audioprocessors_lv2-string-state.patch create mode 100644 libs/juce-current/patches/audioprocessors_lv2type.patch create mode 100644 libs/juce-current/patches/audioprocessors_no-splash-screen.patch create mode 100644 libs/juce-current/patches/audioprocessors_no-splash-screen_pt2.patch create mode 100644 libs/juce-current/patches/audioprocessors_nogui.patch create mode 100644 libs/juce-current/patches/childprocess_getpid.patch create mode 100644 libs/juce-current/patches/dialogwindow_allow-native-titlebar.patch create mode 100644 libs/juce-current/patches/fix-for-temporary-windows.patch create mode 100644 libs/juce-current/patches/fix-linux-thread-priorities.patch create mode 100644 libs/juce-current/patches/fix-midi-message-constness.patch create mode 100644 libs/juce-current/patches/flac-assume-sse.patch create mode 100644 libs/juce-current/patches/juce_events-dispatch-public.patch create mode 100644 libs/juce-current/patches/juce_vst_interface.patch create mode 100644 libs/juce-current/patches/local-ladspa.patch create mode 100644 libs/juce-current/patches/maybe-not-needed/fix-distrho-juceplugin-includes.patch create mode 100644 libs/juce-current/patches/maybe-not-needed/mingw-fixes.patch create mode 100644 libs/juce-current/patches/maybe-not-needed/mingw-fixes_pt2.patch create mode 100644 libs/juce-current/patches/maybe-not-needed/mingw-fixes_temp-pt1.patch create mode 100644 libs/juce-current/patches/maybe-not-needed/vst3-less-strict.patch create mode 100644 libs/juce-current/patches/mingw-fixes_pt1.patch create mode 100644 libs/juce-current/patches/no-linux-native-dialog-without-modal-loops.patch create mode 100644 libs/juce-current/patches/proper-posix-getExecutableFile.patch create mode 100644 libs/juce-current/patches/to-delete/osx-ui-processors-utils-separate.patch create mode 100644 libs/juce-current/patches/todo/juce_IIRFilterOld.cpp create mode 100644 libs/juce-current/patches/todo/juce_IIRFilterOld.h create mode 100644 libs/juce-current/patches/todo/juce_IIRFilterOld.patch create mode 100644 libs/juce-current/patches/use-mingw-std-threads.patch create mode 100644 libs/juce-current/patches/use-vfork+consistency.patch create mode 100644 libs/juce-current/patches/vst2-linux-fix-gui-init.patch create mode 100644 libs/juce-current/patches/vst2-linux-fix-scale-factor.patch create mode 100644 libs/juce-current/patches/vst2-support.patch create mode 100644 libs/juce-current/patches/vst2-support_pt2.patch create mode 100644 libs/juce-current/patches/vst3-linux-fix-scale-factor.patch create mode 100644 libs/juce-current/patches/vstwrapper-fixes.patch diff --git a/libs/juce-current/patches/_haiku.patch b/libs/juce-current/patches/_haiku.patch new file mode 100644 index 00000000..1ffccf0f --- /dev/null +++ b/libs/juce-current/patches/_haiku.patch @@ -0,0 +1,205 @@ +diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp +index c992d50..8cc0b36 100644 +--- a/modules/juce_core/juce_core.cpp ++++ b/modules/juce_core/juce_core.cpp +@@ -69,18 +69,16 @@ + #endif + + #else +- #if JUCE_LINUX || JUCE_ANDROID ++ #if JUCE_LINUX || JUCE_ANDROID || JUCE_HAIKU + #include + #include +- #include ++ #if ! JUCE_HAIKU ++ #include ++ #endif + #include + #include + #endif + +- #if JUCE_LINUX +- #include +- #endif +- + #include + #include + #include +@@ -90,8 +88,9 @@ + #include + #include + +- #if ! JUCE_ANDROID ++ #if JUCE_LINUX + #include ++ #include + #endif + #endif + +@@ -214,6 +213,10 @@ namespace juce + #include "native/juce_android_SystemStats.cpp" + #include "native/juce_android_Threads.cpp" + ++//============================================================================== ++#elif JUCE_HAIKU ++// TODO ++ + #endif + + #include "threads/juce_ChildProcess.cpp" +diff --git a/modules/juce_core/native/juce_BasicNativeHeaders.h b/modules/juce_core/native/juce_BasicNativeHeaders.h +index 55c0c8c..3bdb384 100644 +--- a/modules/juce_core/native/juce_BasicNativeHeaders.h ++++ b/modules/juce_core/native/juce_BasicNativeHeaders.h +@@ -212,6 +212,33 @@ + #include + #include + #include ++ ++//============================================================================== ++#elif JUCE_HAIKU ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include ++ #include + #endif + + // Need to clear various moronic redefinitions made by system headers.. +diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h +index 9823d25..a391a00 100644 +--- a/modules/juce_core/native/juce_posix_SharedCode.h ++++ b/modules/juce_core/native/juce_posix_SharedCode.h +@@ -142,7 +142,7 @@ void JUCE_CALLTYPE Thread::sleep (int millisecs) + + void JUCE_CALLTYPE Process::terminate() + { +- #if JUCE_ANDROID ++ #if JUCE_ANDROID || JUCE_HAIKU + _exit (EXIT_FAILURE); + #else + std::_Exit (EXIT_FAILURE); +@@ -203,6 +203,10 @@ namespace + #define JUCE_STAT stat + #endif + ++ #if JUCE_HAIKU ++ #define statfs statvfs ++ #endif ++ + bool juce_stat (const String& fileName, juce_statStruct& info) + { + return fileName.isNotEmpty() +@@ -542,7 +546,11 @@ void MemoryMappedFile::openInternal (const File& file, AccessMode mode) + if (m != MAP_FAILED) + { + address = m; +- madvise (m, (size_t) range.getLength(), MADV_SEQUENTIAL); ++ #if JUCE_HAIKU ++ posix_madvise (m, (size_t) range.getLength(), POSIX_MADV_SEQUENTIAL); ++ #else ++ madvise (m, (size_t) range.getLength(), MADV_SEQUENTIAL); ++ #endif + } + else + { +@@ -663,6 +671,10 @@ int File::getVolumeSerialNumber() const + return result; + } + ++#if JUCE_HAIKU ++ #undef statvfs ++#endif ++ + //============================================================================== + void juce_runSystemCommand (const String&); + void juce_runSystemCommand (const String& command) +diff --git a/modules/juce_core/network/juce_URL.cpp b/modules/juce_core/network/juce_URL.cpp +index 49db1f9..8b3afbd 100644 +--- a/modules/juce_core/network/juce_URL.cpp ++++ b/modules/juce_core/network/juce_URL.cpp +@@ -342,6 +342,7 @@ InputStream* URL::createInputStream (const bool usePostCommand, + if (! headers.endsWithChar ('\n')) + headers << "\r\n"; + ++ #if ! JUCE_HAIKU + ScopedPointer wi (new WebInputStream (toString (! usePostCommand), + usePostCommand, headersAndPostData, + progressCallback, progressCallbackContext, +@@ -351,6 +352,9 @@ InputStream* URL::createInputStream (const bool usePostCommand, + *statusCode = wi->statusCode; + + return wi->isError() ? nullptr : wi.release(); ++ #else ++ return nullptr; // TODO ++ #endif + } + + //============================================================================== +diff --git a/modules/juce_core/system/juce_SystemStats.cpp b/modules/juce_core/system/juce_SystemStats.cpp +index 365e94d..6b56569 100644 +--- a/modules/juce_core/system/juce_SystemStats.cpp ++++ b/modules/juce_core/system/juce_SystemStats.cpp +@@ -97,7 +97,7 @@ String SystemStats::getStackBacktrace() + { + String result; + +- #if JUCE_ANDROID || JUCE_MINGW ++ #if JUCE_ANDROID || JUCE_MINGW || JUCE_HAIKU + jassertfalse; // sorry, not implemented yet! + + #elif JUCE_WINDOWS +diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h +index 86adc38..0d12d7d 100644 +--- a/modules/juce_core/system/juce_TargetPlatform.h ++++ b/modules/juce_core/system/juce_TargetPlatform.h +@@ -51,6 +51,8 @@ + #define JUCE_ANDROID 1 + #elif defined (LINUX) || defined (__linux__) + #define JUCE_LINUX 1 ++#elif defined (__HAIKU__) ++ #define JUCE_HAIKU 1 + #elif defined (__APPLE_CPP__) || defined(__APPLE_CC__) + #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers) + #define Component CarbonDummyCompName +@@ -140,7 +142,7 @@ + #endif + + //============================================================================== +-#if JUCE_LINUX || JUCE_ANDROID ++#if JUCE_LINUX || JUCE_ANDROID || JUCE_HAIKU + + #ifdef _DEBUG + #define JUCE_DEBUG 1 +diff --git a/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp b/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp +index ece2121..7b1fa73 100644 +--- a/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp ++++ b/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp +@@ -82,7 +82,7 @@ File PropertiesFile::Options::getDefaultFile() const + if (folderName.isNotEmpty()) + dir = dir.getChildFile (folderName); + +- #elif JUCE_LINUX || JUCE_ANDROID ++ #elif JUCE_LINUX || JUCE_ANDROID || JUCE_HAIKU + const File dir (File (commonToAllUsers ? "/var" : "~") + .getChildFile (folderName.isNotEmpty() ? folderName + : ("." + applicationName))); diff --git a/libs/juce-current/patches/audiodevicemanager_prefer-jack-over-alsa.patch b/libs/juce-current/patches/audiodevicemanager_prefer-jack-over-alsa.patch new file mode 100644 index 00000000..45bc72a3 --- /dev/null +++ b/libs/juce-current/patches/audiodevicemanager_prefer-jack-over-alsa.patch @@ -0,0 +1,14 @@ +diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +index 823a1b209..eff47377b 100644 +--- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp ++++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +@@ -184,8 +184,8 @@ void AudioDeviceManager::createAudioDeviceTypes (OwnedArray& + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_CoreAudio()); + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_iOSAudio()); + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Bela()); +- addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_ALSA()); + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_JACK()); ++ addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_ALSA()); + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Oboe()); + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_OpenSLES()); + addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Android()); diff --git a/libs/juce-current/patches/audioprocessors_lv2-string-state.patch b/libs/juce-current/patches/audioprocessors_lv2-string-state.patch new file mode 100644 index 00000000..24172fd7 --- /dev/null +++ b/libs/juce-current/patches/audioprocessors_lv2-string-state.patch @@ -0,0 +1,16 @@ +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h +index 5e538d5e1..626c5d182 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h +@@ -1109,6 +1109,11 @@ public: + /** This method is called when the layout of the audio processor changes. */ + virtual void processorLayoutsChanged(); + ++ //============================================================================== ++ /** LV2 specific calls, saving/restore as string. */ ++ virtual String getStateInformationString () { return String(); } ++ virtual void setStateInformationString (const String&) {} ++ + //============================================================================== + /** Adds a listener that will be called when an aspect of this processor changes. */ + virtual void addListener (AudioProcessorListener* newListener); diff --git a/libs/juce-current/patches/audioprocessors_lv2type.patch b/libs/juce-current/patches/audioprocessors_lv2type.patch new file mode 100644 index 00000000..ff874762 --- /dev/null +++ b/libs/juce-current/patches/audioprocessors_lv2type.patch @@ -0,0 +1,12 @@ +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h +index 626c5d182..8d3cd062e 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h +@@ -1198,6 +1198,7 @@ public: + wrapperType_AudioUnitv3, + wrapperType_RTAS, + wrapperType_AAX, ++ wrapperType_LV2, + wrapperType_Standalone, + wrapperType_Unity + }; diff --git a/libs/juce-current/patches/audioprocessors_no-splash-screen.patch b/libs/juce-current/patches/audioprocessors_no-splash-screen.patch new file mode 100644 index 00000000..b3460a32 --- /dev/null +++ b/libs/juce-current/patches/audioprocessors_no-splash-screen.patch @@ -0,0 +1,73 @@ +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp +index b9df89ed9..1f40e3eaa 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp +@@ -33,8 +33,6 @@ AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* p) noexcept : proce + + AudioProcessorEditor::~AudioProcessorEditor() + { +- splashScreen.deleteAndZero(); +- + // if this fails, then the wrapper hasn't called editorBeingDeleted() on the + // filter for some reason.. + jassert (processor.getActiveEditor() != this); +@@ -49,23 +47,6 @@ void AudioProcessorEditor::hostMIDIControllerIsAvailable (bool) { + + void AudioProcessorEditor::initialise() + { +- /* +- ========================================================================== +- In accordance with the terms of the JUCE 5 End-Use License Agreement, the +- JUCE Code in SECTION A cannot be removed, changed or otherwise rendered +- ineffective unless you have a JUCE Indie or Pro license, or are using +- JUCE under the GPL v3 license. +- +- End User License Agreement: www.juce.com/juce-5-licence +- ========================================================================== +- */ +- +- // BEGIN SECTION A +- +- splashScreen = new JUCESplashScreen (*this); +- +- // END SECTION A +- + resizable = false; + + attachConstrainer (&defaultConstrainer); +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h +index 847707ea8..c33cbe73d 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h +@@ -199,7 +199,6 @@ private: + bool resizable; + ComponentBoundsConstrainer defaultConstrainer; + ComponentBoundsConstrainer* constrainer = {}; +- Component::SafePointer splashScreen; + AffineTransform hostScaleTransform; + + JUCE_DECLARE_NON_COPYABLE (AudioProcessorEditor) +diff --git a/modules/juce_gui_basics/juce_gui_basics.cpp b/modules/juce_gui_basics/juce_gui_basics.cpp +index 7c6273a54..ca0c5e227 100644 +--- a/modules/juce_gui_basics/juce_gui_basics.cpp ++++ b/modules/juce_gui_basics/juce_gui_basics.cpp +@@ -211,7 +211,6 @@ namespace juce + #include "application/juce_Application.cpp" + #include "misc/juce_BubbleComponent.cpp" + #include "misc/juce_DropShadower.cpp" +-#include "misc/juce_JUCESplashScreen.cpp" + + #include "layout/juce_FlexBox.cpp" + #include "layout/juce_GridItem.cpp" +diff --git a/modules/juce_gui_basics/juce_gui_basics.h b/modules/juce_gui_basics/juce_gui_basics.h +index 8085c6eae..038f679fd 100644 +--- a/modules/juce_gui_basics/juce_gui_basics.h ++++ b/modules/juce_gui_basics/juce_gui_basics.h +@@ -243,7 +243,6 @@ namespace juce + #include "menus/juce_BurgerMenuComponent.h" + #include "buttons/juce_ToolbarButton.h" + #include "misc/juce_DropShadower.h" +-#include "misc/juce_JUCESplashScreen.h" + #include "widgets/juce_TreeView.h" + #include "windows/juce_TopLevelWindow.h" + #include "windows/juce_AlertWindow.h" diff --git a/libs/juce-current/patches/audioprocessors_no-splash-screen_pt2.patch b/libs/juce-current/patches/audioprocessors_no-splash-screen_pt2.patch new file mode 100644 index 00000000..39f624c4 --- /dev/null +++ b/libs/juce-current/patches/audioprocessors_no-splash-screen_pt2.patch @@ -0,0 +1,54 @@ +diff --git a/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp b/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp +index 712e93f43..d4d8b7c14 100644 +--- a/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp ++++ b/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp +@@ -34,8 +34,6 @@ ResizableWindow::ResizableWindow (const String& name, Colour bkgnd, bool shouldA + + ResizableWindow::~ResizableWindow() + { +- splashScreen.deleteAndZero(); +- + // Don't delete or remove the resizer components yourself! They're managed by the + // ResizableWindow, and you should leave them alone! You may have deleted them + // accidentally by careless use of deleteAllChildren()..? +@@ -53,27 +51,6 @@ ResizableWindow::~ResizableWindow() + + void ResizableWindow::initialise (const bool shouldAddToDesktop) + { +- /* +- ========================================================================== +- +- In accordance with the terms of the JUCE 5 End-Use License Agreement, the +- JUCE Code in SECTION A cannot be removed, changed or otherwise rendered +- ineffective unless you have a JUCE Indie or Pro license, or are using +- JUCE under the GPL v3 license. +- +- End User License Agreement: www.juce.com/juce-5-licence +- +- ========================================================================== +- */ +- +- // BEGIN SECTION A +- +- #if ! JucePlugin_Build_Standalone +- splashScreen = new JUCESplashScreen (*this); +- #endif +- +- // END SECTION A +- + defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16); + + lastNonFullScreenPos.setBounds (50, 50, 256, 256); +diff --git a/modules/juce_gui_basics/windows/juce_ResizableWindow.h b/modules/juce_gui_basics/windows/juce_ResizableWindow.h +index 27c709cc6..01aeee19f 100644 +--- a/modules/juce_gui_basics/windows/juce_ResizableWindow.h ++++ b/modules/juce_gui_basics/windows/juce_ResizableWindow.h +@@ -376,7 +376,7 @@ protected: + + private: + //============================================================================== +- Component::SafePointer contentComponent, splashScreen; ++ Component::SafePointer contentComponent; + bool ownsContentComponent = false, resizeToFitContent = false, fullscreen = false, canDrag = true, dragStarted = false; + ComponentDragger dragger; + Rectangle lastNonFullScreenPos; diff --git a/libs/juce-current/patches/audioprocessors_nogui.patch b/libs/juce-current/patches/audioprocessors_nogui.patch new file mode 100644 index 00000000..c96c3afe --- /dev/null +++ b/libs/juce-current/patches/audioprocessors_nogui.patch @@ -0,0 +1,145 @@ +diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp +index c468c944c..133d1ad45 100644 +--- a/modules/juce_audio_processors/juce_audio_processors.cpp ++++ b/modules/juce_audio_processors/juce_audio_processors.cpp +@@ -40,7 +40,7 @@ + #endif + #endif + +-#if (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_VST3) && JUCE_LINUX ++#if (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_VST3) && JUCE_LINUX && ! JUCE_AUDIOPROCESSOR_NO_GUI + #include + #include + #include +@@ -130,9 +130,11 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations", "-Wcast-align" + #include "format_types/juce_LegacyAudioParameter.cpp" + #include "processors/juce_AudioProcessor.cpp" + #include "processors/juce_AudioPluginInstance.cpp" +-#include "processors/juce_AudioProcessorEditor.cpp" + #include "processors/juce_AudioProcessorGraph.cpp" +-#include "processors/juce_GenericAudioProcessorEditor.cpp" ++#if ! JUCE_AUDIOPROCESSOR_NO_GUI ++ #include "processors/juce_AudioProcessorEditor.cpp" ++ #include "processors/juce_GenericAudioProcessorEditor.cpp" ++#endif + #include "processors/juce_PluginDescription.cpp" + #include "format_types/juce_LADSPAPluginFormat.cpp" + #include "format_types/juce_VSTPluginFormat.cpp" +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +index d8efe0707..7c83196e9 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +@@ -44,12 +44,14 @@ AudioProcessor::AudioProcessor (const BusesProperties& ioConfig) + + AudioProcessor::~AudioProcessor() + { ++ #if ! JUCE_AUDIOPROCESSOR_NO_GUI + { + const ScopedLock sl (activeEditorLock); + + // ooh, nasty - the editor should have been deleted before its AudioProcessor. + jassert (activeEditor == nullptr); + } ++ #endif + + #if JUCE_DEBUG && ! JUCE_DISABLE_AUDIOPROCESSOR_BEGIN_END_GESTURE_CHECKING + // This will fail if you've called beginParameterChangeGesture() for one +@@ -797,6 +799,7 @@ void AudioProcessor::audioIOChanged (bool busNumberChanged, bool channelNumChang + processorLayoutsChanged(); + } + ++#if ! JUCE_AUDIOPROCESSOR_NO_GUI + //============================================================================== + void AudioProcessor::editorBeingDeleted (AudioProcessorEditor* const editor) noexcept + { +@@ -833,6 +836,7 @@ AudioProcessorEditor* AudioProcessor::createEditorIfNeeded() + + return ed; + } ++#endif + + //============================================================================== + void AudioProcessor::getCurrentProgramStateInformation (juce::MemoryBlock& destData) +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h +index 8d3cd062e..34a192dc5 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h +@@ -919,6 +919,7 @@ public: + */ + virtual void setNonRealtime (bool isNonRealtime) noexcept; + ++ #if ! JUCE_AUDIOPROCESSOR_NO_GUI + //============================================================================== + /** Creates the processor's GUI. + +@@ -968,6 +969,7 @@ public: + This may call createEditor() internally to create the component. + */ + AudioProcessorEditor* createEditorIfNeeded(); ++ #endif + + //============================================================================== + /** Returns the default number of steps for a parameter. +@@ -1184,9 +1186,11 @@ public: + + virtual CurveData getResponseCurve (CurveData::Type /*curveType*/) const { return {}; } + ++ #if ! JUCE_AUDIOPROCESSOR_NO_GUI + //============================================================================== + /** Not for public use - this is called before deleting an editor component. */ + void editorBeingDeleted (AudioProcessorEditor*) noexcept; ++ #endif + + /** Flags to indicate the type of plugin context in which a processor is being used. */ + enum WrapperType +@@ -1461,7 +1465,9 @@ private: + + //============================================================================== + Array listeners; ++ #if ! JUCE_AUDIOPROCESSOR_NO_GUI + Component::SafePointer activeEditor; ++ #endif + double currentSampleRate = 0; + int blockSize = 0, latencySamples = 0; + bool suspended = false; +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +index 7d2ac0047..dcdaea84d 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +@@ -1490,8 +1490,10 @@ bool AudioProcessorGraph::AudioGraphIOProcessor::producesMidi() const + bool AudioProcessorGraph::AudioGraphIOProcessor::isInput() const noexcept { return type == audioInputNode || type == midiInputNode; } + bool AudioProcessorGraph::AudioGraphIOProcessor::isOutput() const noexcept { return type == audioOutputNode || type == midiOutputNode; } + ++#if ! JUCE_AUDIOPROCESSOR_NO_GUI + bool AudioProcessorGraph::AudioGraphIOProcessor::hasEditor() const { return false; } + AudioProcessorEditor* AudioProcessorGraph::AudioGraphIOProcessor::createEditor() { return nullptr; } ++#endif + + int AudioProcessorGraph::AudioGraphIOProcessor::getNumPrograms() { return 0; } + int AudioProcessorGraph::AudioGraphIOProcessor::getCurrentProgram() { return 0; } +diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h +index 93b2d75a4..23d1670d4 100644 +--- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h ++++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.h +@@ -348,8 +348,10 @@ public: + bool acceptsMidi() const override; + bool producesMidi() const override; + ++ #if ! JUCE_AUDIOPROCESSOR_NO_GUI + bool hasEditor() const override; + AudioProcessorEditor* createEditor() override; ++ #endif + + int getNumPrograms() override; + int getCurrentProgram() override; +@@ -385,8 +387,10 @@ public: + bool acceptsMidi() const override; + bool producesMidi() const override; + ++ #if ! JUCE_AUDIOPROCESSOR_NO_GUI + bool hasEditor() const override { return false; } + AudioProcessorEditor* createEditor() override { return nullptr; } ++ #endif + int getNumPrograms() override { return 0; } + int getCurrentProgram() override { return 0; } + void setCurrentProgram (int) override { } diff --git a/libs/juce-current/patches/childprocess_getpid.patch b/libs/juce-current/patches/childprocess_getpid.patch new file mode 100644 index 00000000..7c42437a --- /dev/null +++ b/libs/juce-current/patches/childprocess_getpid.patch @@ -0,0 +1,61 @@ +diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h +index ea007b1..f6faa5b 100644 +--- a/modules/juce_core/native/juce_posix_SharedCode.h ++++ b/modules/juce_core/native/juce_posix_SharedCode.h +@@ -1234,6 +1234,11 @@ public: + return 0; + } + ++ int getPID() const noexcept ++ { ++ return childPID; ++ } ++ + int childPID = 0; + int pipeHandle = 0; + int exitCode = -1; +diff --git a/modules/juce_core/native/juce_win32_Threads.cpp b/modules/juce_core/native/juce_win32_Threads.cpp +index 68d891f..d38b733 100644 +--- a/modules/juce_core/native/juce_win32_Threads.cpp ++++ b/modules/juce_core/native/juce_win32_Threads.cpp +@@ -488,6 +488,11 @@ public: + return (uint32) exitCode; + } + ++ int getPID() const noexcept ++ { ++ return 0; ++ } ++ + bool ok; + + private: +diff --git a/modules/juce_core/threads/juce_ChildProcess.cpp b/modules/juce_core/threads/juce_ChildProcess.cpp +index 5648c5d..262882b 100644 +--- a/modules/juce_core/threads/juce_ChildProcess.cpp ++++ b/modules/juce_core/threads/juce_ChildProcess.cpp +@@ -75,6 +75,11 @@ String ChildProcess::readAllProcessOutput() + return result.toString(); + } + ++uint32 ChildProcess::getPID() const noexcept ++{ ++ return activeProcess != nullptr ? activeProcess->getPID() : 0; ++} ++ + //============================================================================== + #if JUCE_UNIT_TESTS + +diff --git a/modules/juce_core/threads/juce_ChildProcess.h b/modules/juce_core/threads/juce_ChildProcess.h +index b2bd0e1..cbc380d 100644 +--- a/modules/juce_core/threads/juce_ChildProcess.h ++++ b/modules/juce_core/threads/juce_ChildProcess.h +@@ -99,6 +99,8 @@ public: + */ + bool kill(); + ++ uint32 getPID() const noexcept; ++ + private: + //============================================================================== + class ActiveProcess; diff --git a/libs/juce-current/patches/dialogwindow_allow-native-titlebar.patch b/libs/juce-current/patches/dialogwindow_allow-native-titlebar.patch new file mode 100644 index 00000000..9979c722 --- /dev/null +++ b/libs/juce-current/patches/dialogwindow_allow-native-titlebar.patch @@ -0,0 +1,70 @@ +diff --git a/modules/juce_gui_basics/windows/juce_DialogWindow.cpp b/modules/juce_gui_basics/windows/juce_DialogWindow.cpp +index 2b2345cdb..30c611fa7 100644 +--- a/modules/juce_gui_basics/windows/juce_DialogWindow.cpp ++++ b/modules/juce_gui_basics/windows/juce_DialogWindow.cpp +@@ -124,7 +124,8 @@ void DialogWindow::showDialog (const String& dialogTitle, + Colour backgroundColour, + const bool escapeKeyTriggersCloseButton, + const bool resizable, +- const bool useBottomRightCornerResizer) ++ const bool useBottomRightCornerResizer, ++ const bool useNativeTitleBar) + { + LaunchOptions o; + o.dialogTitle = dialogTitle; +@@ -132,9 +133,9 @@ void DialogWindow::showDialog (const String& dialogTitle, + o.componentToCentreAround = componentToCentreAround; + o.dialogBackgroundColour = backgroundColour; + o.escapeKeyTriggersCloseButton = escapeKeyTriggersCloseButton; +- o.useNativeTitleBar = false; + o.resizable = resizable; + o.useBottomRightCornerResizer = useBottomRightCornerResizer; ++ o.useNativeTitleBar = useNativeTitleBar; + + o.launchAsync(); + } +@@ -146,7 +147,8 @@ int DialogWindow::showModalDialog (const String& dialogTitle, + Colour backgroundColour, + const bool escapeKeyTriggersCloseButton, + const bool resizable, +- const bool useBottomRightCornerResizer) ++ const bool useBottomRightCornerResizer, ++ const bool useNativeTitleBar) + { + LaunchOptions o; + o.dialogTitle = dialogTitle; +@@ -154,9 +156,9 @@ int DialogWindow::showModalDialog (const String& dialogTitle, + o.componentToCentreAround = componentToCentreAround; + o.dialogBackgroundColour = backgroundColour; + o.escapeKeyTriggersCloseButton = escapeKeyTriggersCloseButton; +- o.useNativeTitleBar = false; + o.resizable = resizable; + o.useBottomRightCornerResizer = useBottomRightCornerResizer; ++ o.useNativeTitleBar = useNativeTitleBar; + + return o.runModal(); + } +diff --git a/modules/juce_gui_basics/windows/juce_DialogWindow.h b/modules/juce_gui_basics/windows/juce_DialogWindow.h +index 231168d0c..8c9f32957 100644 +--- a/modules/juce_gui_basics/windows/juce_DialogWindow.h ++++ b/modules/juce_gui_basics/windows/juce_DialogWindow.h +@@ -186,7 +186,8 @@ public: + Colour backgroundColour, + bool escapeKeyTriggersCloseButton, + bool shouldBeResizable = false, +- bool useBottomRightCornerResizer = false); ++ bool useBottomRightCornerResizer = false, ++ bool useNativeTitleBar = false); + + #if JUCE_MODAL_LOOPS_PERMITTED || DOXYGEN + /** Easy way of quickly showing a dialog box containing a given component. +@@ -232,7 +233,8 @@ public: + Colour backgroundColour, + bool escapeKeyTriggersCloseButton, + bool shouldBeResizable = false, +- bool useBottomRightCornerResizer = false); ++ bool useBottomRightCornerResizer = false, ++ bool useNativeTitleBar = false); + #endif + + diff --git a/libs/juce-current/patches/fix-for-temporary-windows.patch b/libs/juce-current/patches/fix-for-temporary-windows.patch new file mode 100644 index 00000000..c9431a0c --- /dev/null +++ b/libs/juce-current/patches/fix-for-temporary-windows.patch @@ -0,0 +1,16 @@ +diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +index 6d23372d9..32e159cf6 100644 +--- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp ++++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +@@ -2542,8 +2542,9 @@ void XWindowSystem::setWindowType (::Window windowH, int styleFlags) const + + Atom netHints [2]; + +- if ((styleFlags & ComponentPeer::windowIsTemporary) != 0 +- || ((styleFlags & ComponentPeer::windowHasDropShadow) == 0 && Desktop::canUseSemiTransparentWindows())) ++ if (styleFlags & ComponentPeer::windowIsTemporary) ++ netHints [0] = XWindowSystemUtilities::Atoms::getIfExists (display, "_NET_WM_WINDOW_TYPE_TOOLTIP"); ++ else if ((styleFlags & ComponentPeer::windowHasDropShadow) == 0 && Desktop::canUseSemiTransparentWindows()) + netHints [0] = XWindowSystemUtilities::Atoms::getIfExists (display, "_NET_WM_WINDOW_TYPE_COMBO"); + else + netHints [0] = XWindowSystemUtilities::Atoms::getIfExists (display, "_NET_WM_WINDOW_TYPE_NORMAL"); diff --git a/libs/juce-current/patches/fix-linux-thread-priorities.patch b/libs/juce-current/patches/fix-linux-thread-priorities.patch new file mode 100644 index 00000000..299c13f5 --- /dev/null +++ b/libs/juce-current/patches/fix-linux-thread-priorities.patch @@ -0,0 +1,16 @@ +diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h +index fc04da66a..b83efeac8 100644 +--- a/modules/juce_core/native/juce_posix_SharedCode.h ++++ b/modules/juce_core/native/juce_posix_SharedCode.h +@@ -977,7 +977,11 @@ bool Thread::setThreadPriority (void* handle, int priority) + if (pthread_getschedparam ((pthread_t) handle, &policy, ¶m) != 0) + return false; + ++ #if JUCE_LINUX ++ policy = priority < 9 ? SCHED_OTHER : SCHED_RR; ++ #else + policy = priority == 0 ? SCHED_OTHER : SCHED_RR; ++ #endif + + const int minPriority = sched_get_priority_min (policy); + const int maxPriority = sched_get_priority_max (policy); diff --git a/libs/juce-current/patches/fix-midi-message-constness.patch b/libs/juce-current/patches/fix-midi-message-constness.patch new file mode 100644 index 00000000..c38c7fc4 --- /dev/null +++ b/libs/juce-current/patches/fix-midi-message-constness.patch @@ -0,0 +1,13 @@ +diff --git a/modules/juce_audio_basics/midi/juce_MidiMessage.h b/modules/juce_audio_basics/midi/juce_MidiMessage.h +index 5628c3ae9..207bb9a0b 100644 +--- a/modules/juce_audio_basics/midi/juce_MidiMessage.h ++++ b/modules/juce_audio_basics/midi/juce_MidiMessage.h +@@ -945,7 +945,7 @@ private: + #endif + + inline bool isHeapAllocated() const noexcept { return size > (int) sizeof (packedData); } +- inline uint8* getData() const noexcept { return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; } ++ inline uint8* getData() const noexcept { return isHeapAllocated() ? packedData.allocatedData : const_cast(packedData.asBytes); } + uint8* allocateSpace (int); + }; + diff --git a/libs/juce-current/patches/flac-assume-sse.patch b/libs/juce-current/patches/flac-assume-sse.patch new file mode 100644 index 00000000..5d43e3b7 --- /dev/null +++ b/libs/juce-current/patches/flac-assume-sse.patch @@ -0,0 +1,80 @@ +diff --git a/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c b/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c +index 4eac42e95..74d120e7d 100644 +--- a/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c ++++ b/modules/juce_audio_formats/codecs/flac/libFLAC/cpu.c +@@ -240,42 +240,7 @@ void FLAC__cpu_info(FLAC__CPUInfo *info) + disable_sse(info); + # endif + #elif defined(__linux__) +- int sse = 0; +- struct sigaction sigill_save; +- struct sigaction sigill_sse; +- sigill_sse.sa_sigaction = sigill_handler_sse_os; +- #ifdef __ANDROID__ +- sigemptyset (&sigill_sse.sa_mask); +- #else +- __sigemptyset(&sigill_sse.sa_mask); +- #endif +- sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ +- if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) +- { +- /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */ +- /* see sigill_handler_sse_os() for an explanation of the following: */ +- asm volatile ( +- "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */ +- "incl %0\n\t" /* SIGILL handler will jump over this */ +- /* landing zone */ +- "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */ +- "nop\n\t" +- "nop\n\t" +- "nop\n\t" +- "nop\n\t" +- "nop\n\t" +- "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */ +- "nop\n\t" +- "nop" /* SIGILL jump lands here if "inc" is 1 byte */ +- : "=r"(sse) +- : "0"(sse) +- ); +- +- sigaction(SIGILL, &sigill_save, NULL); +- } +- +- if(!sse) +- disable_sse(info); ++ int sse = 1; + #elif defined(_MSC_VER) + __try { + __asm { +@@ -287,30 +252,7 @@ void FLAC__cpu_info(FLAC__CPUInfo *info) + disable_sse(info); + } + #elif defined(__GNUC__) /* MinGW goes here */ +- int sse = 0; +- /* Based on the idea described in Agner Fog's manual "Optimizing subroutines in assembly language" */ +- /* In theory, not guaranteed to detect lack of OS SSE support on some future Intel CPUs, but in practice works (see the aforementioned manual) */ +- if (ia32_fxsr) { +- struct { +- FLAC__uint32 buff[128]; +- } __attribute__((aligned(16))) fxsr; +- FLAC__uint32 old_val, new_val; +- +- asm volatile ("fxsave %0" : "=m" (fxsr) : "m" (fxsr)); +- old_val = fxsr.buff[50]; +- fxsr.buff[50] ^= 0x0013c0de; /* change value in the buffer */ +- asm volatile ("fxrstor %0" : "=m" (fxsr) : "m" (fxsr)); /* try to change SSE register */ +- fxsr.buff[50] = old_val; /* restore old value in the buffer */ +- asm volatile ("fxsave %0 " : "=m" (fxsr) : "m" (fxsr)); /* old value will be overwritten if SSE register was changed */ +- new_val = fxsr.buff[50]; /* == old_val if FXRSTOR didn't change SSE register and (old_val ^ 0x0013c0de) otherwise */ +- fxsr.buff[50] = old_val; /* again restore old value in the buffer */ +- asm volatile ("fxrstor %0" : "=m" (fxsr) : "m" (fxsr)); /* restore old values of registers */ +- +- if ((old_val^new_val) == 0x0013c0de) +- sse = 1; +- } +- if(!sse) +- disable_sse(info); ++ int sse = 1; + #else + /* no way to test, disable to be safe */ + disable_sse(info); diff --git a/libs/juce-current/patches/juce_events-dispatch-public.patch b/libs/juce-current/patches/juce_events-dispatch-public.patch new file mode 100644 index 00000000..65470de0 --- /dev/null +++ b/libs/juce-current/patches/juce_events-dispatch-public.patch @@ -0,0 +1,20 @@ +diff --git a/modules/juce_events/messages/juce_MessageManager.h b/modules/juce_events/messages/juce_MessageManager.h +index 22b2d1895..e94d0ce5a 100644 +--- a/modules/juce_events/messages/juce_MessageManager.h ++++ b/modules/juce_events/messages/juce_MessageManager.h +@@ -316,6 +316,7 @@ public: + // Internal methods - do not use! + void deliverBroadcastMessage (const String&); + ~MessageManager() noexcept; ++ static bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); + #endif + + private: +@@ -338,7 +339,6 @@ private: + static void* exitModalLoopCallback (void*); + static void doPlatformSpecificInitialisation(); + static void doPlatformSpecificShutdown(); +- static bool dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages); + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MessageManager) + }; diff --git a/libs/juce-current/patches/juce_vst_interface.patch b/libs/juce-current/patches/juce_vst_interface.patch new file mode 100644 index 00000000..71ceab32 --- /dev/null +++ b/libs/juce-current/patches/juce_vst_interface.patch @@ -0,0 +1,2991 @@ +diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +index 7f63093..5ff628b 100644 +--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +@@ -95,14 +95,7 @@ + + namespace Vst2 + { +-// If the following files cannot be found then you are probably trying to build +-// a VST2 plug-in or a VST2-compatible VST3 plug-in. To do this you must have a +-// VST2 SDK in your header search paths or use the "VST (Legacy) SDK Folder" +-// field in the Projucer. The VST2 SDK can be obtained from the +-// vstsdk3610_11_06_2018_build_37 (or older) VST3 SDK or JUCE version 5.3.2. You +-// also need a VST2 license from Steinberg to distribute VST2 plug-ins. +-#include "pluginterfaces/vst2.x/aeffect.h" +-#include "pluginterfaces/vst2.x/aeffectx.h" ++#include "../../juce_audio_processors/format_types/juce_VSTInterface.h" + } + + JUCE_END_IGNORE_WARNINGS_MSVC +@@ -124,7 +117,6 @@ using namespace juce; + #pragma pack (push, 8) + #endif + +-#define JUCE_VSTINTERFACE_H_INCLUDED 1 + #define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1 + + #include "../utility/juce_IncludeModuleHeaders.h" +@@ -315,7 +307,7 @@ private: + + public: + //============================================================================== +- JuceVSTWrapper (Vst2::audioMasterCallback cb, AudioProcessor* af) ++ JuceVSTWrapper (Vst2::VstHostCallback cb, AudioProcessor* af) + : hostCallback (cb), + processor (af) + { +@@ -346,41 +338,41 @@ public: + juceParameters.update (*processor, false); + + memset (&vstEffect, 0, sizeof (vstEffect)); +- vstEffect.magic = 0x56737450 /* 'VstP' */; +- vstEffect.dispatcher = (Vst2::AEffectDispatcherProc) dispatcherCB; +- vstEffect.process = nullptr; +- vstEffect.setParameter = (Vst2::AEffectSetParameterProc) setParameterCB; +- vstEffect.getParameter = (Vst2::AEffectGetParameterProc) getParameterCB; ++ vstEffect.interfaceIdentifier = Vst2::juceVstInterfaceIdentifier; ++ vstEffect.dispatchFunction = dispatcherCB; ++ vstEffect.processAudioFunction = nullptr; ++ vstEffect.setParameterValueFunction = setParameterCB; ++ vstEffect.getParameterValueFunction = getParameterCB; + vstEffect.numPrograms = jmax (1, af->getNumPrograms()); +- vstEffect.numParams = juceParameters.getNumParameters(); +- vstEffect.numInputs = maxNumInChannels; +- vstEffect.numOutputs = maxNumOutChannels; +- vstEffect.initialDelay = processor->getLatencySamples(); +- vstEffect.object = this; +- vstEffect.uniqueID = JucePlugin_VSTUniqueID; ++ vstEffect.numParameters = juceParameters.getNumParameters(); ++ vstEffect.numInputChannels = maxNumInChannels; ++ vstEffect.numOutputChannels = maxNumOutChannels; ++ vstEffect.latency = processor->getLatencySamples(); ++ vstEffect.effectPointer = this; ++ vstEffect.plugInIdentifier = JucePlugin_VSTUniqueID; + + #ifdef JucePlugin_VSTChunkStructureVersion +- vstEffect.version = JucePlugin_VSTChunkStructureVersion; ++ vstEffect.plugInVersion = JucePlugin_VSTChunkStructureVersion; + #else +- vstEffect.version = JucePlugin_VersionCode; ++ vstEffect.plugInVersion = JucePlugin_VersionCode; + #endif + +- vstEffect.processReplacing = (Vst2::AEffectProcessProc) processReplacingCB; +- vstEffect.processDoubleReplacing = (Vst2::AEffectProcessDoubleProc) processDoubleReplacingCB; ++ vstEffect.processAudioInplaceFunction = processReplacingCB; ++ vstEffect.processDoubleAudioInplaceFunction = processDoubleReplacingCB; + +- vstEffect.flags |= Vst2::effFlagsHasEditor; ++ vstEffect.flags |= Vst2::vstEffectFlagHasEditor; + +- vstEffect.flags |= Vst2::effFlagsCanReplacing; ++ vstEffect.flags |= Vst2::vstEffectFlagInplaceAudio; + if (processor->supportsDoublePrecisionProcessing()) +- vstEffect.flags |= Vst2::effFlagsCanDoubleReplacing; ++ vstEffect.flags |= Vst2::vstEffectFlagInplaceDoubleAudio; + +- vstEffect.flags |= Vst2::effFlagsProgramChunks; ++ vstEffect.flags |= Vst2::vstEffectFlagDataInChunks; + + #if JucePlugin_IsSynth +- vstEffect.flags |= Vst2::effFlagsIsSynth; ++ vstEffect.flags |= Vst2::vstEffectFlagIsSynth; + #else + if (processor->getTailLengthSeconds() == 0.0) +- vstEffect.flags |= Vst2::effFlagsNoSoundInStop; ++ vstEffect.flags |= 512; + #endif + + activePlugins.add (this); +@@ -424,7 +416,7 @@ public: + } + } + +- Vst2::AEffect* getAEffect() noexcept { return &vstEffect; } ++ Vst2::VstEffectInterface* getAEffect() noexcept { return &vstEffect; } + + template + void internalProcessReplacing (FloatType** inputs, FloatType** outputs, +@@ -563,7 +555,7 @@ public: + + // Send VST events to the host. + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterProcessEvents, 0, 0, outgoingEvents.events, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodePreAudioProcessingEvents, 0, 0, outgoingEvents.events, 0); + #elif JUCE_DEBUG + /* This assertion is caused when you've added some events to the + midiMessages array in your processBlock() method, which usually means +@@ -592,7 +584,7 @@ public: + internalProcessReplacing (inputs, outputs, sampleFrames, floatTempBuffers); + } + +- static void processReplacingCB (Vst2::AEffect* vstInterface, float** inputs, float** outputs, int32 sampleFrames) ++ static void processReplacingCB (Vst2::VstEffectInterface* vstInterface, float** inputs, float** outputs, int32 sampleFrames) + { + getWrapper (vstInterface)->processReplacing (inputs, outputs, sampleFrames); + } +@@ -603,7 +595,7 @@ public: + internalProcessReplacing (inputs, outputs, sampleFrames, doubleTempBuffers); + } + +- static void processDoubleReplacingCB (Vst2::AEffect* vstInterface, double** inputs, double** outputs, int32 sampleFrames) ++ static void processDoubleReplacingCB (Vst2::VstEffectInterface* vstInterface, double** inputs, double** outputs, int32 sampleFrames) + { + getWrapper (vstInterface)->processDoubleReplacing (inputs, outputs, sampleFrames); + } +@@ -615,7 +607,7 @@ public: + { + isProcessing = true; + +- auto numInAndOutChannels = static_cast (vstEffect.numInputs + vstEffect.numOutputs); ++ auto numInAndOutChannels = static_cast (vstEffect.numInputChannels + vstEffect.numOutputChannels); + floatTempBuffers .channels.calloc (numInAndOutChannels); + doubleTempBuffers.channels.calloc (numInAndOutChannels); + +@@ -634,16 +626,16 @@ public: + midiEvents.ensureSize (2048); + midiEvents.clear(); + +- vstEffect.initialDelay = processor->getLatencySamples(); ++ vstEffect.latency = processor->getLatencySamples(); + + /** If this plug-in is a synth or it can receive midi events we need to tell the + host that we want midi. In the SDK this method is marked as deprecated, but + some hosts rely on this behaviour. + */ +- if (vstEffect.flags & Vst2::effFlagsIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) ++ if (vstEffect.flags & Vst2::vstEffectFlagIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) + { + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterWantMidi, 0, 1, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodePlugInWantsMidi, 0, 1, nullptr, 0); + } + + if (getHostType().isAbletonLive() +@@ -657,7 +649,7 @@ public: + hostCmd.commandSize = sizeof (int); + hostCmd.flags = AbletonLiveHostSpecific::KCantBeSuspended; + +- hostCallback (&vstEffect, Vst2::audioMasterVendorSpecific, 0, 0, &hostCmd, 0.0f); ++ hostCallback (&vstEffect, Vst2::hostOpcodeManufacturerSpecific, 0, 0, &hostCmd, 0.0f); + } + + #if JucePlugin_ProducesMidiOutput || JucePlugin_IsMidiEffect +@@ -684,28 +676,28 @@ public: + //============================================================================== + bool getCurrentPosition (AudioPlayHead::CurrentPositionInfo& info) override + { +- const Vst2::VstTimeInfo* ti = nullptr; ++ const Vst2::VstTimingInformation* ti = nullptr; + + if (hostCallback != nullptr) + { +- int32 flags = Vst2::kVstPpqPosValid | Vst2::kVstTempoValid +- | Vst2::kVstBarsValid | Vst2::kVstCyclePosValid +- | Vst2::kVstTimeSigValid | Vst2::kVstSmpteValid +- | Vst2::kVstClockValid; ++ int32 flags = Vst2::vstTimingInfoFlagMusicalPositionValid | Vst2::vstTimingInfoFlagTempoValid ++ | Vst2::vstTimingInfoFlagLastBarPositionValid | Vst2::vstTimingInfoFlagLoopPositionValid ++ | Vst2::vstTimingInfoFlagTimeSignatureValid | Vst2::vstTimingInfoFlagSmpteValid ++ | Vst2::vstTimingInfoFlagNearestClockValid; + +- auto result = hostCallback (&vstEffect, Vst2::audioMasterGetTime, 0, flags, nullptr, 0); +- ti = reinterpret_cast (result); ++ auto result = hostCallback (&vstEffect, Vst2::hostOpcodeGetTimingInfo, 0, flags, nullptr, 0); ++ ti = reinterpret_cast (result); + } + + if (ti == nullptr || ti->sampleRate <= 0) + return false; + +- info.bpm = (ti->flags & Vst2::kVstTempoValid) != 0 ? ti->tempo : 0.0; ++ info.bpm = (ti->flags & Vst2::vstTimingInfoFlagTempoValid) != 0 ? ti->tempoBPM : 0.0; + +- if ((ti->flags & Vst2::kVstTimeSigValid) != 0) ++ if ((ti->flags & Vst2::vstTimingInfoFlagTimeSignatureValid) != 0) + { +- info.timeSigNumerator = ti->timeSigNumerator; +- info.timeSigDenominator = ti->timeSigDenominator; ++ info.timeSigNumerator = ti->timeSignatureNumerator; ++ info.timeSigDenominator = ti->timeSignatureDenominator; + } + else + { +@@ -713,34 +705,34 @@ public: + info.timeSigDenominator = 4; + } + +- info.timeInSamples = (int64) (ti->samplePos + 0.5); +- info.timeInSeconds = ti->samplePos / ti->sampleRate; +- info.ppqPosition = (ti->flags & Vst2::kVstPpqPosValid) != 0 ? ti->ppqPos : 0.0; +- info.ppqPositionOfLastBarStart = (ti->flags & Vst2::kVstBarsValid) != 0 ? ti->barStartPos : 0.0; ++ info.timeInSamples = (int64) (ti->samplePosition + 0.5); ++ info.timeInSeconds = ti->samplePosition / ti->sampleRate; ++ info.ppqPosition = (ti->flags & Vst2::vstTimingInfoFlagMusicalPositionValid) != 0 ? ti->musicalPosition : 0.0; ++ info.ppqPositionOfLastBarStart = (ti->flags & Vst2::vstTimingInfoFlagLastBarPositionValid) != 0 ? ti->lastBarPosition : 0.0; + +- if ((ti->flags & Vst2::kVstSmpteValid) != 0) ++ if ((ti->flags & Vst2::vstTimingInfoFlagSmpteValid) != 0) + { + AudioPlayHead::FrameRateType rate = AudioPlayHead::fpsUnknown; + double fps = 1.0; + +- switch (ti->smpteFrameRate) ++ switch (ti->smpteRate) + { +- case Vst2::kVstSmpte239fps: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte24fps: rate = AudioPlayHead::fps24; fps = 24.0; break; +- case Vst2::kVstSmpte25fps: rate = AudioPlayHead::fps25; fps = 25.0; break; +- case Vst2::kVstSmpte2997fps: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte30fps: rate = AudioPlayHead::fps30; fps = 30.0; break; +- case Vst2::kVstSmpte2997dfps: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte30dfps: rate = AudioPlayHead::fps30drop; fps = 30.0; break; +- +- case Vst2::kVstSmpteFilm16mm: +- case Vst2::kVstSmpteFilm35mm: fps = 24.0; break; +- +- case Vst2::kVstSmpte249fps: fps = 25.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte599fps: fps = 60.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte60fps: fps = 60; break; +- +- default: jassertfalse; // unknown frame-rate.. ++ case Vst2::vstSmpteRateFps239: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps24: rate = AudioPlayHead::fps24; fps = 24.0; break; ++ case Vst2::vstSmpteRateFps25: rate = AudioPlayHead::fps25; fps = 25.0; break; ++ case Vst2::vstSmpteRateFps2997: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps30: rate = AudioPlayHead::fps30; fps = 30.0; break; ++ case Vst2::vstSmpteRateFps2997drop: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps30drop: rate = AudioPlayHead::fps30drop; fps = 30.0; break; ++ ++ case Vst2::vstSmpteRate16mmFilm: ++ case Vst2::vstSmpteRate35mmFilm: fps = 24.0; break; ++ ++ case Vst2::vstSmpteRateFps249: fps = 25.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps599: fps = 60.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps60: fps = 60; break; ++ ++ default: jassertfalse; // unknown frame-rate.. + } + + info.frameRate = rate; +@@ -752,14 +744,14 @@ public: + info.editOriginTime = 0; + } + +- info.isRecording = (ti->flags & Vst2::kVstTransportRecording) != 0; +- info.isPlaying = (ti->flags & (Vst2::kVstTransportRecording | Vst2::kVstTransportPlaying)) != 0; +- info.isLooping = (ti->flags & Vst2::kVstTransportCycleActive) != 0; ++ info.isRecording = (ti->flags & Vst2::vstTimingInfoFlagCurrentlyRecording) != 0; ++ info.isPlaying = (ti->flags & (Vst2::vstTimingInfoFlagCurrentlyRecording | Vst2::vstTimingInfoFlagCurrentlyPlaying)) != 0; ++ info.isLooping = (ti->flags & Vst2::vstTimingInfoFlagLoopActive) != 0; + +- if ((ti->flags & Vst2::kVstCyclePosValid) != 0) ++ if ((ti->flags & Vst2::vstTimingInfoFlagLoopPositionValid) != 0) + { +- info.ppqLoopStart = ti->cycleStartPos; +- info.ppqLoopEnd = ti->cycleEndPos; ++ info.ppqLoopStart = ti->loopStartPosition; ++ info.ppqLoopEnd = ti->loopEndPosition; + } + else + { +@@ -779,7 +771,7 @@ public: + return 0.0f; + } + +- static float getParameterCB (Vst2::AEffect* vstInterface, int32 index) ++ static float getParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index) + { + return getWrapper (vstInterface)->getParameter (index); + } +@@ -795,7 +787,7 @@ public: + } + } + +- static void setParameterCB (Vst2::AEffect* vstInterface, int32 index, float value) ++ static void setParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index, float value) + { + getWrapper (vstInterface)->setParameter (index, value); + } +@@ -809,19 +801,19 @@ public: + } + + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterAutomate, index, 0, nullptr, newValue); ++ hostCallback (&vstEffect, Vst2::hostOpcodeParameterChanged, index, 0, nullptr, newValue); + } + + void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int index) override + { + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterBeginEdit, index, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureBegin, index, 0, nullptr, 0); + } + + void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int index) override + { + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterEndEdit, index, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureEnd, index, 0, nullptr, 0); + } + + void parameterValueChanged (int, float newValue) override +@@ -834,7 +826,7 @@ public: + + void audioProcessorChanged (AudioProcessor*) override + { +- vstEffect.initialDelay = processor->getLatencySamples(); ++ vstEffect.latency = processor->getLatencySamples(); + triggerAsyncUpdate(); + } + +@@ -842,12 +834,12 @@ public: + { + if (hostCallback != nullptr) + { +- hostCallback (&vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, nullptr, 0); +- hostCallback (&vstEffect, Vst2::audioMasterIOChanged, 0, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeUpdateView, 0, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeIOModified, 0, 0, nullptr, 0); + } + } + +- bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const ++ bool getPinProperties (Vst2::VstPinInfo& properties, bool direction, int index) const + { + if (processor->isMidiEffect()) + return false; +@@ -856,9 +848,9 @@ public: + + // fill with default + properties.flags = 0; +- properties.label[0] = 0; +- properties.shortLabel[0] = 0; +- properties.arrangementType = Vst2::kSpeakerArrEmpty; ++ properties.text[0] = 0; ++ properties.shortText[0] = 0; ++ properties.configurationType = Vst2::vstSpeakerConfigTypeEmpty; + + if ((channelIdx = processor->getOffsetInBusBufferForAbsoluteChannelIndex (direction, index, busIdx)) >= 0) + { +@@ -866,8 +858,8 @@ public: + auto& channelSet = bus.getCurrentLayout(); + auto channelType = channelSet.getTypeOfChannel (channelIdx); + +- properties.flags = Vst2::kVstPinIsActive | Vst2::kVstPinUseSpeaker; +- properties.arrangementType = SpeakerMappings::channelSetToVstArrangementType (channelSet); ++ properties.flags = Vst2::vstPinInfoFlagIsActive | Vst2::vstPinInfoFlagValid; ++ properties.configurationType = SpeakerMappings::channelSetToVstArrangementType (channelSet); + String label = bus.getName(); + + #ifdef JucePlugin_PreferredChannelConfigurations +@@ -877,8 +869,8 @@ public: + label += " " + AudioChannelSet::getAbbreviatedChannelTypeName (channelType); + #endif + +- label.copyToUTF8 (properties.label, (size_t) (Vst2::kVstMaxLabelLen + 1)); +- label.copyToUTF8 (properties.shortLabel, (size_t) (Vst2::kVstMaxShortLabelLen + 1)); ++ label.copyToUTF8 (properties.text, (size_t) (Vst2::vstMaxParameterOrPinLabelLength + 1)); ++ label.copyToUTF8 (properties.shortText, (size_t) (Vst2::vstMaxParameterOrPinShortLabelLength + 1)); + + if (channelType == AudioChannelSet::left + || channelType == AudioChannelSet::leftSurround +@@ -888,7 +880,7 @@ public: + || channelType == AudioChannelSet::topRearLeft + || channelType == AudioChannelSet::leftSurroundRear + || channelType == AudioChannelSet::wideLeft) +- properties.flags |= Vst2::kVstPinIsStereo; ++ properties.flags |= Vst2::vstPinInfoFlagIsStereo; + + return true; + } +@@ -921,27 +913,27 @@ public: + } + }; + +- static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr) +- { +- if (arr.type == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled(); +- if (arr.type == Vst2::kSpeakerArrMono) return AudioChannelSet::mono(); +- if (arr.type == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo(); +- if (arr.type == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR(); +- if (arr.type == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS(); +- if (arr.type == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS(); +- if (arr.type == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0(); +- if (arr.type == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1(); +- if (arr.type == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0(); +- if (arr.type == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1(); +- if (arr.type == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music(); +- if (arr.type == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music(); +- if (arr.type == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0(); +- if (arr.type == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS(); +- if (arr.type == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1(); +- if (arr.type == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS(); +- if (arr.type == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic(); +- +- for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) ++ static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr) ++ { ++ if (arr.type == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS(); ++ if (arr.type == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic(); ++ ++ for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) + { + if (m->vst2 == arr.type) + { +@@ -954,51 +946,51 @@ public: + } + } + +- return AudioChannelSet::discreteChannels (arr.numChannels); ++ return AudioChannelSet::discreteChannels (arr.numberOfChannels); + } + + static int32 channelSetToVstArrangementType (AudioChannelSet channels) + { +- if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty; +- if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono; +- if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo; +- if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine; +- if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music; +- if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine; +- if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50; +- if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51; +- if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine; +- if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine; +- if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music; +- if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music; +- if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music; +- if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine; +- if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music; +- if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine; +- if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music; ++ if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty; ++ if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono; ++ if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR; ++ if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC; ++ if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS; ++ if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS; ++ if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs; ++ if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs; ++ if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs; ++ if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs; ++ if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr; ++ if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr; ++ if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr; ++ if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc; ++ if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr; ++ if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc; ++ if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs; + + if (channels == AudioChannelSet::disabled()) +- return Vst2::kSpeakerArrEmpty; ++ return Vst2::vstSpeakerConfigTypeEmpty; + + auto chans = channels.getChannelTypes(); + +- for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) ++ for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) + if (m->matches (chans)) + return m->vst2; + +- return Vst2::kSpeakerArrUserDefined; ++ return Vst2::vstSpeakerConfigTypeUser; + } + +- static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerArrangement& result) ++ static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerConfiguration& result) + { + result.type = channelSetToVstArrangementType (channels); +- result.numChannels = channels.size(); ++ result.numberOfChannels = channels.size(); + +- for (int i = 0; i < result.numChannels; ++i) ++ for (int i = 0; i < result.numberOfChannels; ++i) + { + auto& speaker = result.speakers[i]; + +- zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties)); ++ zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo)); + speaker.type = getSpeakerType (channels.getTypeOfChannel (i)); + } + } +@@ -1007,36 +999,36 @@ public: + { + static const Mapping mappings[] = + { +- { Vst2::kSpeakerArrMono, { centre, unknown } }, +- { Vst2::kSpeakerArrStereo, { left, right, unknown } }, +- { Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } }, +- { Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } }, +- { Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } }, +- { Vst2::kSpeakerArr30Music, { left, right, surround, unknown } }, +- { Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } }, +- { Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } }, +- { Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } }, +- { Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } }, +- { Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, +- { Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, +- { Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, +- { Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, +- { Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, +- { Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, +- { Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, +- { Vst2::kSpeakerArrEmpty, { unknown } } ++ { Vst2::vstSpeakerConfigTypeMono, { centre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, ++ { Vst2::vstSpeakerConfigTypeEmpty, { unknown } } + }; + + return mappings; +@@ -1046,25 +1038,25 @@ public: + { + switch (type) + { +- case AudioChannelSet::left: return Vst2::kSpeakerL; +- case AudioChannelSet::right: return Vst2::kSpeakerR; +- case AudioChannelSet::centre: return Vst2::kSpeakerC; +- case AudioChannelSet::LFE: return Vst2::kSpeakerLfe; +- case AudioChannelSet::leftSurround: return Vst2::kSpeakerLs; +- case AudioChannelSet::rightSurround: return Vst2::kSpeakerRs; +- case AudioChannelSet::leftCentre: return Vst2::kSpeakerLc; +- case AudioChannelSet::rightCentre: return Vst2::kSpeakerRc; +- case AudioChannelSet::surround: return Vst2::kSpeakerS; +- case AudioChannelSet::leftSurroundRear: return Vst2::kSpeakerSl; +- case AudioChannelSet::rightSurroundRear: return Vst2::kSpeakerSr; +- case AudioChannelSet::topMiddle: return Vst2::kSpeakerTm; +- case AudioChannelSet::topFrontLeft: return Vst2::kSpeakerTfl; +- case AudioChannelSet::topFrontCentre: return Vst2::kSpeakerTfc; +- case AudioChannelSet::topFrontRight: return Vst2::kSpeakerTfr; +- case AudioChannelSet::topRearLeft: return Vst2::kSpeakerTrl; +- case AudioChannelSet::topRearCentre: return Vst2::kSpeakerTrc; +- case AudioChannelSet::topRearRight: return Vst2::kSpeakerTrr; +- case AudioChannelSet::LFE2: return Vst2::kSpeakerLfe2; ++ case AudioChannelSet::left: return Vst2::vstIndividualSpeakerTypeLeft; ++ case AudioChannelSet::right: return Vst2::vstIndividualSpeakerTypeRight; ++ case AudioChannelSet::centre: return Vst2::vstIndividualSpeakerTypeCentre; ++ case AudioChannelSet::LFE: return Vst2::vstIndividualSpeakerTypeLFE; ++ case AudioChannelSet::leftSurround: return Vst2::vstIndividualSpeakerTypeLeftSurround; ++ case AudioChannelSet::rightSurround: return Vst2::vstIndividualSpeakerTypeRightSurround; ++ case AudioChannelSet::leftCentre: return Vst2::vstIndividualSpeakerTypeLeftCentre; ++ case AudioChannelSet::rightCentre: return Vst2::vstIndividualSpeakerTypeRightCentre; ++ case AudioChannelSet::surround: return Vst2::vstIndividualSpeakerTypeSurround; ++ case AudioChannelSet::leftSurroundRear: return Vst2::vstIndividualSpeakerTypeLeftRearSurround; ++ case AudioChannelSet::rightSurroundRear: return Vst2::vstIndividualSpeakerTypeRightRearSurround; ++ case AudioChannelSet::topMiddle: return Vst2::vstIndividualSpeakerTypeTopMiddle; ++ case AudioChannelSet::topFrontLeft: return Vst2::vstIndividualSpeakerTypeTopFrontLeft; ++ case AudioChannelSet::topFrontCentre: return Vst2::vstIndividualSpeakerTypeTopFrontCentre; ++ case AudioChannelSet::topFrontRight: return Vst2::vstIndividualSpeakerTypeTopFrontRight; ++ case AudioChannelSet::topRearLeft: return Vst2::vstIndividualSpeakerTypeTopRearLeft; ++ case AudioChannelSet::topRearCentre: return Vst2::vstIndividualSpeakerTypeTopRearCentre; ++ case AudioChannelSet::topRearRight: return Vst2::vstIndividualSpeakerTypeTopRearRight; ++ case AudioChannelSet::LFE2: return Vst2::vstIndividualSpeakerTypeLFE2; + default: break; + } + +@@ -1075,25 +1067,25 @@ public: + { + switch (type) + { +- case Vst2::kSpeakerL: return AudioChannelSet::left; +- case Vst2::kSpeakerR: return AudioChannelSet::right; +- case Vst2::kSpeakerC: return AudioChannelSet::centre; +- case Vst2::kSpeakerLfe: return AudioChannelSet::LFE; +- case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround; +- case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround; +- case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre; +- case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre; +- case Vst2::kSpeakerS: return AudioChannelSet::surround; +- case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear; +- case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear; +- case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle; +- case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft; +- case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre; +- case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight; +- case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft; +- case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre; +- case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight; +- case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2; ++ case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left; ++ case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right; ++ case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre; ++ case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE; ++ case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround; ++ case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround; ++ case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre; ++ case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre; ++ case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround; ++ case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear; ++ case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear; ++ case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle; ++ case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft; ++ case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre; ++ case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight; ++ case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft; ++ case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre; ++ case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight; ++ case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2; + default: break; + } + +@@ -1127,15 +1119,15 @@ public: + + void setHasEditorFlag (bool shouldSetHasEditor) + { +- auto hasEditor = (vstEffect.flags & Vst2::effFlagsHasEditor) != 0; ++ auto hasEditor = (vstEffect.flags & Vst2::vstEffectFlagHasEditor) != 0; + + if (shouldSetHasEditor == hasEditor) + return; + + if (shouldSetHasEditor) +- vstEffect.flags |= Vst2::effFlagsHasEditor; ++ vstEffect.flags |= Vst2::vstEffectFlagHasEditor; + else +- vstEffect.flags &= ~Vst2::effFlagsHasEditor; ++ vstEffect.flags &= ~Vst2::vstEffectFlagHasEditor; + } + + void createEditorComp() +@@ -1202,59 +1194,59 @@ public: + + switch (opCode) + { +- case Vst2::effOpen: return handleOpen (args); +- case Vst2::effClose: return handleClose (args); +- case Vst2::effSetProgram: return handleSetCurrentProgram (args); +- case Vst2::effGetProgram: return handleGetCurrentProgram (args); +- case Vst2::effSetProgramName: return handleSetCurrentProgramName (args); +- case Vst2::effGetProgramName: return handleGetCurrentProgramName (args); +- case Vst2::effGetParamLabel: return handleGetParameterLabel (args); +- case Vst2::effGetParamDisplay: return handleGetParameterText (args); +- case Vst2::effGetParamName: return handleGetParameterName (args); +- case Vst2::effSetSampleRate: return handleSetSampleRate (args); +- case Vst2::effSetBlockSize: return handleSetBlockSize (args); +- case Vst2::effMainsChanged: return handleResumeSuspend (args); +- case Vst2::effEditGetRect: return handleGetEditorBounds (args); +- case Vst2::effEditOpen: return handleOpenEditor (args); +- case Vst2::effEditClose: return handleCloseEditor (args); +- case Vst2::effIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf"); +- case Vst2::effGetChunk: return handleGetData (args); +- case Vst2::effSetChunk: return handleSetData (args); +- case Vst2::effProcessEvents: return handlePreAudioProcessingEvents (args); +- case Vst2::effCanBeAutomated: return handleIsParameterAutomatable (args); +- case Vst2::effString2Parameter: return handleParameterValueForText (args); +- case Vst2::effGetProgramNameIndexed: return handleGetProgramName (args); +- case Vst2::effGetInputProperties: return handleGetInputPinProperties (args); +- case Vst2::effGetOutputProperties: return handleGetOutputPinProperties (args); +- case Vst2::effGetPlugCategory: return handleGetPlugInCategory (args); +- case Vst2::effSetSpeakerArrangement: return handleSetSpeakerConfiguration (args); +- case Vst2::effSetBypass: return handleSetBypass (args); +- case Vst2::effGetEffectName: return handleGetPlugInName (args); +- case Vst2::effGetProductString: return handleGetPlugInName (args); +- case Vst2::effGetVendorString: return handleGetManufacturerName (args); +- case Vst2::effGetVendorVersion: return handleGetManufacturerVersion (args); +- case Vst2::effVendorSpecific: return handleManufacturerSpecific (args); +- case Vst2::effCanDo: return handleCanPlugInDo (args); +- case Vst2::effGetTailSize: return handleGetTailSize (args); +- case Vst2::effKeysRequired: return handleKeyboardFocusRequired (args); +- case Vst2::effGetVstVersion: return handleGetVstInterfaceVersion (args); +- case Vst2::effGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args); +- case Vst2::effGetSpeakerArrangement: return handleGetSpeakerConfiguration (args); +- case Vst2::effSetTotalSampleToProcess: return handleSetNumberOfSamplesToProcess (args); +- case Vst2::effSetProcessPrecision: return handleSetSampleFloatType (args); +- case Vst2::effGetNumMidiInputChannels: return handleGetNumMidiInputChannels(); +- case Vst2::effGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels(); +- default: return 0; +- } +- } +- +- static pointer_sized_int dispatcherCB (Vst2::AEffect* vstInterface, int32 opCode, int32 index, ++ case Vst2::plugInOpcodeOpen: return handleOpen (args); ++ case Vst2::plugInOpcodeClose: return handleClose (args); ++ case Vst2::plugInOpcodeSetCurrentProgram: return handleSetCurrentProgram (args); ++ case Vst2::plugInOpcodeGetCurrentProgram: return handleGetCurrentProgram (args); ++ case Vst2::plugInOpcodeSetCurrentProgramName: return handleSetCurrentProgramName (args); ++ case Vst2::plugInOpcodeGetCurrentProgramName: return handleGetCurrentProgramName (args); ++ case Vst2::plugInOpcodeGetParameterLabel: return handleGetParameterLabel (args); ++ case Vst2::plugInOpcodeGetParameterText: return handleGetParameterText (args); ++ case Vst2::plugInOpcodeGetParameterName: return handleGetParameterName (args); ++ case Vst2::plugInOpcodeSetSampleRate: return handleSetSampleRate (args); ++ case Vst2::plugInOpcodeSetBlockSize: return handleSetBlockSize (args); ++ case Vst2::plugInOpcodeResumeSuspend: return handleResumeSuspend (args); ++ case Vst2::plugInOpcodeGetEditorBounds: return handleGetEditorBounds (args); ++ case Vst2::plugInOpcodeOpenEditor: return handleOpenEditor (args); ++ case Vst2::plugInOpcodeCloseEditor: return handleCloseEditor (args); ++ case Vst2::plugInOpcodeIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf"); ++ case Vst2::plugInOpcodeGetData: return handleGetData (args); ++ case Vst2::plugInOpcodeSetData: return handleSetData (args); ++ case Vst2::plugInOpcodePreAudioProcessingEvents: return handlePreAudioProcessingEvents (args); ++ case Vst2::plugInOpcodeIsParameterAutomatable: return handleIsParameterAutomatable (args); ++ case Vst2::plugInOpcodeParameterValueForText: return handleParameterValueForText (args); ++ case Vst2::plugInOpcodeGetProgramName: return handleGetProgramName (args); ++ case Vst2::plugInOpcodeGetInputPinProperties: return handleGetInputPinProperties (args); ++ case Vst2::plugInOpcodeGetOutputPinProperties: return handleGetOutputPinProperties (args); ++ case Vst2::plugInOpcodeGetPlugInCategory: return handleGetPlugInCategory (args); ++ case Vst2::plugInOpcodeSetSpeakerConfiguration: return handleSetSpeakerConfiguration (args); ++ case Vst2::plugInOpcodeSetBypass: return handleSetBypass (args); ++ case Vst2::plugInOpcodeGetPlugInName: return handleGetPlugInName (args); ++ case Vst2::plugInOpcodeGetManufacturerProductName: return handleGetPlugInName (args); ++ case Vst2::plugInOpcodeGetManufacturerName: return handleGetManufacturerName (args); ++ case Vst2::plugInOpcodeGetManufacturerVersion: return handleGetManufacturerVersion (args); ++ case Vst2::plugInOpcodeManufacturerSpecific: return handleManufacturerSpecific (args); ++ case Vst2::plugInOpcodeCanPlugInDo: return handleCanPlugInDo (args); ++ case Vst2::plugInOpcodeGetTailSize: return handleGetTailSize (args); ++ case Vst2::plugInOpcodeKeyboardFocusRequired: return handleKeyboardFocusRequired (args); ++ case Vst2::plugInOpcodeGetVstInterfaceVersion: return handleGetVstInterfaceVersion (args); ++ case Vst2::plugInOpcodeGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args); ++ case Vst2::plugInOpcodeGetSpeakerArrangement: return handleGetSpeakerConfiguration (args); ++ case Vst2::plugInOpcodeSetNumberOfSamplesToProcess: return handleSetNumberOfSamplesToProcess (args); ++ case Vst2::plugInOpcodeSetSampleFloatType: return handleSetSampleFloatType (args); ++ case Vst2::pluginOpcodeGetNumMidiInputChannels: return handleGetNumMidiInputChannels(); ++ case Vst2::pluginOpcodeGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels(); ++ default: return 0; ++ } ++ } ++ ++ static pointer_sized_int dispatcherCB (Vst2::VstEffectInterface* vstInterface, int32 opCode, int32 index, + pointer_sized_int value, void* ptr, float opt) + { + auto* wrapper = getWrapper (vstInterface); + VstOpCodeArguments args = { index, value, ptr, opt }; + +- if (opCode == Vst2::effClose) ++ if (opCode == Vst2::plugInOpcodeClose) + { + wrapper->dispatcher (opCode, args); + delete wrapper; +@@ -1302,18 +1294,18 @@ public: + + void paint (Graphics&) override {} + +- void getEditorBounds (Vst2::ERect& bounds) ++ void getEditorBounds (Vst2::VstEditorBounds& bounds) + { + auto b = getSizeToContainChild(); + +- bounds.top = 0; +- bounds.left = 0; +- bounds.bottom = (int16) b.getHeight(); +- bounds.right = (int16) b.getWidth(); ++ bounds.upper = 0; ++ bounds.leftmost = 0; ++ bounds.lower = (int16) b.getHeight(); ++ bounds.rightmost = (int16) b.getWidth(); + + #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE +- bounds.bottom = (int16) roundToInt (bounds.bottom * wrapper.editorScaleFactor); +- bounds.right = (int16) roundToInt (bounds.right * wrapper.editorScaleFactor); ++ bounds.lower = (int16) roundToInt (bounds.lower * wrapper.editorScaleFactor); ++ bounds.rightmost = (int16) roundToInt (bounds.rightmost * wrapper.editorScaleFactor); + #endif + } + +@@ -1463,7 +1455,7 @@ public: + + if (auto host = wrapper.hostCallback) + { +- auto status = host (wrapper.getAEffect(), Vst2::audioMasterCanDo, 0, 0, const_cast ("sizeWindow"), 0); ++ auto status = host (wrapper.getAEffect(), Vst2::hostOpcodeCanHostDo, 0, 0, const_cast ("sizeWindow"), 0); + + if (status == (pointer_sized_int) 1 || getHostType().isAbletonLive()) + { +@@ -1474,7 +1466,7 @@ public: + + const ScopedValueSetter inSizeWindowSetter (isInSizeWindow, true); + +- sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow, ++ sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::hostOpcodeWindowSize, + newWidth, newHeight, nullptr, 0) != 0); + } + } +@@ -1593,12 +1585,12 @@ public: + + //============================================================================== + private: +- static JuceVSTWrapper* getWrapper (Vst2::AEffect* v) noexcept { return static_cast (v->object); } ++ static JuceVSTWrapper* getWrapper (Vst2::VstEffectInterface* v) noexcept { return static_cast (v->effectPointer); } + + bool isProcessLevelOffline() + { + return hostCallback != nullptr +- && (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, nullptr, 0) == 4; ++ && (int32) hostCallback (&vstEffect, Vst2::hostOpcodeGetCurrentAudioProcessingLevel, 0, 0, nullptr, 0) == 4; + } + + static inline int32 convertHexVersionToDecimal (const unsigned int hexVersion) +@@ -1666,8 +1658,8 @@ private: + tmpBuffers.release(); + + if (processor != nullptr) +- tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputs +- + vstEffect.numOutputs); ++ tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputChannels ++ + vstEffect.numOutputChannels); + } + + void deleteTempChannels() +@@ -1827,7 +1819,7 @@ private: + if (editorComp != nullptr) + { + editorComp->getEditorBounds (editorBounds); +- *((Vst2::ERect**) args.ptr) = &editorBounds; ++ *((Vst2::VstEditorBounds**) args.ptr) = &editorBounds; + return (pointer_sized_int) &editorBounds; + } + +@@ -1917,7 +1909,7 @@ private: + pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args) + { + #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect +- VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents); ++ VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEventBlock*) args.ptr, midiEvents); + return 1; + #else + ignoreUnused (args); +@@ -1968,12 +1960,12 @@ private: + + pointer_sized_int handleGetInputPinProperties (VstOpCodeArguments args) + { +- return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, true, args.index)) ? 1 : 0; ++ return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, true, args.index)) ? 1 : 0; + } + + pointer_sized_int handleGetOutputPinProperties (VstOpCodeArguments args) + { +- return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, false, args.index)) ? 1 : 0; ++ return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, false, args.index)) ? 1 : 0; + } + + pointer_sized_int handleGetPlugInCategory (VstOpCodeArguments) +@@ -1983,8 +1975,8 @@ private: + + pointer_sized_int handleSetSpeakerConfiguration (VstOpCodeArguments args) + { +- auto* pluginInput = reinterpret_cast (args.value); +- auto* pluginOutput = reinterpret_cast (args.ptr); ++ auto* pluginInput = reinterpret_cast (args.value); ++ auto* pluginOutput = reinterpret_cast (args.ptr); + + if (processor->isMidiEffect()) + return 0; +@@ -1995,29 +1987,29 @@ private: + if (pluginInput != nullptr && pluginInput->type >= 0) + { + // inconsistent request? +- if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numChannels) ++ if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numberOfChannels) + return 0; + } + + if (pluginOutput != nullptr && pluginOutput->type >= 0) + { + // inconsistent request? +- if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numChannels) ++ if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numberOfChannels) + return 0; + } + +- if (pluginInput != nullptr && pluginInput->numChannels > 0 && numIns == 0) ++ if (pluginInput != nullptr && pluginInput->numberOfChannels > 0 && numIns == 0) + return 0; + +- if (pluginOutput != nullptr && pluginOutput->numChannels > 0 && numOuts == 0) ++ if (pluginOutput != nullptr && pluginOutput->numberOfChannels > 0 && numOuts == 0) + return 0; + + auto layouts = processor->getBusesLayout(); + +- if (pluginInput != nullptr && pluginInput-> numChannels >= 0 && numIns > 0) ++ if (pluginInput != nullptr && pluginInput-> numberOfChannels >= 0 && numIns > 0) + layouts.getChannelSet (true, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput); + +- if (pluginOutput != nullptr && pluginOutput->numChannels >= 0 && numOuts > 0) ++ if (pluginOutput != nullptr && pluginOutput->numberOfChannels >= 0 && numOuts > 0) + layouts.getChannelSet (false, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput); + + #ifdef JucePlugin_PreferredChannelConfigurations +@@ -2065,7 +2057,7 @@ private: + && args.value == JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's')) + return handleSetContentScaleFactor (args.opt); + +- if (args.index == Vst2::effGetParamDisplay) ++ if (args.index == Vst2::plugInOpcodeGetParameterText) + return handleCockosGetParameterText (args.value, args.ptr, args.opt); + + if (auto callbackHandler = dynamic_cast (processor)) +@@ -2160,7 +2152,7 @@ private: + + pointer_sized_int handleGetVstInterfaceVersion (VstOpCodeArguments) + { +- return kVstVersion; ++ return Vst2::juceVstInterfaceVersion; + } + + pointer_sized_int handleGetCurrentMidiProgram (VstOpCodeArguments) +@@ -2170,8 +2162,8 @@ private: + + pointer_sized_int handleGetSpeakerConfiguration (VstOpCodeArguments args) + { +- auto** pluginInput = reinterpret_cast (args.value); +- auto** pluginOutput = reinterpret_cast (args.ptr); ++ auto** pluginInput = reinterpret_cast (args.value); ++ auto** pluginOutput = reinterpret_cast (args.ptr); + + if (pluginHasSidechainsOrAuxs() || processor->isMidiEffect()) + return false; +@@ -2179,10 +2171,10 @@ private: + auto inputLayout = processor->getChannelLayoutOfBus (true, 0); + auto outputLayout = processor->getChannelLayoutOfBus (false, 0); + +- auto speakerBaseSize = sizeof (Vst2::VstSpeakerArrangement) - (sizeof (Vst2::VstSpeakerProperties) * 8); ++ auto speakerBaseSize = sizeof (Vst2::VstSpeakerConfiguration) - (sizeof (Vst2::VstIndividualSpeakerInfo) * 8); + +- cachedInArrangement .malloc (speakerBaseSize + (static_cast (inputLayout. size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); +- cachedOutArrangement.malloc (speakerBaseSize + (static_cast (outputLayout.size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); ++ cachedInArrangement .malloc (speakerBaseSize + (static_cast (inputLayout. size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1); ++ cachedOutArrangement.malloc (speakerBaseSize + (static_cast (outputLayout.size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1); + + *pluginInput = cachedInArrangement. getData(); + *pluginOutput = cachedOutArrangement.getData(); +@@ -2204,7 +2196,7 @@ private: + { + if (processor != nullptr) + { +- processor->setProcessingPrecision ((args.value == Vst2::kVstProcessPrecision64 ++ processor->setProcessingPrecision ((args.value == Vst2::vstProcessingSampleTypeDouble + && processor->supportsDoublePrecisionProcessing()) + ? AudioProcessor::doublePrecision + : AudioProcessor::singlePrecision); +@@ -2286,16 +2278,16 @@ private: + } + + //============================================================================== +- Vst2::audioMasterCallback hostCallback; ++ Vst2::VstHostCallback hostCallback; + AudioProcessor* processor = {}; + double sampleRate = 44100.0; + int32 blockSize = 1024; +- Vst2::AEffect vstEffect; ++ Vst2::VstEffectInterface vstEffect; + CriticalSection stateInformationLock; + juce::MemoryBlock chunkMemory; + uint32 chunkMemoryTime = 0; + std::unique_ptr editorComp; +- Vst2::ERect editorBounds; ++ Vst2::VstEditorBounds editorBounds; + MidiBuffer midiEvents; + VSTMidiEventList outgoingEvents; + +@@ -2320,7 +2312,7 @@ private: + VstTempBuffers doubleTempBuffers; + int maxNumInChannels = 0, maxNumOutChannels = 0; + +- HeapBlock cachedInArrangement, cachedOutArrangement; ++ HeapBlock cachedInArrangement, cachedOutArrangement; + + ThreadLocalValue inParameterChangedCallback; + +@@ -2332,7 +2324,7 @@ private: + //============================================================================== + namespace + { +- Vst2::AEffect* pluginEntryPoint (Vst2::audioMasterCallback audioMaster) ++ Vst2::VstEffectInterface* pluginEntryPoint (Vst2::VstHostCallback audioMaster) + { + JUCE_AUTORELEASEPOOL + { +@@ -2340,7 +2332,7 @@ namespace + + try + { +- if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0) ++ if (audioMaster (nullptr, Vst2::hostOpcodeVstVersion, 0, 0, nullptr, 0) != 0) + { + #if JUCE_LINUX + MessageManagerLock mmLock; +@@ -2377,8 +2369,8 @@ namespace + // Mac startup code.. + #if JUCE_MAC + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2386,8 +2378,8 @@ namespace + return pluginEntryPoint (audioMaster); + } + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2399,8 +2391,8 @@ namespace + // Linux startup code.. + #elif JUCE_LINUX + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2408,8 +2400,8 @@ namespace + return pluginEntryPoint (audioMaster); + } + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) asm ("main"); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) asm ("main"); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2424,7 +2416,7 @@ namespace + // Win32 startup code.. + #else + +- extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) ++ extern "C" __declspec (dllexport) Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2432,7 +2424,7 @@ namespace + } + + #ifndef JUCE_64BIT // (can't compile this on win64, but it's not needed anyway with VST2.4) +- extern "C" __declspec (dllexport) int main (Vst2::audioMasterCallback audioMaster) ++ extern "C" __declspec (dllexport) int main (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +diff --git a/modules/juce_audio_processors/format_types/juce_VSTCommon.h b/modules/juce_audio_processors/format_types/juce_VSTCommon.h +index 1eea8e3..10ea6e2 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTCommon.h ++++ b/modules/juce_audio_processors/format_types/juce_VSTCommon.h +@@ -66,25 +66,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + + static AudioChannelSet vstArrangementTypeToChannelSet (int32 arr, int fallbackNumChannels) + { +- if (arr == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled(); +- else if (arr == Vst2::kSpeakerArrMono) return AudioChannelSet::mono(); +- else if (arr == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo(); +- else if (arr == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR(); +- else if (arr == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS(); +- else if (arr == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS(); +- else if (arr == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0(); +- else if (arr == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1(); +- else if (arr == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0(); +- else if (arr == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1(); +- else if (arr == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music(); +- else if (arr == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music(); +- else if (arr == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0(); +- else if (arr == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS(); +- else if (arr == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1(); +- else if (arr == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS(); +- else if (arr == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic(); +- +- for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) ++ if (arr == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled(); ++ else if (arr == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic(); ++ ++ for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) + { + if (m->vst2 == arr) + { +@@ -100,41 +100,41 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + return AudioChannelSet::discreteChannels (fallbackNumChannels); + } + +- static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr) ++ static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr) + { +- return vstArrangementTypeToChannelSet (arr.type, arr.numChannels); ++ return vstArrangementTypeToChannelSet (arr.type, arr.numberOfChannels); + } + + static int32 channelSetToVstArrangementType (AudioChannelSet channels) + { +- if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty; +- else if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono; +- else if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo; +- else if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine; +- else if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music; +- else if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine; +- else if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50; +- else if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51; +- else if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine; +- else if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine; +- else if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music; +- else if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music; +- else if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music; +- else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine; +- else if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music; +- else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine; +- else if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music; ++ if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty; ++ else if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono; ++ else if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR; ++ else if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC; ++ else if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS; ++ else if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS; ++ else if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs; ++ else if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs; ++ else if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs; ++ else if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs; ++ else if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr; ++ else if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr; ++ else if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr; ++ else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc; ++ else if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr; ++ else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc; ++ else if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs; + + Array chans (channels.getChannelTypes()); + + if (channels == AudioChannelSet::disabled()) +- return Vst2::kSpeakerArrEmpty; ++ return Vst2::vstSpeakerConfigTypeEmpty; + +- for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) ++ for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) + if (m->matches (chans)) + return m->vst2; + +- return Vst2::kSpeakerArrUserDefined; ++ return Vst2::vstSpeakerConfigTypeUser; + } + + /** Class to hold a speaker configuration */ +@@ -142,7 +142,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + public: + VstSpeakerConfigurationHolder() { clear(); } +- VstSpeakerConfigurationHolder (const Vst2::VstSpeakerArrangement& vstConfig) { operator= (vstConfig); } ++ VstSpeakerConfigurationHolder (const Vst2::VstSpeakerConfiguration& vstConfig) { operator= (vstConfig); } + VstSpeakerConfigurationHolder (const VstSpeakerConfigurationHolder& other) { operator= (other.get()); } + VstSpeakerConfigurationHolder (VstSpeakerConfigurationHolder&& other) + : storage (std::move (other.storage)) { other.clear(); } +@@ -150,29 +150,29 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + VstSpeakerConfigurationHolder (const AudioChannelSet& channels) + { + auto numberOfChannels = channels.size(); +- Vst2::VstSpeakerArrangement& dst = *allocate (numberOfChannels); ++ Vst2::VstSpeakerConfiguration& dst = *allocate (numberOfChannels); + + dst.type = channelSetToVstArrangementType (channels); +- dst.numChannels = numberOfChannels; ++ dst.numberOfChannels = numberOfChannels; + +- for (int i = 0; i < dst.numChannels; ++i) ++ for (int i = 0; i < dst.numberOfChannels; ++i) + { +- Vst2::VstSpeakerProperties& speaker = dst.speakers[i]; ++ Vst2::VstIndividualSpeakerInfo& speaker = dst.speakers[i]; + +- zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties)); ++ zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo)); + speaker.type = getSpeakerType (channels.getTypeOfChannel (i)); + } + } + + VstSpeakerConfigurationHolder& operator= (const VstSpeakerConfigurationHolder& vstConfig) { return operator=(vstConfig.get()); } +- VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerArrangement& vstConfig) ++ VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerConfiguration& vstConfig) + { +- Vst2::VstSpeakerArrangement& dst = *allocate (vstConfig.numChannels); ++ Vst2::VstSpeakerConfiguration& dst = *allocate (vstConfig.numberOfChannels); + + dst.type = vstConfig.type; +- dst.numChannels = vstConfig.numChannels; ++ dst.numberOfChannels = vstConfig.numberOfChannels; + +- for (int i = 0; i < dst.numChannels; ++i) ++ for (int i = 0; i < dst.numberOfChannels; ++i) + dst.speakers[i] = vstConfig.speakers[i]; + + return *this; +@@ -186,17 +186,17 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + return *this; + } + +- const Vst2::VstSpeakerArrangement& get() const { return *storage.get(); } ++ const Vst2::VstSpeakerConfiguration& get() const { return *storage.get(); } + + private: + JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder) + +- HeapBlock storage; ++ HeapBlock storage; + +- Vst2::VstSpeakerArrangement* allocate (int numChannels) ++ Vst2::VstSpeakerConfiguration* allocate (int numChannels) + { +- auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties) +- + sizeof (Vst2::VstSpeakerArrangement); ++ auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstIndividualSpeakerInfo) ++ + sizeof (Vst2::VstSpeakerConfiguration); + + storage.malloc (1, arrangementSize); + return storage.get(); +@@ -204,10 +204,10 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + + void clear() + { +- Vst2::VstSpeakerArrangement& dst = *allocate (0); ++ Vst2::VstSpeakerConfiguration& dst = *allocate (0); + +- dst.type = Vst2::kSpeakerArrEmpty; +- dst.numChannels = 0; ++ dst.type = Vst2::vstSpeakerConfigTypeEmpty; ++ dst.numberOfChannels = 0; + } + }; + +@@ -215,36 +215,36 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + static const Mapping mappings[] = + { +- { Vst2::kSpeakerArrMono, { centre, unknown } }, +- { Vst2::kSpeakerArrStereo, { left, right, unknown } }, +- { Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } }, +- { Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } }, +- { Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } }, +- { Vst2::kSpeakerArr30Music, { left, right, surround, unknown } }, +- { Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } }, +- { Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } }, +- { Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } }, +- { Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } }, +- { Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, +- { Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, +- { Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, +- { Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, +- { Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, +- { Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, +- { Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, +- { Vst2::kSpeakerArrEmpty, { unknown } } ++ { Vst2::vstSpeakerConfigTypeMono, { centre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, ++ { Vst2::vstSpeakerConfigTypeEmpty, { unknown } } + }; + + return mappings; +@@ -254,25 +254,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + switch (type) + { +- case AudioChannelSet::left: return Vst2::kSpeakerL; +- case AudioChannelSet::right: return Vst2::kSpeakerR; +- case AudioChannelSet::centre: return Vst2::kSpeakerC; +- case AudioChannelSet::LFE: return Vst2::kSpeakerLfe; +- case AudioChannelSet::leftSurround: return Vst2::kSpeakerLs; +- case AudioChannelSet::rightSurround: return Vst2::kSpeakerRs; +- case AudioChannelSet::leftCentre: return Vst2::kSpeakerLc; +- case AudioChannelSet::rightCentre: return Vst2::kSpeakerRc; +- case AudioChannelSet::surround: return Vst2::kSpeakerS; +- case AudioChannelSet::leftSurroundRear: return Vst2::kSpeakerSl; +- case AudioChannelSet::rightSurroundRear: return Vst2::kSpeakerSr; +- case AudioChannelSet::topMiddle: return Vst2::kSpeakerTm; +- case AudioChannelSet::topFrontLeft: return Vst2::kSpeakerTfl; +- case AudioChannelSet::topFrontCentre: return Vst2::kSpeakerTfc; +- case AudioChannelSet::topFrontRight: return Vst2::kSpeakerTfr; +- case AudioChannelSet::topRearLeft: return Vst2::kSpeakerTrl; +- case AudioChannelSet::topRearCentre: return Vst2::kSpeakerTrc; +- case AudioChannelSet::topRearRight: return Vst2::kSpeakerTrr; +- case AudioChannelSet::LFE2: return Vst2::kSpeakerLfe2; ++ case AudioChannelSet::left: return Vst2::vstIndividualSpeakerTypeLeft; ++ case AudioChannelSet::right: return Vst2::vstIndividualSpeakerTypeRight; ++ case AudioChannelSet::centre: return Vst2::vstIndividualSpeakerTypeCentre; ++ case AudioChannelSet::LFE: return Vst2::vstIndividualSpeakerTypeLFE; ++ case AudioChannelSet::leftSurround: return Vst2::vstIndividualSpeakerTypeLeftSurround; ++ case AudioChannelSet::rightSurround: return Vst2::vstIndividualSpeakerTypeRightSurround; ++ case AudioChannelSet::leftCentre: return Vst2::vstIndividualSpeakerTypeLeftCentre; ++ case AudioChannelSet::rightCentre: return Vst2::vstIndividualSpeakerTypeRightCentre; ++ case AudioChannelSet::surround: return Vst2::vstIndividualSpeakerTypeSurround; ++ case AudioChannelSet::leftSurroundRear: return Vst2::vstIndividualSpeakerTypeLeftRearSurround; ++ case AudioChannelSet::rightSurroundRear: return Vst2::vstIndividualSpeakerTypeRightRearSurround; ++ case AudioChannelSet::topMiddle: return Vst2::vstIndividualSpeakerTypeTopMiddle; ++ case AudioChannelSet::topFrontLeft: return Vst2::vstIndividualSpeakerTypeTopFrontLeft; ++ case AudioChannelSet::topFrontCentre: return Vst2::vstIndividualSpeakerTypeTopFrontCentre; ++ case AudioChannelSet::topFrontRight: return Vst2::vstIndividualSpeakerTypeTopFrontRight; ++ case AudioChannelSet::topRearLeft: return Vst2::vstIndividualSpeakerTypeTopRearLeft; ++ case AudioChannelSet::topRearCentre: return Vst2::vstIndividualSpeakerTypeTopRearCentre; ++ case AudioChannelSet::topRearRight: return Vst2::vstIndividualSpeakerTypeTopRearRight; ++ case AudioChannelSet::LFE2: return Vst2::vstIndividualSpeakerTypeLFE2; + default: break; + } + +@@ -283,25 +283,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + switch (type) + { +- case Vst2::kSpeakerL: return AudioChannelSet::left; +- case Vst2::kSpeakerR: return AudioChannelSet::right; +- case Vst2::kSpeakerC: return AudioChannelSet::centre; +- case Vst2::kSpeakerLfe: return AudioChannelSet::LFE; +- case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround; +- case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround; +- case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre; +- case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre; +- case Vst2::kSpeakerS: return AudioChannelSet::surround; +- case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear; +- case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear; +- case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle; +- case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft; +- case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre; +- case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight; +- case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft; +- case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre; +- case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight; +- case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2; ++ case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left; ++ case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right; ++ case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre; ++ case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE; ++ case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround; ++ case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround; ++ case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre; ++ case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre; ++ case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround; ++ case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear; ++ case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear; ++ case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle; ++ case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft; ++ case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre; ++ case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight; ++ case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft; ++ case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre; ++ case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight; ++ case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2; + default: break; + } + +diff --git a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h +index 3b6d316..1543ad1 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h ++++ b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h +@@ -58,7 +58,7 @@ public: + numEventsUsed = 0; + + if (events != nullptr) +- events->numEvents = 0; ++ events->numberOfEvents = 0; + } + + void addEvent (const void* const midiData, int numBytes, int frameOffset) +@@ -67,50 +67,50 @@ public: + + void* const ptr = (Vst2::VstMidiEvent*) (events->events [numEventsUsed]); + auto* const e = (Vst2::VstMidiEvent*) ptr; +- events->numEvents = ++numEventsUsed; ++ events->numberOfEvents = ++numEventsUsed; + + if (numBytes <= 4) + { +- if (e->type == Vst2::kVstSysExType) ++ if (e->type == Vst2::vstSysExEventType) + { +- delete[] (((Vst2::VstMidiSysexEvent*) ptr)->sysexDump); +- e->type = Vst2::kVstMidiType; +- e->byteSize = sizeof (Vst2::VstMidiEvent); +- e->noteLength = 0; +- e->noteOffset = 0; +- e->detune = 0; +- e->noteOffVelocity = 0; ++ delete[] (((Vst2::VstSysExEvent*) ptr)->sysExDump); ++ e->type = Vst2::vstMidiEventType; ++ e->size = sizeof (Vst2::VstMidiEvent); ++ e->noteSampleLength = 0; ++ e->noteSampleOffset = 0; ++ e->tuning = 0; ++ e->noteVelocityOff = 0; + } + +- e->deltaFrames = frameOffset; ++ e->sampleOffset = frameOffset; + memcpy (e->midiData, midiData, (size_t) numBytes); + } + else + { +- auto* const se = (Vst2::VstMidiSysexEvent*) ptr; ++ auto* const se = (Vst2::VstSysExEvent*) ptr; + +- if (se->type == Vst2::kVstSysExType) +- delete[] se->sysexDump; ++ if (se->type == Vst2::vstSysExEventType) ++ delete[] se->sysExDump; + +- se->sysexDump = new char [(size_t) numBytes]; +- memcpy (se->sysexDump, midiData, (size_t) numBytes); ++ se->sysExDump = new char [(size_t) numBytes]; ++ memcpy (se->sysExDump, midiData, (size_t) numBytes); + +- se->type = Vst2::kVstSysExType; +- se->byteSize = sizeof (Vst2::VstMidiSysexEvent); +- se->deltaFrames = frameOffset; ++ se->type = Vst2::vstSysExEventType; ++ se->size = sizeof (Vst2::VstSysExEvent); ++ se->offsetSamples = frameOffset; + se->flags = 0; +- se->dumpBytes = numBytes; +- se->resvd1 = 0; +- se->resvd2 = 0; ++ se->sysExDumpSize = numBytes; ++ se->future1 = 0; ++ se->future2 = 0; + } + } + + //============================================================================== + // Handy method to pull the events out of an event buffer supplied by the host + // or plugin. +- static void addEventsToMidiBuffer (const Vst2::VstEvents* events, MidiBuffer& dest) ++ static void addEventsToMidiBuffer (const Vst2::VstEventBlock* events, MidiBuffer& dest) + { +- for (int i = 0; i < events->numEvents; ++i) ++ for (int i = 0; i < events->numberOfEvents; ++i) + { + const Vst2::VstEvent* const e = events->events[i]; + +@@ -118,17 +118,17 @@ public: + { + const void* const ptr = events->events[i]; + +- if (e->type == Vst2::kVstMidiType) ++ if (e->type == Vst2::vstMidiEventType) + { + dest.addEvent ((const juce::uint8*) ((const Vst2::VstMidiEvent*) ptr)->midiData, +- 4, e->deltaFrames); ++ 4, e->sampleOffset); + } +- else if (e->type == Vst2::kVstSysExType) ++ else if (e->type == Vst2::vstSysExEventType) + { +- const auto* se = (const Vst2::VstMidiSysexEvent*) ptr; +- dest.addEvent ((const juce::uint8*) se->sysexDump, +- (int) se->dumpBytes, +- e->deltaFrames); ++ const auto* se = (const Vst2::VstSysExEvent*) ptr; ++ dest.addEvent ((const juce::uint8*) se->sysExDump, ++ (int) se->sysExDumpSize, ++ e->sampleOffset); + } + } + } +@@ -169,25 +169,25 @@ public: + } + + //============================================================================== +- HeapBlock events; ++ HeapBlock events; + + private: + int numEventsUsed, numEventsAllocated; + + static Vst2::VstEvent* allocateVSTEvent() + { +- auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstMidiSysexEvent) ? sizeof (Vst2::VstMidiEvent) +- : sizeof (Vst2::VstMidiSysexEvent)); +- e->type = Vst2::kVstMidiType; +- e->byteSize = sizeof (Vst2::VstMidiEvent); ++ auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstSysExEvent) ? sizeof (Vst2::VstMidiEvent) ++ : sizeof (Vst2::VstSysExEvent)); ++ e->type = Vst2::vstMidiEventType; ++ e->size = sizeof (Vst2::VstMidiEvent); + return e; + } + + static void freeVSTEvent (Vst2::VstEvent* e) + { +- if (e->type == Vst2::kVstSysExType) ++ if (e->type == Vst2::vstSysExEventType) + { +- delete[] (reinterpret_cast (e)->sysexDump); ++ delete[] (reinterpret_cast (e)->sysExDump); + } + + std::free (e); +diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +index bdc935f..ce6b867 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp ++++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +@@ -49,7 +49,6 @@ + #endif + + #define VST_FORCE_DEPRECATED 0 +-#define JUCE_VSTINTERFACE_H_INCLUDED 1 + + namespace Vst2 + { +@@ -58,8 +57,7 @@ namespace Vst2 + // paths or use the "VST (Legacy) SDK Folder" field in the Projucer. The VST2 + // SDK can be obtained from the vstsdk3610_11_06_2018_build_37 (or older) VST3 + // SDK or JUCE version 5.3.2. +-#include +-#include ++#include "../../juce_audio_processors/format_types/juce_VSTInterface.h" + } + + #include "juce_VSTCommon.h" +@@ -98,7 +96,7 @@ namespace Vst2 + #endif + + #ifndef JUCE_VST_WRAPPER_INVOKE_MAIN +-#define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain ((Vst2::audioMasterCallback) &audioMaster); ++ #define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain (&audioMaster); + #endif + + //============================================================================== +@@ -235,8 +233,8 @@ namespace + } + + //============================================================================== +-typedef Vst2::AEffect* (VSTCALLBACK *MainCall) (Vst2::audioMasterCallback); +-static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect*, int32, int32, pointer_sized_int, void*, float); ++typedef Vst2::VstEffectInterface* (VSTINTERFACECALL *MainCall) (Vst2::VstHostCallback); ++static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface*, int32, int32, pointer_sized_int, void*, float); + + //============================================================================== + // Change this to disable logging of various VST activities +@@ -706,9 +704,9 @@ struct ModuleHandle : public ReferenceCountedObject + module.close(); + } + +- void closeEffect (Vst2::AEffect* eff) ++ void closeEffect (Vst2::VstEffectInterface* eff) + { +- eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0); ++ eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0); + } + + #if JUCE_WINDOWS +@@ -832,9 +830,9 @@ struct ModuleHandle : public ReferenceCountedObject + } + } + +- void closeEffect (Vst2::AEffect* eff) ++ void closeEffect (Vst2::VstEffectInterface* eff) + { +- eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0); ++ eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0); + } + + #endif +@@ -889,7 +887,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + const ScopedLock sl (pluginInstance.lock); + +- return effect->getParameter (effect, getParameterIndex()); ++ return effect->getParameterValueFunction (effect, getParameterIndex()); + } + + return 0.0f; +@@ -901,8 +899,8 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + const ScopedLock sl (pluginInstance.lock); + +- if (effect->getParameter (effect, getParameterIndex()) != newValue) +- effect->setParameter (effect, getParameterIndex(), newValue); ++ if (effect->getParameterValueFunction (effect, getParameterIndex()) != newValue) ++ effect->setParameterValueFunction (effect, getParameterIndex(), newValue); + } + } + +@@ -935,7 +933,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (valueType != nullptr || ! vstValueStrings.isEmpty()) + return getText (getValue(), 1024); + +- return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::effGetParamDisplay); ++ return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::plugInOpcodeGetParameterText); + } + + float getDefaultValue() const override +@@ -947,7 +945,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (name.isEmpty()) + return pluginInstance.getTextForOpcode (getParameterIndex(), +- Vst2::effGetParamName); ++ Vst2::plugInOpcodeGetParameterName); + + if (name.length() <= maximumStringLength) + return name; +@@ -967,7 +965,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + String getLabel() const override + { + return label.isEmpty() ? pluginInstance.getTextForOpcode (getParameterIndex(), +- Vst2::effGetParamLabel) ++ Vst2::plugInOpcodeGetParameterLabel) + : label; + } + +@@ -1009,7 +1007,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + const VSTXMLInfo::ValueType* const valueType; + }; + +- VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::AEffect* effect, ++ VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::VstEffectInterface* effect, + double sampleRateToUse, int blockSizeToUse) + : AudioPluginInstance (ioConfig), + vstEffect (effect), +@@ -1032,13 +1030,13 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + AudioProcessorParameterGroup newParameterTree; + +- for (int i = 0; i < vstEffect->numParams; ++i) ++ for (int i = 0; i < vstEffect->numParameters; ++i) + { + String paramName; + Array shortParamNames; + float defaultValue = 0; + String label; +- bool isAutomatable = dispatch (Vst2::effCanBeAutomated, i, 0, nullptr, 0) != 0; ++ bool isAutomatable = dispatch (Vst2::plugInOpcodeIsParameterAutomatable, i, 0, nullptr, 0) != 0; + bool isDiscrete = false; + int numSteps = AudioProcessor::getDefaultNumParameterSteps(); + bool isBoolSwitch = false; +@@ -1106,7 +1104,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + ~VSTPluginInstance() override + { +- if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */) ++ if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier) + { + struct VSTDeleter : public CallbackMessage + { +@@ -1139,7 +1137,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + void cleanup() + { +- if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */) ++ if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier) + { + #if JUCE_MAC + if (vstModule->resFileId != 0) +@@ -1164,16 +1162,16 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (auto* newEffect = constructEffect (newModule)) + { +- newEffect->resvd2 = 0; ++ newEffect->hostSpace2 = 0; + +- newEffect->dispatcher (newEffect, Vst2::effIdentify, 0, 0, nullptr, 0); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0); + + auto blockSize = jmax (32, initialBlockSize); + +- newEffect->dispatcher (newEffect, Vst2::effSetSampleRate, 0, 0, nullptr, static_cast (initialSampleRate)); +- newEffect->dispatcher (newEffect, Vst2::effSetBlockSize, 0, blockSize, nullptr, 0); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, static_cast (initialSampleRate)); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetBlockSize, 0, blockSize, nullptr, 0); + +- newEffect->dispatcher (newEffect, Vst2::effOpen, 0, 0, nullptr, 0); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0); + BusesProperties ioConfig = queryBusIO (newEffect); + + return new VSTPluginInstance (newModule, ioConfig, newEffect, initialSampleRate, blockSize); +@@ -1189,7 +1187,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + { + char buffer[512] = { 0 }; +- dispatch (Vst2::effGetEffectName, 0, 0, buffer, 0); ++ dispatch (Vst2::plugInOpcodeGetPlugInName, 0, 0, buffer, 0); + + desc.descriptiveName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim(); + +@@ -1206,7 +1204,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + { + char buffer[512] = { 0 }; +- dispatch (Vst2::effGetVendorString, 0, 0, buffer, 0); ++ dispatch (Vst2::plugInOpcodeGetManufacturerName, 0, 0, buffer, 0); + desc.manufacturerName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim(); + } + +@@ -1220,7 +1218,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (vstEffect != nullptr) + { +- vstEffect->resvd2 = (pointer_sized_int) (pointer_sized_int) this; ++ vstEffect->hostSpace2 = (pointer_sized_int) (pointer_sized_int) this; + initialise (initialSampleRate, initialBlockSize); + return true; + } +@@ -1246,25 +1244,25 @@ struct VSTPluginInstance : public AudioPluginInstance, + + setRateAndBufferSizeDetails (initialSampleRate, initialBlockSize); + +- dispatch (Vst2::effIdentify, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0); + + if (getSampleRate() > 0) +- dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) getSampleRate()); ++ dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) getSampleRate()); + + if (getBlockSize() > 0) +- dispatch (Vst2::effSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0); + +- dispatch (Vst2::effOpen, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0); + + setRateAndBufferSizeDetails (getSampleRate(), getBlockSize()); + + if (getNumPrograms() > 1) + setCurrentProgram (0); + else +- dispatch (Vst2::effSetProgram, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, 0, nullptr, 0); + +- for (int i = vstEffect->numInputs; --i >= 0;) dispatch (Vst2::effConnectInput, i, 1, nullptr, 0); +- for (int i = vstEffect->numOutputs; --i >= 0;) dispatch (Vst2::effConnectOutput, i, 1, nullptr, 0); ++ for (int i = vstEffect->numInputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectInput, i, 1, nullptr, 0); ++ for (int i = vstEffect->numOutputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectOutput, i, 1, nullptr, 0); + + if (getVstCategory() != Vst2::kPlugCategShell) // (workaround for Waves 5 plugins which crash during this call) + updateStoredProgramNames(); +@@ -1275,7 +1273,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + usesCocoaNSView = ((unsigned int) pluginCanDo ("hasCockosViewAsConfig") & 0xffff0000ul) == 0xbeef0000ul; + #endif + +- setLatencySamples (vstEffect->initialDelay); ++ setLatencySamples (vstEffect->latency); + } + + void* getPlatformSpecificData() override { return vstEffect; } +@@ -1286,7 +1284,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + char buffer[512] = { 0 }; + +- if (dispatch (Vst2::effGetProductString, 0, 0, buffer, 0) != 0) ++ if (dispatch (Vst2::plugInOpcodeGetManufacturerProductName, 0, 0, buffer, 0) != 0) + { + String productName = String::createStringFromData (buffer, (int) sizeof (buffer)); + +@@ -1300,7 +1298,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + int getUID() const + { +- int uid = vstEffect != nullptr ? vstEffect->uniqueID : 0; ++ int uid = vstEffect != nullptr ? vstEffect->plugInIdentifier : 0; + + if (uid == 0) + uid = vstModule->file.hashCode(); +@@ -1313,10 +1311,10 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (vstEffect == nullptr) + return 0.0; + +- if ((vstEffect->flags & Vst2::effFlagsNoSoundInStop) != 0) ++ if ((vstEffect->flags & 512) != 0) + return 0.0; + +- auto tailSize = dispatch (Vst2::effGetTailSize, 0, 0, nullptr, 0); ++ auto tailSize = dispatch (Vst2::plugInOpcodeGetTailSize, 0, 0, nullptr, 0); + auto sampleRate = getSampleRate(); + + // remain backward compatible with old JUCE plug-ins: anything larger +@@ -1336,11 +1334,11 @@ struct VSTPluginInstance : public AudioPluginInstance, + bool producesMidi() const override { return pluginCanDo ("sendVstMidiEvent") > 0; } + bool supportsMPE() const override { return pluginCanDo ("MPE") > 0; } + +- Vst2::VstPlugCategory getVstCategory() const noexcept { return (Vst2::VstPlugCategory) dispatch (Vst2::effGetPlugCategory, 0, 0, nullptr, 0); } ++ Vst2::VstPlugInCategory getVstCategory() const noexcept { return (Vst2::VstPlugInCategory) dispatch (Vst2::plugInOpcodeGetPlugInCategory, 0, 0, nullptr, 0); } + +- bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsIsSynth) != 0); } ++ bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagIsSynth) != 0); } + +- int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::effCanDo, 0, 0, (void*) text, 0); } ++ int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::plugInOpcodeCanPlugInDo, 0, 0, (void*) text, 0); } + + //============================================================================== + void prepareToPlay (double rate, int samplesPerBlockExpected) override +@@ -1355,17 +1353,17 @@ struct VSTPluginInstance : public AudioPluginInstance, + SpeakerMappings::VstSpeakerConfigurationHolder inArr (getChannelLayoutOfBus (true, 0)); + SpeakerMappings::VstSpeakerConfigurationHolder outArr (getChannelLayoutOfBus (false, 0)); + +- dispatch (Vst2::effSetSpeakerArrangement, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f); ++ dispatch (Vst2::plugInOpcodeSetSpeakerConfiguration, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f); + } + +- vstHostTime.tempo = 120.0; +- vstHostTime.timeSigNumerator = 4; +- vstHostTime.timeSigDenominator = 4; ++ vstHostTime.tempoBPM = 120.0; ++ vstHostTime.timeSignatureNumerator = 4; ++ vstHostTime.timeSignatureDenominator = 4; + vstHostTime.sampleRate = rate; +- vstHostTime.samplePos = 0; +- vstHostTime.flags = Vst2::kVstNanosValid +- | Vst2::kVstAutomationWriting +- | Vst2::kVstAutomationReading; ++ vstHostTime.samplePosition = 0; ++ vstHostTime.flags = Vst2::vstTimingInfoFlagNanosecondsValid ++ | Vst2::vstTimingInfoFlagAutomationWriteModeActive ++ | Vst2::vstTimingInfoFlagAutomationReadModeActive; + + initialise (rate, samplesPerBlockExpected); + +@@ -1380,18 +1378,18 @@ struct VSTPluginInstance : public AudioPluginInstance, + + incomingMidi.clear(); + +- dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) rate); +- dispatch (Vst2::effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) rate); ++ dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0); + + if (supportsDoublePrecisionProcessing()) + { +- int32 vstPrecision = isUsingDoublePrecision() ? Vst2::kVstProcessPrecision64 +- : Vst2::kVstProcessPrecision32; ++ int32 vstPrecision = isUsingDoublePrecision() ? Vst2::vstProcessingSampleTypeDouble ++ : Vst2::vstProcessingSampleTypeFloat; + +- dispatch (Vst2::effSetProcessPrecision, 0, (pointer_sized_int) vstPrecision, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetSampleFloatType, 0, (pointer_sized_int) vstPrecision, nullptr, 0); + } + +- auto maxChannels = jmax (1, jmax (vstEffect->numInputs, vstEffect->numOutputs)); ++ auto maxChannels = jmax (1, jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels)); + + tmpBufferFloat .setSize (maxChannels, samplesPerBlockExpected); + tmpBufferDouble.setSize (maxChannels, samplesPerBlockExpected); +@@ -1399,7 +1397,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + channelBufferFloat .calloc (static_cast (maxChannels)); + channelBufferDouble.calloc (static_cast (maxChannels)); + +- outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputs), samplesPerBlockExpected); ++ outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputChannels), samplesPerBlockExpected); + + if (! isPowerOn) + setPower (true); +@@ -1415,9 +1413,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + } + } + +- dispatch (Vst2::effStartProcess, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeStartProcess, 0, 0, nullptr, 0); + +- setLatencySamples (vstEffect->initialDelay); ++ setLatencySamples (vstEffect->latency); + } + } + +@@ -1425,7 +1423,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (initialised) + { +- dispatch (Vst2::effStopProcess, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeStopProcess, 0, 0, nullptr, 0); + setPower (false); + } + +@@ -1478,8 +1476,8 @@ struct VSTPluginInstance : public AudioPluginInstance, + //============================================================================== + bool supportsDoublePrecisionProcessing() const override + { +- return ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0 +- && (vstEffect->flags & Vst2::effFlagsCanDoubleReplacing) != 0); ++ return ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0 ++ && (vstEffect->flags & Vst2::vstEffectFlagInplaceDoubleAudio) != 0); + } + + AudioProcessorParameter* getBypassParameter() const override { return vstSupportsBypass ? bypassParam.get() : nullptr; } +@@ -1497,15 +1495,15 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (numInputBuses > 1 || numOutputBuses > 1) + return (layouts == getBusesLayout()); + +- return (layouts.getNumChannels (true, 0) <= vstEffect->numInputs +- && layouts.getNumChannels (false, 0) <= vstEffect->numOutputs); ++ return (layouts.getNumChannels (true, 0) <= vstEffect->numInputChannels ++ && layouts.getNumChannels (false, 0) <= vstEffect->numOutputChannels); + } + + //============================================================================== + #if JUCE_IOS || JUCE_ANDROID + bool hasEditor() const override { return false; } + #else +- bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsHasEditor) != 0; } ++ bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagHasEditor) != 0; } + #endif + + AudioProcessorEditor* createEditor() override; +@@ -1515,9 +1513,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (isValidChannel (index, true)) + { +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0) +- return String (pinProps.label, sizeof (pinProps.label)); ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return String (pinProps.text, sizeof (pinProps.text)); + } + + return {}; +@@ -1528,9 +1526,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (! isValidChannel (index, true)) + return false; + +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0) +- return (pinProps.flags & Vst2::kVstPinIsStereo) != 0; ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0; + + return true; + } +@@ -1539,9 +1537,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (isValidChannel (index, false)) + { +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0) +- return String (pinProps.label, sizeof (pinProps.label)); ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return String (pinProps.text, sizeof (pinProps.text)); + } + + return {}; +@@ -1552,9 +1550,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (! isValidChannel (index, false)) + return false; + +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0) +- return (pinProps.flags & Vst2::kVstPinIsStereo) != 0; ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0; + + return true; + } +@@ -1569,12 +1567,12 @@ struct VSTPluginInstance : public AudioPluginInstance, + int getNumPrograms() override { return vstEffect != nullptr ? jmax (0, vstEffect->numPrograms) : 0; } + + // NB: some plugs return negative numbers from this function. +- int getCurrentProgram() override { return (int) dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); } ++ int getCurrentProgram() override { return (int) dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, 0, 0); } + + void setCurrentProgram (int newIndex) override + { + if (getNumPrograms() > 0 && newIndex != getCurrentProgram()) +- dispatch (Vst2::effSetProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), 0, 0); + } + + const String getProgramName (int index) override +@@ -1588,7 +1586,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + char nm[264] = { 0 }; + +- if (dispatch (Vst2::effGetProgramNameIndexed, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0) ++ if (dispatch (Vst2::plugInOpcodeGetProgramName, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0) + return String::fromUTF8 (nm).trim(); + } + } +@@ -1601,7 +1599,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (index >= 0 && index == getCurrentProgram()) + { + if (getNumPrograms() > 0 && newName != getCurrentProgramName()) +- dispatch (Vst2::effSetProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f); ++ dispatch (Vst2::plugInOpcodeSetCurrentProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f); + } + else + { +@@ -1619,7 +1617,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + //============================================================================== + void timerCallback() override + { +- if (dispatch (Vst2::effIdle, 0, 0, nullptr, 0) == 0) ++ if (dispatch (Vst2::plugInOpcodeIdle, 0, 0, nullptr, 0) == 0) + stopTimer(); + } + +@@ -1633,7 +1631,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + switch (opcode) + { +- case Vst2::audioMasterAutomate: ++ case Vst2::hostOpcodeParameterChanged: + if (auto* param = getParameters()[index]) + param->sendValueChangedMessageToListeners (opt); + else +@@ -1641,23 +1639,23 @@ struct VSTPluginInstance : public AudioPluginInstance, + + break; + +- case Vst2::audioMasterProcessEvents: handleMidiFromPlugin ((const Vst2::VstEvents*) ptr); break; +- case Vst2::audioMasterGetTime: return getVSTTime(); +- case Vst2::audioMasterIdle: handleIdle(); break; +- case Vst2::audioMasterSizeWindow: setWindowSize (index, (int) value); return 1; +- case Vst2::audioMasterUpdateDisplay: triggerAsyncUpdate(); break; +- case Vst2::audioMasterIOChanged: setLatencySamples (vstEffect->initialDelay); break; +- case Vst2::audioMasterNeedIdle: startTimer (50); break; ++ case Vst2::hostOpcodePreAudioProcessingEvents: handleMidiFromPlugin ((const Vst2::VstEventBlock*) ptr); break; ++ case Vst2::hostOpcodeGetTimingInfo: return getVSTTime(); ++ case Vst2::hostOpcodeIdle: handleIdle(); break; ++ case Vst2::hostOpcodeWindowSize: setWindowSize (index, (int) value); return 1; ++ case Vst2::hostOpcodeUpdateView: triggerAsyncUpdate(); break; ++ case Vst2::hostOpcodeIOModified: setLatencySamples (vstEffect->latency); break; ++ case Vst2::hostOpcodeNeedsIdle: startTimer (50); break; + +- case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue); +- case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue); +- case Vst2::audioMasterWantMidi: wantsMidiMessages = true; break; +- case Vst2::audioMasterGetDirectory: return getVstDirectory(); ++ case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue); ++ case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue); ++ case Vst2::hostOpcodePlugInWantsMidi: wantsMidiMessages = true; break; ++ case Vst2::hostOpcodeGetDirectory: return getVstDirectory(); + +- case Vst2::audioMasterTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0); +- case Vst2::audioMasterGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0); ++ case Vst2::hostOpcodeTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0); ++ case Vst2::hostOpcodeGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0); + +- case Vst2::audioMasterBeginEdit: ++ case Vst2::hostOpcodeParameterChangeGestureBegin: + if (auto* param = getParameters()[index]) + param->beginChangeGesture(); + else +@@ -1665,7 +1663,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + break; + +- case Vst2::audioMasterEndEdit: ++ case Vst2::hostOpcodeParameterChangeGestureEnd: + if (auto* param = getParameters()[index]) + param->endChangeGesture(); + else +@@ -1673,28 +1671,28 @@ struct VSTPluginInstance : public AudioPluginInstance, + + break; + +- case Vst2::audioMasterPinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true) +- case Vst2::audioMasterGetCurrentProcessLevel: return isNonRealtime() ? 4 : 0; ++ case Vst2::hostOpcodePinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true) ++ case Vst2::hostOpcodeGetCurrentAudioProcessingLevel: return isNonRealtime() ? 4 : 0; + + // none of these are handled (yet)... +- case Vst2::audioMasterSetTime: +- case Vst2::audioMasterGetParameterQuantization: +- case Vst2::audioMasterGetInputLatency: +- case Vst2::audioMasterGetOutputLatency: +- case Vst2::audioMasterGetPreviousPlug: +- case Vst2::audioMasterGetNextPlug: +- case Vst2::audioMasterWillReplaceOrAccumulate: +- case Vst2::audioMasterOfflineStart: +- case Vst2::audioMasterOfflineRead: +- case Vst2::audioMasterOfflineWrite: +- case Vst2::audioMasterOfflineGetCurrentPass: +- case Vst2::audioMasterOfflineGetCurrentMetaPass: +- case Vst2::audioMasterGetOutputSpeakerArrangement: +- case Vst2::audioMasterVendorSpecific: +- case Vst2::audioMasterSetIcon: +- case Vst2::audioMasterGetLanguage: +- case Vst2::audioMasterOpenWindow: +- case Vst2::audioMasterCloseWindow: ++ case Vst2::hostOpcodeSetTime: ++ case Vst2::hostOpcodeGetParameterInterval: ++ case Vst2::hostOpcodeGetInputLatency: ++ case Vst2::hostOpcodeGetOutputLatency: ++ case Vst2::hostOpcodeGetPreviousPlugIn: ++ case Vst2::hostOpcodeGetNextPlugIn: ++ case Vst2::hostOpcodeWillReplace: ++ case Vst2::hostOpcodeOfflineStart: ++ case Vst2::hostOpcodeOfflineReadSource: ++ case Vst2::hostOpcodeOfflineWrite: ++ case Vst2::hostOpcodeOfflineGetCurrentPass: ++ case Vst2::hostOpcodeOfflineGetCurrentMetaPass: ++ case Vst2::hostOpcodeGetOutputSpeakerConfiguration: ++ case Vst2::hostOpcodeManufacturerSpecific: ++ case Vst2::hostOpcodeSetIcon: ++ case Vst2::hostOpcodeGetLanguage: ++ case Vst2::hostOpcodeOpenEditorWindow: ++ case Vst2::hostOpcodeCloseEditorWindow: + break; + + default: +@@ -1709,19 +1707,19 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + switch (opcode) + { +- case Vst2::audioMasterCanDo: return handleCanDo ((const char*) ptr); +- case Vst2::audioMasterVersion: return 2400; +- case Vst2::audioMasterCurrentId: return shellUIDToCreate; +- case Vst2::audioMasterGetNumAutomatableParameters: return 0; +- case Vst2::audioMasterGetAutomationState: return 1; +- case Vst2::audioMasterGetVendorVersion: return 0x0101; ++ case Vst2::hostOpcodeCanHostDo: return handleCanDo ((const char*) ptr); ++ case Vst2::hostOpcodeVstVersion: return 2400; ++ case Vst2::hostOpcodeCurrentId: return shellUIDToCreate; ++ case Vst2::hostOpcodeGetNumberOfAutomatableParameters: return 0; ++ case Vst2::hostOpcodeGetAutomationState: return 1; ++ case Vst2::hostOpcodeGetManufacturerVersion: return 0x0101; + +- case Vst2::audioMasterGetVendorString: +- case Vst2::audioMasterGetProductString: return getHostName ((char*) ptr); ++ case Vst2::hostOpcodeGetManufacturerName: ++ case Vst2::hostOpcodeGetProductName: return getHostName ((char*) ptr); + +- case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue; +- case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue; +- case Vst2::audioMasterSetOutputSampleRate: return 0; ++ case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue; ++ case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue; ++ case Vst2::hostOpcodeSetOutputSampleRate: return 0; + + default: + DBG ("*** Unhandled VST Callback: " + String ((int) opcode)); +@@ -1750,7 +1748,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + UseResFile (vstModule->resFileId); + #endif + +- result = vstEffect->dispatcher (vstEffect, opcode, index, value, ptr, opt); ++ result = vstEffect->dispatchFunction (vstEffect, opcode, index, value, ptr, opt); + + #if JUCE_MAC + auto newResFile = CurResFile(); +@@ -1956,14 +1954,14 @@ struct VSTPluginInstance : public AudioPluginInstance, + return true; + } + +- bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsProgramChunks) != 0; } ++ bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagDataInChunks) != 0; } + + bool getChunkData (MemoryBlock& mb, bool isPreset, int maxSizeMB) const + { + if (usesChunks()) + { + void* data = nullptr; +- auto bytes = (size_t) dispatch (Vst2::effGetChunk, isPreset ? 1 : 0, 0, &data, 0.0f); ++ auto bytes = (size_t) dispatch (Vst2::plugInOpcodeGetData, isPreset ? 1 : 0, 0, &data, 0.0f); + + if (data != nullptr && bytes <= (size_t) maxSizeMB * 1024 * 1024) + { +@@ -1981,7 +1979,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (size > 0 && usesChunks()) + { +- dispatch (Vst2::effSetChunk, isPreset ? 1 : 0, size, (void*) data, 0.0f); ++ dispatch (Vst2::plugInOpcodeSetData, isPreset ? 1 : 0, size, (void*) data, 0.0f); + + if (! isPreset) + updateStoredProgramNames(); +@@ -1992,7 +1990,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + return false; + } + +- Vst2::AEffect* vstEffect; ++ Vst2::VstEffectInterface* vstEffect; + ModuleHandle::Ptr vstModule; + + std::unique_ptr extraFunctions; +@@ -2015,7 +2013,7 @@ private: + currentValue = (newValue != 0.0f); + + if (parent.vstSupportsBypass) +- parent.dispatch (Vst2::effSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f); ++ parent.dispatch (Vst2::plugInOpcodeSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f); + } + + float getValueForText (const String& text) const override +@@ -2061,7 +2059,7 @@ private: + CriticalSection midiInLock; + MidiBuffer incomingMidi; + VSTMidiEventList midiEventsToSend; +- Vst2::VstTimeInfo vstHostTime; ++ Vst2::VstTimingInformation vstHostTime; + + AudioBuffer tmpBufferFloat; + HeapBlock channelBufferFloat; +@@ -2098,7 +2096,7 @@ private: + if (auto* app = JUCEApplicationBase::getInstance()) + hostName = app->getApplicationName(); + +- hostName.copyToUTF8 (name, (size_t) jmin (Vst2::kVstMaxVendorStrLen, Vst2::kVstMaxProductStrLen) - 1); ++ hostName.copyToUTF8 (name, (size_t) jmin (Vst2::vstMaxManufacturerStringLength, Vst2::vstMaxPlugInNameStringLength) - 1); + return 1; + } + +@@ -2124,7 +2122,7 @@ private: + + #if JUCE_MAC + if (getActiveEditor() != nullptr) +- dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0); + #endif + + Timer::callPendingTimersSynchronously(); +@@ -2159,9 +2157,9 @@ private: + } + + //============================================================================== +- static Vst2::AEffect* constructEffect (const ModuleHandle::Ptr& module) ++ static Vst2::VstEffectInterface* constructEffect (const ModuleHandle::Ptr& module) + { +- Vst2::AEffect* effect = nullptr; ++ Vst2::VstEffectInterface* effect = nullptr; + try + { + const IdleCallRecursionPreventer icrp; +@@ -2178,10 +2176,10 @@ private: + JUCE_VST_WRAPPER_INVOKE_MAIN + } + +- if (effect != nullptr && effect->magic == 0x56737450 /* 'VstP' */) ++ if (effect != nullptr && effect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier) + { +- jassert (effect->resvd2 == 0); +- jassert (effect->object != nullptr); ++ jassert (effect->hostSpace2 == 0); ++ jassert (effect->effectPointer != 0); + + _fpreset(); // some dodgy plugs mess around with this + } +@@ -2196,11 +2194,11 @@ private: + return effect; + } + +- static BusesProperties queryBusIO (Vst2::AEffect* effect) ++ static BusesProperties queryBusIO (Vst2::VstEffectInterface* effect) + { + BusesProperties returnValue; + +- if (effect->numInputs == 0 && effect->numOutputs == 0) ++ if (effect->numInputChannels == 0 && effect->numOutputChannels == 0) + return returnValue; + + // Workaround for old broken JUCE plug-ins which would return an invalid +@@ -2211,14 +2209,14 @@ private: + // plug-in is reporting. + if (! pluginHasDefaultChannelLayouts (effect)) + { +- SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputs)); +- SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputs)); ++ SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputChannels)); ++ SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputChannels)); + +- effect->dispatcher (effect, Vst2::effSetSpeakerArrangement, 0, ++ effect->dispatchFunction (effect, Vst2::plugInOpcodeSetSpeakerConfiguration, 0, + (pointer_sized_int) &canonicalIn.get(), (void*) &canonicalOut.get(), 0.0f); + } + +- HeapBlock inArrBlock (1, true), outArrBlock (1, true); ++ HeapBlock inArrBlock (1, true), outArrBlock (1, true); + + auto* inArr = inArrBlock.get(); + auto* outArr = outArrBlock.get(); +@@ -2229,35 +2227,35 @@ private: + for (int dir = 0; dir < 2; ++dir) + { + const bool isInput = (dir == 0); +- const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties); +- const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs); +- const Vst2::VstSpeakerArrangement* arr = (isInput ? inArr : outArr); ++ const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties); ++ const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels); ++ const Vst2::VstSpeakerConfiguration* arr = (isInput ? inArr : outArr); + bool busAdded = false; + +- Vst2::VstPinProperties pinProps; ++ Vst2::VstPinInfo pinProps; + AudioChannelSet layout; + + for (int ch = 0; ch < maxChannels; ch += layout.size()) + { +- if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) ++ if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) + break; + +- if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0) ++ if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0) + { +- layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.arrangementType, 0); ++ layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.configurationType, 0); + + if (layout.isDisabled()) + break; + } + else if (arr == nullptr) + { +- layout = ((pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono()); ++ layout = ((pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono()); + } + else + break; + + busAdded = true; +- returnValue.addBus (isInput, pinProps.label, layout, true); ++ returnValue.addBus (isInput, pinProps.text, layout, true); + } + + // no buses? +@@ -2265,8 +2263,8 @@ private: + { + String busName = (isInput ? "Input" : "Output"); + +- if (effect->dispatcher (effect, opcode, 0, 0, &pinProps, 0.0f) != 0) +- busName = pinProps.label; ++ if (effect->dispatchFunction (effect, opcode, 0, 0, &pinProps, 0.0f) != 0) ++ busName = pinProps.text; + + if (arr != nullptr) + layout = SpeakerMappings::vstArrangementTypeToChannelSet (*arr); +@@ -2280,9 +2278,9 @@ private: + return returnValue; + } + +- static bool pluginHasDefaultChannelLayouts (Vst2::AEffect* effect) ++ static bool pluginHasDefaultChannelLayouts (Vst2::VstEffectInterface* effect) + { +- HeapBlock inArrBlock (1, true), outArrBlock (1, true); ++ HeapBlock inArrBlock (1, true), outArrBlock (1, true); + + auto* inArr = inArrBlock.get(); + auto* outArr = outArrBlock.get(); +@@ -2293,40 +2291,40 @@ private: + for (int dir = 0; dir < 2; ++dir) + { + const bool isInput = (dir == 0); +- const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties); +- const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs); ++ const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties); ++ const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels); + + int channels = 1; + + for (int ch = 0; ch < maxChannels; ch += channels) + { +- Vst2::VstPinProperties pinProps; ++ Vst2::VstPinInfo pinProps; + +- if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) ++ if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) + return false; + +- if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0) ++ if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0) + return true; + +- channels = (pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? 2 : 1; ++ channels = (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? 2 : 1; + } + } + + return false; + } + +- static bool getSpeakerArrangementWrapper (Vst2::AEffect* effect, +- Vst2::VstSpeakerArrangement* inArr, +- Vst2::VstSpeakerArrangement* outArr) ++ static bool getSpeakerArrangementWrapper (Vst2::VstEffectInterface* effect, ++ Vst2::VstSpeakerConfiguration* inArr, ++ Vst2::VstSpeakerConfiguration* outArr) + { + // Workaround: unfortunately old JUCE VST-2 plug-ins had a bug and would crash if + // you try to get the speaker arrangement when there are no input channels present. + // Hopefully, one day (when there are no more old JUCE plug-ins around), we can + // comment out the next two lines. +- if (effect->numInputs == 0) ++ if (effect->numInputChannels == 0) + return false; + +- return (effect->dispatcher (effect, Vst2::effGetSpeakerArrangement, 0, ++ return (effect->dispatchFunction (effect, Vst2::plugInOpcodeGetSpeakerArrangement, 0, + reinterpret_cast (&inArr), &outArr, 0.0f) != 0); + } + +@@ -2360,56 +2358,56 @@ private: + if (currentPlayHead->getCurrentPosition (position)) + { + +- vstHostTime.samplePos = (double) position.timeInSamples; +- vstHostTime.tempo = position.bpm; +- vstHostTime.timeSigNumerator = position.timeSigNumerator; +- vstHostTime.timeSigDenominator = position.timeSigDenominator; +- vstHostTime.ppqPos = position.ppqPosition; +- vstHostTime.barStartPos = position.ppqPositionOfLastBarStart; +- vstHostTime.flags |= Vst2::kVstTempoValid +- | Vst2::kVstTimeSigValid +- | Vst2::kVstPpqPosValid +- | Vst2::kVstBarsValid; ++ vstHostTime.samplePosition = (double) position.timeInSamples; ++ vstHostTime.tempoBPM = position.bpm; ++ vstHostTime.timeSignatureNumerator = position.timeSigNumerator; ++ vstHostTime.timeSignatureDenominator = position.timeSigDenominator; ++ vstHostTime.musicalPosition = position.ppqPosition; ++ vstHostTime.lastBarPosition = position.ppqPositionOfLastBarStart; ++ vstHostTime.flags |= Vst2::vstTimingInfoFlagTempoValid ++ | Vst2::vstTimingInfoFlagTimeSignatureValid ++ | Vst2::vstTimingInfoFlagMusicalPositionValid ++ | Vst2::vstTimingInfoFlagLastBarPositionValid; + + int32 newTransportFlags = 0; +- if (position.isPlaying) newTransportFlags |= Vst2::kVstTransportPlaying; +- if (position.isRecording) newTransportFlags |= Vst2::kVstTransportRecording; ++ if (position.isPlaying) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyPlaying; ++ if (position.isRecording) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyRecording; + +- if (newTransportFlags != (vstHostTime.flags & (Vst2::kVstTransportPlaying +- | Vst2::kVstTransportRecording))) +- vstHostTime.flags = (vstHostTime.flags & ~(Vst2::kVstTransportPlaying | Vst2::kVstTransportRecording)) | newTransportFlags | Vst2::kVstTransportChanged; ++ if (newTransportFlags != (vstHostTime.flags & (Vst2::vstTimingInfoFlagCurrentlyPlaying ++ | Vst2::vstTimingInfoFlagCurrentlyRecording))) ++ vstHostTime.flags = (vstHostTime.flags & ~(Vst2::vstTimingInfoFlagCurrentlyPlaying | Vst2::vstTimingInfoFlagCurrentlyRecording)) | newTransportFlags | Vst2::vstTimingInfoFlagTransportChanged; + else +- vstHostTime.flags &= ~Vst2::kVstTransportChanged; ++ vstHostTime.flags &= ~Vst2::vstTimingInfoFlagTransportChanged; + + switch (position.frameRate) + { +- case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::kVstSmpte24fps, 24.0, position.timeInSeconds); break; +- case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::kVstSmpte25fps, 25.0, position.timeInSeconds); break; +- case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::kVstSmpte30fps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::kVstSmpte60fps, 60.0, position.timeInSeconds); break; +- +- case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::kVstSmpte239fps, 24.0, position.timeInSeconds); break; +- case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997fps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997dfps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte30dfps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte599fps, 60.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::vstSmpteRateFps24, 24.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::vstSmpteRateFps25, 25.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::vstSmpteRateFps30, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::vstSmpteRateFps60, 60.0, position.timeInSeconds); break; ++ ++ case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps239, 24.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997drop, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps30drop, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps599, 60.0, position.timeInSeconds); break; + default: break; + } + + if (position.isLooping) + { +- vstHostTime.cycleStartPos = position.ppqLoopStart; +- vstHostTime.cycleEndPos = position.ppqLoopEnd; +- vstHostTime.flags |= (Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive); ++ vstHostTime.loopStartPosition = position.ppqLoopStart; ++ vstHostTime.loopEndPosition = position.ppqLoopEnd; ++ vstHostTime.flags |= (Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive); + } + else + { +- vstHostTime.flags &= ~(Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive); ++ vstHostTime.flags &= ~(Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive); + } + } + } + +- vstHostTime.nanoSeconds = getVSTHostTimeNanoseconds(); ++ vstHostTime.systemTimeNanoseconds = getVSTHostTimeNanoseconds(); + + if (wantsMidiMessages) + { +@@ -2424,13 +2422,13 @@ private: + midiEventsToSend.addEvent (midiData, numBytesOfMidiData, + jlimit (0, numSamples - 1, samplePosition)); + +- vstEffect->dispatcher (vstEffect, Vst2::effProcessEvents, 0, 0, midiEventsToSend.events, 0); ++ vstEffect->dispatchFunction (vstEffect, Vst2::plugInOpcodePreAudioProcessingEvents, 0, 0, midiEventsToSend.events, 0); + } + + _clearfp(); + + // always ensure that the buffer is at least as large as the maximum number of channels +- auto maxChannels = jmax (vstEffect->numInputs, vstEffect->numOutputs); ++ auto maxChannels = jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels); + auto channels = channelBuffer.get(); + + if (numChannels < maxChannels) +@@ -2469,35 +2467,35 @@ private: + //============================================================================== + inline void invokeProcessFunction (AudioBuffer& buffer, int32 sampleFrames) + { +- if ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0) ++ if ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0) + { +- vstEffect->processReplacing (vstEffect, buffer.getArrayOfWritePointers(), ++ vstEffect->processAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(), + buffer.getArrayOfWritePointers(), sampleFrames); + } + else + { +- outOfPlaceBuffer.setSize (vstEffect->numOutputs, sampleFrames); ++ outOfPlaceBuffer.setSize (vstEffect->numOutputChannels, sampleFrames); + outOfPlaceBuffer.clear(); + +- vstEffect->process (vstEffect, buffer.getArrayOfWritePointers(), +- outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames); ++ vstEffect->processAudioFunction (vstEffect, buffer.getArrayOfWritePointers(), ++ outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames); + +- for (int i = vstEffect->numOutputs; --i >= 0;) ++ for (int i = vstEffect->numOutputChannels; --i >= 0;) + buffer.copyFrom (i, 0, outOfPlaceBuffer.getReadPointer (i), sampleFrames); + } + } + + inline void invokeProcessFunction (AudioBuffer& buffer, int32 sampleFrames) + { +- vstEffect->processDoubleReplacing (vstEffect, buffer.getArrayOfWritePointers(), ++ vstEffect->processDoubleAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(), + buffer.getArrayOfWritePointers(), sampleFrames); + } + + //============================================================================== + void setHostTimeFrameRate (long frameRateIndex, double frameRate, double currentTime) noexcept + { +- vstHostTime.flags |= Vst2::kVstSmpteValid; +- vstHostTime.smpteFrameRate = (int32) frameRateIndex; ++ vstHostTime.flags |= Vst2::vstTimingInfoFlagSmpteValid; ++ vstHostTime.smpteRate = (int32) frameRateIndex; + vstHostTime.smpteOffset = (int32) (currentTime * 80.0 * frameRate + 0.5); + } + +@@ -2528,7 +2526,7 @@ private: + if (vstEffect == nullptr) + return {}; + +- jassert (index >= 0 && index < vstEffect->numParams); ++ jassert (index >= 0 && index < vstEffect->numParameters); + char nm[256] = { 0 }; + dispatch (opcode, index, 0, nm, 0); + return String::createStringFromData (nm, (int) sizeof (nm)).trim(); +@@ -2542,7 +2540,7 @@ private: + { + { + char nm[256] = { 0 }; +- dispatch (Vst2::effGetProgramName, 0, 0, nm, 0); ++ dispatch (Vst2::plugInOpcodeGetCurrentProgramName, 0, 0, nm, 0); + progName = String::createStringFromData (nm, (int) sizeof (nm)).trim(); + } + +@@ -2586,7 +2584,7 @@ private: + char nm[256] = { 0 }; + + // only do this if the plugin can't use indexed names.. +- if (dispatch (Vst2::effGetProgramNameIndexed, 0, -1, nm, 0) == 0) ++ if (dispatch (Vst2::plugInOpcodeGetProgramName, 0, -1, nm, 0) == 0) + { + auto oldProgram = getCurrentProgram(); + MemoryBlock oldSettings; +@@ -2604,7 +2602,7 @@ private: + } + } + +- void handleMidiFromPlugin (const Vst2::VstEvents* events) ++ void handleMidiFromPlugin (const Vst2::VstEventBlock* events) + { + if (events != nullptr) + { +@@ -2651,11 +2649,11 @@ private: + } + + //============================================================================== +- int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->version : 0; } ++ int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->plugInVersion : 0; } + + String getVersion() const + { +- auto v = (unsigned int) dispatch (Vst2::effGetVendorVersion, 0, 0, nullptr, 0); ++ auto v = (unsigned int) dispatch (Vst2::plugInOpcodeGetManufacturerVersion, 0, 0, nullptr, 0); + + String s; + +@@ -2728,7 +2726,7 @@ private: + + void setPower (const bool on) + { +- dispatch (Vst2::effMainsChanged, 0, on ? 1 : 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeResumeSuspend, 0, on ? 1 : 0, nullptr, 0); + isPowerOn = on; + } + +@@ -2797,11 +2795,11 @@ public: + + activeVSTWindows.add (this); + +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + + if (rect != nullptr) +- setSize (rect->right - rect->left, rect->bottom - rect->top); ++ setSize (rect->rightmost - rect->leftmost, rect->lower - rect->upper); + else + setSize (1, 1); + +@@ -2952,11 +2950,11 @@ public: + setScaleFactorAndDispatchMessage (newScaleFactor); + + #if JUCE_WINDOWS +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + +- if (! isWindowSizeCorrectForPlugin (roundToInt ((rect->right - rect->left) / nativeScaleFactor), +- roundToInt ((rect->bottom - rect->top) / nativeScaleFactor))) ++ if (! isWindowSizeCorrectForPlugin (roundToInt ((rect->rightmost - rect->leftmost) / nativeScaleFactor), ++ roundToInt ((rect->lower - rect->upper) / nativeScaleFactor))) + return; + #endif + +@@ -2971,7 +2969,7 @@ public: + nativeScaleFactor = (float) newScaleFactor; + + if (pluginRespondsToDPIChanges) +- dispatch (Vst2::effVendorSpecific, ++ dispatch (Vst2::plugInOpcodeManufacturerSpecific, + JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'), + JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's'), + nullptr, nativeScaleFactor); +@@ -3000,7 +2998,7 @@ public: + if (! reentrantGuard) + { + reentrantGuard = true; +- plugin.dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0); ++ plugin.dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0); + reentrantGuard = false; + } + +@@ -3032,7 +3030,7 @@ public: + activeVSTWindows.add (this); + + #if JUCE_MAC +- dispatch (Vst2::effEditTop, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeeffEditorTop, 0, 0, nullptr, 0); + #endif + } + +@@ -3081,24 +3079,24 @@ private: + + isOpen = true; + +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- dispatch (Vst2::effEditOpen, 0, 0, parentWindow, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, parentWindow, 0); + + // do this before and after like in the steinberg example +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code + + // Install keyboard hooks +- pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0); ++ pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0); + + // double-check it's not too tiny + int w = 250, h = 150; + + if (rect != nullptr) + { +- w = rect->right - rect->left; +- h = rect->bottom - rect->top; ++ w = rect->rightmost - rect->leftmost; ++ h = rect->lower - rect->upper; + + if (w == 0 || h == 0) + { +@@ -3136,15 +3134,15 @@ private: + dpiDisabler.reset (new ScopedDPIAwarenessDisabler()); + #endif + +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + + #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE + // some plug-ins are fussy about this + dpiDisabler.reset (nullptr); + #endif + +- dispatch (Vst2::effEditOpen, 0, 0, getWindowHandle(), 0); ++ dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, getWindowHandle(), 0); + + #if JUCE_WINDOWS && JUCE_WIN_PER_MONITOR_DPI_AWARE + if (! pluginRespondsToDPIChanges) +@@ -3152,11 +3150,11 @@ private: + #endif + + // do this before and after like in the steinberg example +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code + + // Install keyboard hooks +- pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0); ++ pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0); + + #if JUCE_WINDOWS + originalWndProc = 0; +@@ -3191,8 +3189,8 @@ private: + + if (rect != nullptr) + { +- auto rw = rect->right - rect->left; +- auto rh = rect->bottom - rect->top; ++ auto rw = rect->rightmost - rect->leftmost; ++ auto rh = rect->lower - rect->upper; + + if ((rw > 50 && rh > 50 && rw < 2000 && rh < 2000 && (! isWithin (w, rw, 2) || ! isWithin (h, rh, 2))) + || ((w == 0 && rw > 0) || (h == 0 && rh > 0))) +@@ -3223,8 +3221,8 @@ private: + + if (rect != nullptr) + { +- w = rect->right - rect->left; +- h = rect->bottom - rect->top; ++ w = rect->rightmost - rect->leftmost; ++ h = rect->lower - rect->upper; + + if (w == 0 || h == 0) + { +@@ -3266,7 +3264,7 @@ private: + + JUCE_VST_LOG ("Closing VST UI: " + plugin.getName()); + isOpen = false; +- dispatch (Vst2::effEditClose, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, nullptr, 0); + stopTimer(); + + #if JUCE_WINDOWS +@@ -3312,11 +3310,11 @@ private: + #if JUCE_WIN_PER_MONITOR_DPI_AWARE + if (! pluginRespondsToDPIChanges) + { +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + +- auto w = roundToInt ((rect->right - rect->left) / nativeScaleFactor); +- auto h = roundToInt ((rect->bottom - rect->top) / nativeScaleFactor); ++ auto w = roundToInt ((rect->rightmost - rect->leftmost) / nativeScaleFactor); ++ auto h = roundToInt ((rect->lower - rect->upper) / nativeScaleFactor); + + if (! isWindowSizeCorrectForPlugin (w, h)) + { +@@ -3412,17 +3410,17 @@ private: + if (owner.isOpen) + { + owner.isOpen = false; +- owner.dispatch (Vst2::effEditClose, 0, 0, 0, 0); +- owner.dispatch (Vst2::effEditSleep, 0, 0, 0, 0); ++ owner.dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, 0, 0); ++ owner.dispatch (Vst2::plugInOpcodeSleepEditor, 0, 0, 0, 0); + } + } + + bool getEmbeddedViewSize (int& w, int& h) override + { +- Vst2::ERect* rect = nullptr; +- owner.dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- w = rect->right - rect->left; +- h = rect->bottom - rect->top; ++ Vst2::VstEditorBounds* rect = nullptr; ++ owner.dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ w = rect->rightmost - rect->leftmost; ++ h = rect->lower - rect->upper; + return true; + } + +@@ -3432,7 +3430,7 @@ private: + { + alreadyInside = true; + getTopLevelComponent()->toFront (true); +- owner.dispatch (Vst2::effEditMouse, x, y, 0, 0); ++ owner.dispatch (Vst2::plugInOpcodeGetMouse, x, y, 0, 0); + alreadyInside = false; + } + else +@@ -3446,13 +3444,13 @@ private: + if (auto* peer = getPeer()) + { + auto pos = peer->globalToLocal (getScreenPosition()); +- Vst2::ERect r; +- r.left = (int16) pos.getX(); +- r.top = (int16) pos.getY(); +- r.right = (int16) (r.left + getWidth()); +- r.bottom = (int16) (r.top + getHeight()); ++ Vst2::VstEditorBounds r; ++ r.leftmost = (int16) pos.getX(); ++ r.upper = (int16) pos.getY(); ++ r.rightmost = (int16) (r.leftmost + getWidth()); ++ r.lower = (int16) (r.upper + getHeight()); + +- owner.dispatch (Vst2::effEditDraw, 0, 0, &r, 0); ++ owner.dispatch (Vst2::plugInOpcodeDrawEditor, 0, 0, &r, 0); + } + } + +@@ -3501,10 +3499,10 @@ AudioProcessorEditor* VSTPluginInstance::createEditor() + + //============================================================================== + // entry point for all callbacks from the plugin +-static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt) ++static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt) + { + if (effect != nullptr) +- if (auto* instance = (VSTPluginInstance*) (effect->resvd2)) ++ if (auto* instance = (VSTPluginInstance*) (effect->hostSpace2)) + return instance->handleCallback (opcode, index, value, ptr, opt); + + return VSTPluginInstance::handleGeneralCallback (opcode, index, value, ptr, opt); +@@ -3555,7 +3553,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray& result + // Normal plugin... + results.add (new PluginDescription (desc)); + +- instance->dispatch (Vst2::effOpen, 0, 0, nullptr, 0); ++ instance->dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0); + } + else + { +@@ -3563,7 +3561,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray& result + for (;;) + { + char shellEffectName [256] = { 0 }; +- auto uid = (int) instance->dispatch (Vst2::effShellGetNextPlugin, 0, 0, shellEffectName, 0); ++ auto uid = (int) instance->dispatch (Vst2::plugInOpcodeNextPlugInUniqueID, 0, 0, shellEffectName, 0); + + if (uid == 0) + break; +@@ -3789,8 +3787,8 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct + + AudioPluginInstance* VSTPluginFormat::getPluginInstanceFromVstEffectInterface (void* aEffect) + { +- if (auto* vstAEffect = reinterpret_cast (aEffect)) +- if (auto* instanceVST = reinterpret_cast (vstAEffect->resvd2)) ++ if (auto* vstAEffect = reinterpret_cast (aEffect)) ++ if (auto* instanceVST = reinterpret_cast (vstAEffect->hostSpace2)) + return dynamic_cast (instanceVST); + + return nullptr; diff --git a/libs/juce-current/patches/local-ladspa.patch b/libs/juce-current/patches/local-ladspa.patch new file mode 100644 index 00000000..49e22620 --- /dev/null +++ b/libs/juce-current/patches/local-ladspa.patch @@ -0,0 +1,13 @@ +diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +index d65642de6..050941c6c 100644 +--- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp ++++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +@@ -18,7 +18,7 @@ + + #if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX + +-#include ++#include "ladspa.h" + + namespace juce + { diff --git a/libs/juce-current/patches/maybe-not-needed/fix-distrho-juceplugin-includes.patch b/libs/juce-current/patches/maybe-not-needed/fix-distrho-juceplugin-includes.patch new file mode 100644 index 00000000..c835e726 --- /dev/null +++ b/libs/juce-current/patches/maybe-not-needed/fix-distrho-juceplugin-includes.patch @@ -0,0 +1,13 @@ +diff --git a/modules/juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h b/modules/juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h +index 701c4df..0e8a324 100644 +--- a/modules/juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h ++++ b/modules/juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h +@@ -24,6 +24,8 @@ + ============================================================================== + */ + ++#pragma once ++ + #include "../juce_audio_plugin_client.h" + + namespace juce diff --git a/libs/juce-current/patches/maybe-not-needed/mingw-fixes.patch b/libs/juce-current/patches/maybe-not-needed/mingw-fixes.patch new file mode 100644 index 00000000..3e298978 --- /dev/null +++ b/libs/juce-current/patches/maybe-not-needed/mingw-fixes.patch @@ -0,0 +1,44 @@ +diff --git a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp +index c919767..e6d88aa 100644 +--- a/modules/juce_audio_devices/native/juce_win32_ASIO.cpp ++++ b/modules/juce_audio_devices/native/juce_win32_ASIO.cpp +@@ -1413,7 +1413,11 @@ private: + + void setCallbackFunctions() noexcept + { +- ASIOCallbackFunctions<0>::setCallbacksForDevice (callbacks, this); ++ /**/ if (currentASIODev[0] == this) ASIOCallbackFunctions<0>::setCallbacks (callbacks); ++ else if (currentASIODev[1] == this) ASIOCallbackFunctions<1>::setCallbacks (callbacks); ++ else if (currentASIODev[2] == this) ASIOCallbackFunctions<2>::setCallbacks (callbacks); ++ else if (currentASIODev[3] == this) ASIOCallbackFunctions<3>::setCallbacks (callbacks); ++ else jassertfalse; + } + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ASIOAudioIODevice) +diff --git a/modules/juce_audio_processors/format_types/juce_VST3Headers.h b/modules/juce_audio_processors/format_types/juce_VST3Headers.h +index 1eec325..de33170 100644 +--- a/modules/juce_audio_processors/format_types/juce_VST3Headers.h ++++ b/modules/juce_audio_processors/format_types/juce_VST3Headers.h +@@ -86,6 +86,9 @@ + #include + #include + #else ++ #if JUCE_MINGW ++ #define _set_abort_behavior(...) ++ #endif + #include + #include + #include +diff --git a/modules/juce_core/native/juce_BasicNativeHeaders.h b/modules/juce_core/native/juce_BasicNativeHeaders.h +index 088832b..9ce110c 100644 +--- a/modules/juce_core/native/juce_BasicNativeHeaders.h ++++ b/modules/juce_core/native/juce_BasicNativeHeaders.h +@@ -117,7 +117,7 @@ + #define STRICT 1 + #define WIN32_LEAN_AND_MEAN 1 + #if JUCE_MINGW +- #define _WIN32_WINNT 0x0501 ++ #define _WIN32_WINNT 0x0502 + #else + #define _WIN32_WINNT 0x0602 + #endif diff --git a/libs/juce-current/patches/maybe-not-needed/mingw-fixes_pt2.patch b/libs/juce-current/patches/maybe-not-needed/mingw-fixes_pt2.patch new file mode 100644 index 00000000..2f3d658a --- /dev/null +++ b/libs/juce-current/patches/maybe-not-needed/mingw-fixes_pt2.patch @@ -0,0 +1,201 @@ +diff --git a/modules/juce_audio_basics/juce_audio_basics.cpp b/modules/juce_audio_basics/juce_audio_basics.cpp +index c5a6bfa..fae5bff 100644 +--- a/modules/juce_audio_basics/juce_audio_basics.cpp ++++ b/modules/juce_audio_basics/juce_audio_basics.cpp +@@ -31,7 +31,7 @@ + + #include "juce_audio_basics.h" + +-#if JUCE_MINGW && ! defined (__SSE2__) ++#if JUCE_MINGW + #define JUCE_USE_SSE_INTRINSICS 0 + #endif + +diff --git a/modules/juce_audio_processors/format_types/juce_VST3Headers.h b/modules/juce_audio_processors/format_types/juce_VST3Headers.h +index de33170..ef37a65 100644 +--- a/modules/juce_audio_processors/format_types/juce_VST3Headers.h ++++ b/modules/juce_audio_processors/format_types/juce_VST3Headers.h +@@ -90,12 +90,13 @@ + #define _set_abort_behavior(...) + #endif + #include ++ #include + #include + #include + #include + #include + #include +- #include ++ #include + #include + #include + #include +diff --git a/modules/juce_events/native/juce_win32_Messaging.cpp b/modules/juce_events/native/juce_win32_Messaging.cpp +index f55e540..12858ba 100644 +--- a/modules/juce_events/native/juce_win32_Messaging.cpp ++++ b/modules/juce_events/native/juce_win32_Messaging.cpp +@@ -104,7 +104,7 @@ namespace WindowsMessageHelpers + } + } + +-#if JUCE_MODULE_AVAILABLE_juce_gui_extra ++#if JUCE_MODULE_AVAILABLE_juce_gui_extra && ! JUCE_MINGW + LRESULT juce_offerEventToActiveXControl (::MSG&); + #endif + +@@ -119,7 +119,7 @@ bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPend + + if (GetMessage (&m, (HWND) 0, 0, 0) >= 0) + { +- #if JUCE_MODULE_AVAILABLE_juce_gui_extra ++ #if JUCE_MODULE_AVAILABLE_juce_gui_extra && ! JUCE_MINGW + if (juce_offerEventToActiveXControl (m) != S_FALSE) + return true; + #endif +diff --git a/modules/juce_gui_basics/juce_gui_basics.cpp b/modules/juce_gui_basics/juce_gui_basics.cpp +index b710d39..a98f00e 100644 +--- a/modules/juce_gui_basics/juce_gui_basics.cpp ++++ b/modules/juce_gui_basics/juce_gui_basics.cpp +@@ -83,6 +83,7 @@ + + #if JUCE_MINGW + #include ++ #define JUCE_DISABLE_WIN32_DPI_AWARENESS 1 + #endif + + //============================================================================== +diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +index 569c400..a390474 100644 +--- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp ++++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +@@ -206,6 +206,10 @@ extern void* getUser32Function (const char*); + }; + #endif + ++#if JUCE_MINGW ++static bool canUseMultiTouch() { return false; } ++static void checkForPointerAPI() { } ++#else + typedef BOOL (WINAPI* RegisterTouchWindowFunc) (HWND, ULONG); + typedef BOOL (WINAPI* GetTouchInputInfoFunc) (HTOUCHINPUT, UINT, TOUCHINPUT*, int); + typedef BOOL (WINAPI* CloseTouchInputHandleFunc) (HTOUCHINPUT); +@@ -259,6 +263,7 @@ static void checkForPointerAPI() + && getPointerTouchInfo != nullptr + && getPointerPenInfo != nullptr); + } ++#endif + + static Rectangle rectangleFromRECT (const RECT& r) noexcept + { +@@ -1578,7 +1583,9 @@ private: + case WM_MOUSEACTIVATE: + case WM_NCMOUSEHOVER: + case WM_MOUSEHOVER: ++#if ! JUCE_MINGW + case WM_TOUCH: ++#endif + case WM_POINTERUPDATE: + case WM_NCPOINTERUPDATE: + case WM_POINTERWHEEL: +@@ -1694,8 +1701,10 @@ private: + + RegisterDragDrop (hwnd, dropTarget); + ++#if ! JUCE_MINGW + if (canUseMultiTouch()) + registerTouchWindow (hwnd, 0); ++#endif + + setDPIAwareness(); + setMessageFilter(); +@@ -2025,8 +2034,10 @@ private: + + bool isTouchEvent() noexcept + { ++#if ! JUCE_MINGW + if (registerTouchWindow == nullptr) + return false; ++#endif + + // Relevant info about touch/pen detection flags: + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320(v=vs.85).aspx +@@ -2194,6 +2205,7 @@ private: + + static MouseInputSource::InputSourceType getPointerType (WPARAM wParam) + { ++#if ! JUCE_MINGW + if (getPointerTypeFunction != nullptr) + { + POINTER_INPUT_TYPE pointerType; +@@ -2207,6 +2219,7 @@ private: + return MouseInputSource::InputSourceType::pen; + } + } ++#endif + + return MouseInputSource::InputSourceType::mouse; + } +@@ -2228,6 +2241,7 @@ private: + peer->handleMouseWheel (getPointerType (wParam), localPos, getMouseEventTime(), wheel); + } + ++#if ! JUCE_MINGW + bool doGestureEvent (LPARAM lParam) + { + GESTUREINFO gi; +@@ -2403,6 +2417,7 @@ private: + + return touchInput; + } ++#endif + + bool handlePenInput (POINTER_PEN_INFO penInfo, Point pos, const float pressure, bool isDown, bool isUp) + { +@@ -2945,6 +2960,7 @@ private: + + return 1; + ++#if ! JUCE_MINGW + //============================================================================== + case WM_POINTERUPDATE: + if (handlePointerInput (wParam, lParam, false, false)) +@@ -2960,6 +2976,7 @@ private: + if (handlePointerInput (wParam, lParam, false, true)) + return 0; + break; ++#endif + + //============================================================================== + case WM_MOUSEMOVE: doMouseMove (getPointFromLParam (lParam), false); return 0; +@@ -2990,6 +3007,7 @@ private: + + return 0; + ++#if ! JUCE_MINGW + case WM_TOUCH: + if (getTouchInputInfo != nullptr) + return doTouchEvent ((int) wParam, (HTOUCHINPUT) lParam); +@@ -3001,6 +3019,7 @@ private: + return 0; + + break; ++#endif + + //============================================================================== + case WM_SIZING: return handleSizeConstraining (*(RECT*) lParam, wParam); +@@ -3898,6 +3917,7 @@ static BOOL CALLBACK enumMonitorsProc (HMONITOR hm, HDC, LPRECT r, LPARAM userIn + const bool isMain = (info.dwFlags & 1 /* MONITORINFOF_PRIMARY */) != 0; + double dpi = 0; + ++ #if ! JUCE_DISABLE_WIN32_DPI_AWARENESS + if (getDPIForMonitor != nullptr) + { + UINT dpiX = 0, dpiY = 0; +@@ -3905,6 +3925,7 @@ static BOOL CALLBACK enumMonitorsProc (HMONITOR hm, HDC, LPRECT r, LPARAM userIn + if (SUCCEEDED (getDPIForMonitor (hm, MDT_Default, &dpiX, &dpiY))) + dpi = (dpiX + dpiY) / 2.0; + } ++ #endif + + ((Array*) userInfo)->add (MonitorInfo (rectangleFromRECT (*r), isMain, dpi)); + diff --git a/libs/juce-current/patches/maybe-not-needed/mingw-fixes_temp-pt1.patch b/libs/juce-current/patches/maybe-not-needed/mingw-fixes_temp-pt1.patch new file mode 100644 index 00000000..5dff6538 --- /dev/null +++ b/libs/juce-current/patches/maybe-not-needed/mingw-fixes_temp-pt1.patch @@ -0,0 +1,79 @@ +diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp +index 7d10dfa..a2d6a97 100644 +--- a/modules/juce_core/juce_core.cpp ++++ b/modules/juce_core/juce_core.cpp +@@ -60,6 +60,7 @@ + + #if JUCE_MINGW + #include ++ _locale_t _create_locale(int, const char*) { _locale_t loc; juce::zeromem(&loc, sizeof(loc)); return loc; } + #endif + + #else +diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp +index 5185d12..17c2e34 100644 +--- a/modules/juce_core/native/juce_win32_Files.cpp ++++ b/modules/juce_core/native/juce_win32_Files.cpp +@@ -682,7 +682,7 @@ File File::getLinkedTarget() const + CloseHandle (h); + + const StringRef prefix ("\\\\?\\"); +- const String path (buffer); ++ const String path (buffer.getData()); + + // It turns out that GetFinalPathNameByHandleW prepends \\?\ to the path. + // This is not a bug, it's feature. See MSDN for more information. +diff --git a/modules/juce_core/text/juce_CharacterFunctions.h b/modules/juce_core/text/juce_CharacterFunctions.h +index e4b2337..00d02d0 100644 +--- a/modules/juce_core/text/juce_CharacterFunctions.h ++++ b/modules/juce_core/text/juce_CharacterFunctions.h +@@ -218,7 +218,7 @@ public: + *currentCharacter++ = '0'; + } + +- #if JUCE_MSVC ++ #if JUCE_WINDOWS + static _locale_t locale = _create_locale (LC_ALL, "C"); + return _strtod_l (&buffer[0], nullptr, locale); + #else +diff --git a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp +index 728a4c6..353263a 100644 +--- a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp ++++ b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp +@@ -202,7 +202,7 @@ void FileChooser::showPlatformDialog (Array& results, const String& title_ + + if (info.returnedString.isNotEmpty()) + { +- results.add (File (String (files)).getSiblingFile (info.returnedString)); ++ results.add (File (String (files.getData())).getSiblingFile (info.returnedString)); + return; + } + } +@@ -287,12 +287,12 @@ void FileChooser::showPlatformDialog (Array& results, const String& title_ + + while (*filename != 0) + { +- results.add (File (String (files)).getChildFile (String (filename))); ++ results.add (File (String (files.getData())).getChildFile (String (filename))); + filename += wcslen (filename) + 1; + } + } + else if (files[0] != 0) + { +- results.add (File (String (files))); ++ results.add (File (String (files.getData()))); + } + } +diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +index 22e783b..607d11b 100644 +--- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp ++++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +@@ -3440,7 +3440,7 @@ private: + HeapBlock buffer; + buffer.calloc (stringSizeBytes / sizeof (TCHAR) + 1); + ImmGetCompositionString (hImc, type, buffer, (DWORD) stringSizeBytes); +- return String (buffer); ++ return String (buffer.getData()); + } + + return {}; diff --git a/libs/juce-current/patches/maybe-not-needed/vst3-less-strict.patch b/libs/juce-current/patches/maybe-not-needed/vst3-less-strict.patch new file mode 100644 index 00000000..d81a53a2 --- /dev/null +++ b/libs/juce-current/patches/maybe-not-needed/vst3-less-strict.patch @@ -0,0 +1,14 @@ +diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +index 88d8f49..7a5d661 100644 +--- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp ++++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +@@ -1356,7 +1356,8 @@ private: + + auto result = finder.findDescriptionsAndPerform (f); + +- if (result.getErrorMessage() == MatchingDescriptionFinder::getSuccessString()) ++ if (result.getErrorMessage() == MatchingDescriptionFinder::getSuccessString() || ++ result.getErrorMessage().isEmpty()) + { + name = description.name; + return true; diff --git a/libs/juce-current/patches/mingw-fixes_pt1.patch b/libs/juce-current/patches/mingw-fixes_pt1.patch new file mode 100644 index 00000000..4e772b64 --- /dev/null +++ b/libs/juce-current/patches/mingw-fixes_pt1.patch @@ -0,0 +1,14 @@ +diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +index bf7b4af22..bdb285290 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp ++++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +@@ -56,9 +56,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4355) + #ifndef WM_APPCOMMAND + #define WM_APPCOMMAND 0x0319 + #endif +- +- extern "C" void _fpreset(); +- extern "C" void _clearfp(); + #elif ! JUCE_WINDOWS + static void _fpreset() {} + static void _clearfp() {} diff --git a/libs/juce-current/patches/no-linux-native-dialog-without-modal-loops.patch b/libs/juce-current/patches/no-linux-native-dialog-without-modal-loops.patch new file mode 100644 index 00000000..46daf977 --- /dev/null +++ b/libs/juce-current/patches/no-linux-native-dialog-without-modal-loops.patch @@ -0,0 +1,37 @@ +diff --git a/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp b/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp +index 62a1e8454..778168fc7 100644 +--- a/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp ++++ b/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp +@@ -19,6 +19,7 @@ + namespace juce + { + ++#if JUCE_MODAL_LOOPS_PERMITTED + static bool exeIsAvailable (const char* const executable) + { + ChildProcess child; +@@ -233,10 +234,11 @@ private: + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Native) + }; ++#endif + + bool FileChooser::isPlatformDialogAvailable() + { +- #if JUCE_DISABLE_NATIVE_FILECHOOSERS ++ #if JUCE_DISABLE_NATIVE_FILECHOOSERS || ! JUCE_MODAL_LOOPS_PERMITTED + return false; + #else + static bool canUseNativeBox = exeIsAvailable ("zenity") || exeIsAvailable ("kdialog"); +@@ -246,7 +248,11 @@ bool FileChooser::isPlatformDialogAvailable() + + FileChooser::Pimpl* FileChooser::showPlatformDialog (FileChooser& owner, int flags, FilePreviewComponent*) + { ++#if JUCE_MODAL_LOOPS_PERMITTED + return new Native (owner, flags); ++#else ++ return nullptr; ++#endif + } + + } // namespace juce diff --git a/libs/juce-current/patches/proper-posix-getExecutableFile.patch b/libs/juce-current/patches/proper-posix-getExecutableFile.patch new file mode 100644 index 00000000..9efc1ac0 --- /dev/null +++ b/libs/juce-current/patches/proper-posix-getExecutableFile.patch @@ -0,0 +1,46 @@ +diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h +index 1fc1f00b7..2b0e16844 100644 +--- a/modules/juce_core/native/juce_posix_SharedCode.h ++++ b/modules/juce_core/native/juce_posix_SharedCode.h +@@ -590,12 +590,39 @@ File juce_getExecutableFile() + + auto localSymbol = (void*) juce_getExecutableFile; + dladdr (localSymbol, &exeInfo); +- return CharPointer_UTF8 (exeInfo.dli_fname); ++ ++ const CharPointer_UTF8 filename (exeInfo.dli_fname); ++ ++ // if the filename is absolute simply return it ++ if (File::isAbsolutePath (filename)) ++ return filename; ++ ++ // if the filename is relative construct from CWD ++ if (filename[0] == '.') ++ return File::getCurrentWorkingDirectory().getChildFile (filename).getFullPathName(); ++ ++ // filename is abstract, look up in PATH ++ if (const char* const envpath = ::getenv ("PATH")) ++ { ++ StringArray paths (StringArray::fromTokens (envpath, ":", "")); ++ ++ for (int i=paths.size(); --i>=0;) ++ { ++ const File filepath (File (paths[i]).getChildFile (filename)); ++ ++ if (filepath.existsAsFile()) ++ return filepath.getFullPathName(); ++ } ++ } ++ ++ // if we reach this, we failed to find ourselves... ++ jassertfalse; ++ return filename; + } + }; + + static String filename = DLAddrReader::getFilename(); +- return File::getCurrentWorkingDirectory().getChildFile (filename); ++ return filename; + } + + //============================================================================== diff --git a/libs/juce-current/patches/to-delete/osx-ui-processors-utils-separate.patch b/libs/juce-current/patches/to-delete/osx-ui-processors-utils-separate.patch new file mode 100644 index 00000000..f4a64ef0 --- /dev/null +++ b/libs/juce-current/patches/to-delete/osx-ui-processors-utils-separate.patch @@ -0,0 +1,114 @@ +diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp +index 20dee10..ca6dd27 100644 +--- a/modules/juce_audio_processors/juce_audio_processors.cpp ++++ b/modules/juce_audio_processors/juce_audio_processors.cpp +@@ -86,24 +86,9 @@ static inline bool arrayContainsPlugin (const OwnedArray& lis + struct AutoResizingNSViewComponent : public ViewComponentBaseClass, + private AsyncUpdater + { +- AutoResizingNSViewComponent() : recursive (false) {} +- +- void childBoundsChanged (Component*) override +- { +- if (recursive) +- { +- triggerAsyncUpdate(); +- } +- else +- { +- recursive = true; +- resizeToFitView(); +- recursive = true; +- } +- } +- +- void handleAsyncUpdate() override { resizeToFitView(); } +- ++ AutoResizingNSViewComponent(); ++ void childBoundsChanged (Component*) override; ++ void handleAsyncUpdate() override; + bool recursive; + }; + +@@ -111,33 +96,61 @@ struct AutoResizingNSViewComponent : public ViewComponentBaseClass, + struct AutoResizingNSViewComponentWithParent : public AutoResizingNSViewComponent, + private Timer + { +- AutoResizingNSViewComponentWithParent() +- { +- JUCE_IOS_MAC_VIEW* v = [[JUCE_IOS_MAC_VIEW alloc] init]; +- setView (v); +- [v release]; ++ AutoResizingNSViewComponentWithParent(); ++ JUCE_IOS_MAC_VIEW* getChildView() const; ++ void timerCallback() override; ++}; + +- startTimer (30); +- } ++//============================================================================== ++AutoResizingNSViewComponent::AutoResizingNSViewComponent() ++ : recursive (false) {} + +- JUCE_IOS_MAC_VIEW* getChildView() const ++void AutoResizingNSViewComponent::childBoundsChanged (Component*) override ++{ ++ if (recursive) + { +- if (JUCE_IOS_MAC_VIEW* parent = (JUCE_IOS_MAC_VIEW*) getView()) +- if ([[parent subviews] count] > 0) +- return [[parent subviews] objectAtIndex: 0]; +- +- return nil; ++ triggerAsyncUpdate(); + } ++ else ++ { ++ recursive = true; ++ resizeToFitView(); ++ recursive = true; ++ } ++} + +- void timerCallback() override ++void AutoResizingNSViewComponent::handleAsyncUpdate() override ++{ ++ resizeToFitView(); ++} ++ ++//============================================================================== ++AutoResizingNSViewComponentWithParent::AutoResizingNSViewComponentWithParent() ++{ ++ JUCE_IOS_MAC_VIEW* v = [[JUCE_IOS_MAC_VIEW alloc] init]; ++ setView (v); ++ [v release]; ++ ++ startTimer (30); ++} ++ ++JUCE_IOS_MAC_VIEW* AutoResizingNSViewComponentWithParent::getChildView() const ++{ ++ if (JUCE_IOS_MAC_VIEW* parent = (JUCE_IOS_MAC_VIEW*) getView()) ++ if ([[parent subviews] count] > 0) ++ return [[parent subviews] objectAtIndex: 0]; ++ ++ return nil; ++} ++ ++void AutoResizingNSViewComponentWithParent::timerCallback() override ++{ ++ if (JUCE_IOS_MAC_VIEW* child = getChildView()) + { +- if (JUCE_IOS_MAC_VIEW* child = getChildView()) +- { +- stopTimer(); +- setView (child); +- } ++ stopTimer(); ++ setView (child); + } +-}; ++} + #endif + + #if JUCE_CLANG diff --git a/libs/juce-current/patches/todo/juce_IIRFilterOld.cpp b/libs/juce-current/patches/todo/juce_IIRFilterOld.cpp new file mode 100644 index 00000000..f8d5ee3b --- /dev/null +++ b/libs/juce-current/patches/todo/juce_IIRFilterOld.cpp @@ -0,0 +1,244 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2013 - Raw Material Software Ltd. + + Permission is granted to use this software under the terms of either: + a) the GPL v2 (or any later version) + b) the Affero GPL v3 + + Details of these licenses can be found at: www.gnu.org/licenses + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.juce.com for more information. + + ============================================================================== +*/ + +#if JUCE_INTEL + #define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8 || n > 1.0e-8)) n = 0; +#else + #define JUCE_SNAP_TO_ZERO(n) +#endif + +namespace juce +{ + +//============================================================================== +IIRFilterOld::IIRFilterOld() + : active (false), v1 (0), v2 (0) +{ + zeromem (coefficients, sizeof (coefficients)); +} + +IIRFilterOld::IIRFilterOld (const IIRFilterOld& other) + : active (other.active), v1 (0), v2 (0) +{ + const SpinLock::ScopedLockType sl (other.processLock); + memcpy (coefficients, other.coefficients, sizeof (coefficients)); +} + +IIRFilterOld::~IIRFilterOld() +{ +} + +//============================================================================== +void IIRFilterOld::reset() noexcept +{ + const SpinLock::ScopedLockType sl (processLock); + v1 = v2 = 0; +} + +float IIRFilterOld::processSingleSampleRaw (const float in) noexcept +{ + float out = coefficients[0] * in + v1; + + JUCE_SNAP_TO_ZERO (out); + + v1 = coefficients[1] * in - coefficients[3] * out + v2; + v2 = coefficients[2] * in - coefficients[4] * out; + + return out; +} + +void IIRFilterOld::processSamples (float* const samples, + const int numSamples) noexcept +{ + const SpinLock::ScopedLockType sl (processLock); + + if (active) + { + const float c0 = coefficients[0]; + const float c1 = coefficients[1]; + const float c2 = coefficients[2]; + const float c3 = coefficients[3]; + const float c4 = coefficients[4]; + float lv1 = v1, lv2 = v2; + + for (int i = 0; i < numSamples; ++i) + { + const float in = samples[i]; + const float out = c0 * in + lv1; + samples[i] = out; + + lv1 = c1 * in - c3 * out + lv2; + lv2 = c2 * in - c4 * out; + } + + JUCE_SNAP_TO_ZERO (lv1); v1 = lv1; + JUCE_SNAP_TO_ZERO (lv2); v2 = lv2; + } +} + +//============================================================================== +void IIRFilterOld::makeLowPass (const double sampleRate, + const double frequency) noexcept +{ + jassert (sampleRate > 0); + + const double n = 1.0 / tan (double_Pi * frequency / sampleRate); + const double nSquared = n * n; + const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared); + + setCoefficients (c1, + c1 * 2.0f, + c1, + 1.0, + c1 * 2.0 * (1.0 - nSquared), + c1 * (1.0 - std::sqrt (2.0) * n + nSquared)); +} + +void IIRFilterOld::makeHighPass (const double sampleRate, + const double frequency) noexcept +{ + const double n = tan (double_Pi * frequency / sampleRate); + const double nSquared = n * n; + const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared); + + setCoefficients (c1, + c1 * -2.0f, + c1, + 1.0, + c1 * 2.0 * (nSquared - 1.0), + c1 * (1.0 - std::sqrt (2.0) * n + nSquared)); +} + +void IIRFilterOld::makeLowShelf (const double sampleRate, + const double cutOffFrequency, + const double Q, + const float gainFactor) noexcept +{ + jassert (sampleRate > 0); + jassert (Q > 0); + + const double A = jmax (0.0f, gainFactor); + const double aminus1 = A - 1.0; + const double aplus1 = A + 1.0; + const double omega = (double_Pi * 2.0 * jmax (cutOffFrequency, 2.0)) / sampleRate; + const double coso = std::cos (omega); + const double beta = std::sin (omega) * std::sqrt (A) / Q; + const double aminus1TimesCoso = aminus1 * coso; + + setCoefficients (A * (aplus1 - aminus1TimesCoso + beta), + A * 2.0 * (aminus1 - aplus1 * coso), + A * (aplus1 - aminus1TimesCoso - beta), + aplus1 + aminus1TimesCoso + beta, + -2.0 * (aminus1 + aplus1 * coso), + aplus1 + aminus1TimesCoso - beta); +} + +void IIRFilterOld::makeHighShelf (const double sampleRate, + const double cutOffFrequency, + const double Q, + const float gainFactor) noexcept +{ + jassert (sampleRate > 0); + jassert (Q > 0); + + const double A = jmax (0.0f, gainFactor); + const double aminus1 = A - 1.0; + const double aplus1 = A + 1.0; + const double omega = (double_Pi * 2.0 * jmax (cutOffFrequency, 2.0)) / sampleRate; + const double coso = std::cos (omega); + const double beta = std::sin (omega) * std::sqrt (A) / Q; + const double aminus1TimesCoso = aminus1 * coso; + + setCoefficients (A * (aplus1 + aminus1TimesCoso + beta), + A * -2.0 * (aminus1 + aplus1 * coso), + A * (aplus1 + aminus1TimesCoso - beta), + aplus1 - aminus1TimesCoso + beta, + 2.0 * (aminus1 - aplus1 * coso), + aplus1 - aminus1TimesCoso - beta); +} + +void IIRFilterOld::makeBandPass (const double sampleRate, + const double centreFrequency, + const double Q, + const float gainFactor) noexcept +{ + jassert (sampleRate > 0); + jassert (Q > 0); + + const double A = jmax (0.0f, gainFactor); + const double omega = (double_Pi * 2.0 * jmax (centreFrequency, 2.0)) / sampleRate; + const double alpha = 0.5 * std::sin (omega) / Q; + const double c2 = -2.0 * std::cos (omega); + const double alphaTimesA = alpha * A; + const double alphaOverA = alpha / A; + + setCoefficients (1.0 + alphaTimesA, + c2, + 1.0 - alphaTimesA, + 1.0 + alphaOverA, + c2, + 1.0 - alphaOverA); +} + +void IIRFilterOld::makeInactive() noexcept +{ + const SpinLock::ScopedLockType sl (processLock); + active = false; +} + +//============================================================================== +void IIRFilterOld::copyCoefficientsFrom (const IIRFilterOld& other) noexcept +{ + const SpinLock::ScopedLockType sl (processLock); + + memcpy (coefficients, other.coefficients, sizeof (coefficients)); + active = other.active; +} + +//============================================================================== +void IIRFilterOld::setCoefficients (double c1, double c2, double c3, + double c4, double c5, double c6) noexcept +{ + const double a = 1.0 / c4; + + c1 *= a; + c2 *= a; + c3 *= a; + c5 *= a; + c6 *= a; + + const SpinLock::ScopedLockType sl (processLock); + + coefficients[0] = (float) c1; + coefficients[1] = (float) c2; + coefficients[2] = (float) c3; + coefficients[3] = (float) c5; + coefficients[4] = (float) c6; + + active = true; +} + +#undef JUCE_SNAP_TO_ZERO + +} // namespace juce diff --git a/libs/juce-current/patches/todo/juce_IIRFilterOld.h b/libs/juce-current/patches/todo/juce_IIRFilterOld.h new file mode 100644 index 00000000..9e4bf184 --- /dev/null +++ b/libs/juce-current/patches/todo/juce_IIRFilterOld.h @@ -0,0 +1,151 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2013 - Raw Material Software Ltd. + + Permission is granted to use this software under the terms of either: + a) the GPL v2 (or any later version) + b) the Affero GPL v3 + + Details of these licenses can be found at: www.gnu.org/licenses + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.juce.com for more information. + + ============================================================================== +*/ + +#ifndef __JUCE_IIRFILTER_OLD_JUCEHEADER__ +#define __JUCE_IIRFILTER_OLD_JUCEHEADER__ + +namespace juce +{ + +//============================================================================== +/** + An IIR filter that can perform low, high, or band-pass filtering on an + audio signal. + + @see IIRFilterAudioSource +*/ +class JUCE_API IIRFilterOld +{ +public: + //============================================================================== + /** Creates a filter. + + Initially the filter is inactive, so will have no effect on samples that + you process with it. Use the appropriate method to turn it into the type + of filter needed. + */ + IIRFilterOld(); + + /** Creates a copy of another filter. */ + IIRFilterOld (const IIRFilterOld& other); + + /** Destructor. */ + ~IIRFilterOld(); + + //============================================================================== + /** Resets the filter's processing pipeline, ready to start a new stream of data. + + Note that this clears the processing state, but the type of filter and + its coefficients aren't changed. To put a filter into an inactive state, use + the makeInactive() method. + */ + void reset() noexcept; + + /** Performs the filter operation on the given set of samples. + */ + void processSamples (float* samples, + int numSamples) noexcept; + + /** Processes a single sample, without any locking or checking. + + Use this if you need fast processing of a single value, but be aware that + this isn't thread-safe in the way that processSamples() is. + */ + float processSingleSampleRaw (float sample) noexcept; + + //============================================================================== + /** Sets the filter up to act as a low-pass filter. + */ + void makeLowPass (double sampleRate, + double frequency) noexcept; + + /** Sets the filter up to act as a high-pass filter. + */ + void makeHighPass (double sampleRate, + double frequency) noexcept; + + //============================================================================== + /** Sets the filter up to act as a low-pass shelf filter with variable Q and gain. + + The gain is a scale factor that the low frequencies are multiplied by, so values + greater than 1.0 will boost the low frequencies, values less than 1.0 will + attenuate them. + */ + void makeLowShelf (double sampleRate, + double cutOffFrequency, + double Q, + float gainFactor) noexcept; + + /** Sets the filter up to act as a high-pass shelf filter with variable Q and gain. + + The gain is a scale factor that the high frequencies are multiplied by, so values + greater than 1.0 will boost the high frequencies, values less than 1.0 will + attenuate them. + */ + void makeHighShelf (double sampleRate, + double cutOffFrequency, + double Q, + float gainFactor) noexcept; + + /** Sets the filter up to act as a band pass filter centred around a + frequency, with a variable Q and gain. + + The gain is a scale factor that the centre frequencies are multiplied by, so + values greater than 1.0 will boost the centre frequencies, values less than + 1.0 will attenuate them. + */ + void makeBandPass (double sampleRate, + double centreFrequency, + double Q, + float gainFactor) noexcept; + + /** Clears the filter's coefficients so that it becomes inactive. + */ + void makeInactive() noexcept; + + //============================================================================== + /** Makes this filter duplicate the set-up of another one. + */ + void copyCoefficientsFrom (const IIRFilterOld& other) noexcept; + + +protected: + //============================================================================== + SpinLock processLock; + + void setCoefficients (double c1, double c2, double c3, + double c4, double c5, double c6) noexcept; + + bool active; + float coefficients[5]; + float v1, v2; + + // (use the copyCoefficientsFrom() method instead of this operator) + IIRFilterOld& operator= (const IIRFilterOld&); + JUCE_LEAK_DETECTOR (IIRFilterOld) +}; + +} // namespace juce + +#endif // __JUCE_IIRFILTER_OLD_JUCEHEADER__ diff --git a/libs/juce-current/patches/todo/juce_IIRFilterOld.patch b/libs/juce-current/patches/todo/juce_IIRFilterOld.patch new file mode 100644 index 00000000..87dda900 --- /dev/null +++ b/libs/juce-current/patches/todo/juce_IIRFilterOld.patch @@ -0,0 +1,24 @@ +diff --git a/modules/juce_audio_basics/juce_audio_basics.cpp b/modules/juce_audio_basics/juce_audio_basics.cpp +index 258de8f..c5a6bfa 100644 +--- a/modules/juce_audio_basics/juce_audio_basics.cpp ++++ b/modules/juce_audio_basics/juce_audio_basics.cpp +@@ -83,6 +83,7 @@ namespace juce + #include "buffers/juce_FloatVectorOperations.cpp" + #include "buffers/juce_AudioChannelSet.cpp" + #include "effects/juce_IIRFilter.cpp" ++#include "effects/juce_IIRFilterOld.cpp" + #include "effects/juce_LagrangeInterpolator.cpp" + #include "effects/juce_CatmullRomInterpolator.cpp" + #include "midi/juce_MidiBuffer.cpp" +diff --git a/modules/juce_audio_basics/juce_audio_basics.h b/modules/juce_audio_basics/juce_audio_basics.h +index feb2a6e..ce6c8f4 100644 +--- a/modules/juce_audio_basics/juce_audio_basics.h ++++ b/modules/juce_audio_basics/juce_audio_basics.h +@@ -63,6 +63,7 @@ namespace juce + #include "buffers/juce_AudioChannelSet.h" + #include "effects/juce_Decibels.h" + #include "effects/juce_IIRFilter.h" ++#include "effects/juce_IIRFilterOld.h" + #include "effects/juce_LagrangeInterpolator.h" + #include "effects/juce_CatmullRomInterpolator.h" + #include "effects/juce_LinearSmoothedValue.h" diff --git a/libs/juce-current/patches/use-mingw-std-threads.patch b/libs/juce-current/patches/use-mingw-std-threads.patch new file mode 100644 index 00000000..e0b4c168 --- /dev/null +++ b/libs/juce-current/patches/use-mingw-std-threads.patch @@ -0,0 +1,15 @@ +diff --git a/modules/juce_core/threads/juce_WaitableEvent.h b/modules/juce_core/threads/juce_WaitableEvent.h +index 3e31a9772..766d45f75 100644 +--- a/modules/juce_core/threads/juce_WaitableEvent.h ++++ b/modules/juce_core/threads/juce_WaitableEvent.h +@@ -20,6 +20,10 @@ + ============================================================================== + */ + ++#if JUCE_MINGW ++#include "mingw-std-threads/mingw.condition_variable.h" ++#endif ++ + namespace juce + { + diff --git a/libs/juce-current/patches/use-vfork+consistency.patch b/libs/juce-current/patches/use-vfork+consistency.patch new file mode 100644 index 00000000..4499404d --- /dev/null +++ b/libs/juce-current/patches/use-vfork+consistency.patch @@ -0,0 +1,119 @@ +diff --git a/modules/juce_core/native/juce_linux_Files.cpp b/modules/juce_core/native/juce_linux_Files.cpp +index e794447c3..4f8918375 100644 +--- a/modules/juce_core/native/juce_linux_Files.cpp ++++ b/modules/juce_core/native/juce_linux_Files.cpp +@@ -211,15 +211,21 @@ bool Process::openDocument (const String& fileName, const String& parameters) + + const char* const argv[4] = { "/bin/sh", "-c", cmdString.toUTF8(), nullptr }; + +- auto cpid = fork(); ++#if JUCE_USE_VFORK ++ const auto cpid = vfork(); ++#else ++ const auto cpid = fork(); ++#endif + + if (cpid == 0) + { ++#if ! JUCE_USE_VFORK + setsid(); ++#endif + + // Child process +- execve (argv[0], (char**) argv, environ); +- exit (0); ++ if (execvp (argv[0], (char**) argv) < 0) ++ _exit (0); + } + + return cpid >= 0; +diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm +index 73ed29f4e..d6c4fcf3e 100644 +--- a/modules/juce_core/native/juce_mac_Files.mm ++++ b/modules/juce_core/native/juce_mac_Files.mm +@@ -92,23 +92,22 @@ namespace MacFileHelpers + #else + static bool launchExecutable (const String& pathAndArguments) + { ++ const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), nullptr }; ++ ++#if JUCE_USE_VFORK ++ const auto cpid = vfork(); ++#else + auto cpid = fork(); ++#endif + + if (cpid == 0) + { +- const char* const argv[4] = { "/bin/sh", "-c", pathAndArguments.toUTF8(), nullptr }; +- + // Child process +- if (execve (argv[0], (char**) argv, nullptr) < 0) +- exit (0); +- } +- else +- { +- if (cpid < 0) +- return false; ++ if (execvp (argv[0], (char**) argv) < 0) ++ _exit (0); + } + +- return true; ++ return cpid >= 0; + } + #endif + } +diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h +index 2b0e16844..fc04da66a 100644 +--- a/modules/juce_core/native/juce_posix_SharedCode.h ++++ b/modules/juce_core/native/juce_posix_SharedCode.h +@@ -1090,7 +1090,18 @@ public: + + if (pipe (pipeHandles) == 0) + { +- auto result = fork(); ++ Array argv; ++ for (auto& arg : arguments) ++ if (arg.isNotEmpty()) ++ argv.add (const_cast (arg.toRawUTF8())); ++ ++ argv.add (nullptr); ++ ++#if JUCE_USE_VFORK ++ const pid_t result = vfork(); ++#else ++ const pid_t result = fork(); ++#endif + + if (result < 0) + { +@@ -1099,6 +1110,7 @@ public: + } + else if (result == 0) + { ++#if ! JUCE_USE_VFORK + // we're the child process.. + close (pipeHandles[0]); // close the read handle + +@@ -1113,17 +1125,10 @@ public: + dup2 (open ("/dev/null", O_WRONLY), STDERR_FILENO); + + close (pipeHandles[1]); ++#endif + +- Array argv; +- +- for (auto& arg : arguments) +- if (arg.isNotEmpty()) +- argv.add (const_cast (arg.toRawUTF8())); +- +- argv.add (nullptr); +- +- execvp (exe.toRawUTF8(), argv.getRawDataPointer()); +- _exit (-1); ++ if (execvp (exe.toRawUTF8(), argv.getRawDataPointer()) < 0) ++ _exit (-1); + } + else + { diff --git a/libs/juce-current/patches/vst2-linux-fix-gui-init.patch b/libs/juce-current/patches/vst2-linux-fix-gui-init.patch new file mode 100644 index 00000000..8b149871 --- /dev/null +++ b/libs/juce-current/patches/vst2-linux-fix-gui-init.patch @@ -0,0 +1,13 @@ +diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +index e3d277de2..e9a5c6cb1 100644 +--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +@@ -206,6 +206,8 @@ struct SharedMessageThread : public Thread + MessageManager::getInstance()->setCurrentThreadAsMessageThread(); + initialised = true; + ++ XWindowSystem::getInstance(); ++ + while ((! threadShouldExit()) && MessageManager::getInstance()->runDispatchLoopUntil (250)) + {} + } diff --git a/libs/juce-current/patches/vst2-linux-fix-scale-factor.patch b/libs/juce-current/patches/vst2-linux-fix-scale-factor.patch new file mode 100644 index 00000000..09a66bbb --- /dev/null +++ b/libs/juce-current/patches/vst2-linux-fix-scale-factor.patch @@ -0,0 +1,76 @@ +diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +index e9a5c6cb1..712543ac7 100644 +--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +@@ -902,7 +902,7 @@ public: + if (auto* ed = processor->createEditorIfNeeded()) + { + setHasEditorFlag (true); +- editorComp.reset (new EditorCompWrapper (*this, *ed)); ++ editorComp.reset (new EditorCompWrapper (*this, *ed, lastScaleFactorReceived)); + } + else + { +@@ -1026,11 +1026,14 @@ public: + , public Timer + #endif + { +- EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor) +- : wrapper (w) ++ EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor, float scaleFactor) ++ : wrapper (w), ++ editorScaleFactor (scaleFactor) + { + editor.setOpaque (true); + editor.setVisible (true); ++ editor.setScaleFactor (scaleFactor); ++ + setOpaque (true); + + setTopLeftPosition (editor.getPosition()); +@@ -1064,6 +1067,24 @@ public: + { + auto b = getSizeToContainChild(); + bounds = convertToHostBounds ({ 0, 0, (int16) b.getHeight(), (int16) b.getWidth() }); ++ ++ #if JUCE_LINUX ++ if (auto* ed = getEditorComp()) ++ { ++ if (auto* peer = ed->getPeer()) ++ { ++ auto scale = (float) peer->getPlatformScaleFactor(); ++ ++ if (approximatelyEqual (scale, 1.0f)) ++ return; ++ ++ bounds.upper *= scale; ++ bounds.leftmost *= scale; ++ bounds.lower *= scale; ++ bounds.rightmost *= scale; ++ } ++ } ++ #endif + } + + void attachToHost (VstOpCodeArguments args) +@@ -1169,9 +1190,9 @@ public: + setTopLeftPosition (0, getHeight() - pos.getHeight()); + #endif + ++ #if ! JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail. + resizeHostWindow (pos.getWidth(), pos.getHeight()); + +- #if ! JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail. + if (! resizeEditor) // this is needed to prevent an infinite resizing loop due to coordinate rounding + shouldResizeEditor = false; + +@@ -1186,6 +1207,9 @@ public: + if (auto* peer = ed->getPeer()) + scale *= (float) peer->getPlatformScaleFactor(); + ++ resizeHostWindow (roundToInt (pos.getWidth() * scale), ++ roundToInt (pos.getHeight() * scale)); ++ + X11Symbols::getInstance()->xResizeWindow (display, (Window) getWindowHandle(), + static_cast (roundToInt (pos.getWidth() * scale)), + static_cast (roundToInt (pos.getHeight() * scale))); diff --git a/libs/juce-current/patches/vst2-support.patch b/libs/juce-current/patches/vst2-support.patch new file mode 100644 index 00000000..918edb62 --- /dev/null +++ b/libs/juce-current/patches/vst2-support.patch @@ -0,0 +1,3178 @@ +diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +index c87b97d49..159ab0c7c 100644 +--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +@@ -71,14 +71,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4458) + + namespace Vst2 + { +-// If the following files cannot be found then you are probably trying to build +-// a VST2 plug-in or a VST2-compatible VST3 plug-in. To do this you must have a +-// VST2 SDK in your header search paths or use the "VST (Legacy) SDK Folder" +-// field in the Projucer. The VST2 SDK can be obtained from the +-// vstsdk3610_11_06_2018_build_37 (or older) VST3 SDK or JUCE version 5.3.2. You +-// also need a VST2 license from Steinberg to distribute VST2 plug-ins. +-#include "pluginterfaces/vst2.x/aeffect.h" +-#include "pluginterfaces/vst2.x/aeffectx.h" ++#include "../../juce_audio_processors/format_types/juce_VSTInterface.h" + } + + JUCE_END_IGNORE_WARNINGS_MSVC +@@ -89,7 +82,6 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE + #pragma pack (push, 8) + #endif + +-#define JUCE_VSTINTERFACE_H_INCLUDED 1 + #define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1 + + #include "../utility/juce_IncludeModuleHeaders.h" +@@ -286,7 +278,7 @@ private: + + public: + //============================================================================== +- JuceVSTWrapper (Vst2::audioMasterCallback cb, AudioProcessor* af) ++ JuceVSTWrapper (Vst2::VstHostCallback cb, AudioProcessor* af) + : hostCallback (cb), + processor (af) + { +@@ -314,41 +306,41 @@ public: + juceParameters.update (*processor, false); + + memset (&vstEffect, 0, sizeof (vstEffect)); +- vstEffect.magic = 0x56737450 /* 'VstP' */; +- vstEffect.dispatcher = (Vst2::AEffectDispatcherProc) dispatcherCB; +- vstEffect.process = nullptr; +- vstEffect.setParameter = (Vst2::AEffectSetParameterProc) setParameterCB; +- vstEffect.getParameter = (Vst2::AEffectGetParameterProc) getParameterCB; ++ vstEffect.interfaceIdentifier = Vst2::juceVstInterfaceIdentifier; ++ vstEffect.dispatchFunction = dispatcherCB; ++ vstEffect.processAudioFunction = nullptr; ++ vstEffect.setParameterValueFunction = setParameterCB; ++ vstEffect.getParameterValueFunction = getParameterCB; + vstEffect.numPrograms = jmax (1, af->getNumPrograms()); +- vstEffect.numParams = juceParameters.getNumParameters(); +- vstEffect.numInputs = maxNumInChannels; +- vstEffect.numOutputs = maxNumOutChannels; +- vstEffect.initialDelay = processor->getLatencySamples(); +- vstEffect.object = this; +- vstEffect.uniqueID = JucePlugin_VSTUniqueID; ++ vstEffect.numParameters = juceParameters.getNumParameters(); ++ vstEffect.numInputChannels = maxNumInChannels; ++ vstEffect.numOutputChannels = maxNumOutChannels; ++ vstEffect.latency = processor->getLatencySamples(); ++ vstEffect.effectPointer = this; ++ vstEffect.plugInIdentifier = JucePlugin_VSTUniqueID; + + #ifdef JucePlugin_VSTChunkStructureVersion +- vstEffect.version = JucePlugin_VSTChunkStructureVersion; ++ vstEffect.plugInVersion = JucePlugin_VSTChunkStructureVersion; + #else +- vstEffect.version = JucePlugin_VersionCode; ++ vstEffect.plugInVersion = JucePlugin_VersionCode; + #endif + +- vstEffect.processReplacing = (Vst2::AEffectProcessProc) processReplacingCB; +- vstEffect.processDoubleReplacing = (Vst2::AEffectProcessDoubleProc) processDoubleReplacingCB; ++ vstEffect.processAudioInplaceFunction = processReplacingCB; ++ vstEffect.processDoubleAudioInplaceFunction = processDoubleReplacingCB; + +- vstEffect.flags |= Vst2::effFlagsHasEditor; ++ vstEffect.flags |= Vst2::vstEffectFlagHasEditor; + +- vstEffect.flags |= Vst2::effFlagsCanReplacing; ++ vstEffect.flags |= Vst2::vstEffectFlagInplaceAudio; + if (processor->supportsDoublePrecisionProcessing()) +- vstEffect.flags |= Vst2::effFlagsCanDoubleReplacing; ++ vstEffect.flags |= Vst2::vstEffectFlagInplaceDoubleAudio; + +- vstEffect.flags |= Vst2::effFlagsProgramChunks; ++ vstEffect.flags |= Vst2::vstEffectFlagDataInChunks; + + #if JucePlugin_IsSynth +- vstEffect.flags |= Vst2::effFlagsIsSynth; ++ vstEffect.flags |= Vst2::vstEffectFlagIsSynth; + #else + if (processor->getTailLengthSeconds() == 0.0) +- vstEffect.flags |= Vst2::effFlagsNoSoundInStop; ++ vstEffect.flags |= 512; + #endif + + activePlugins.add (this); +@@ -392,7 +384,7 @@ public: + } + } + +- Vst2::AEffect* getAEffect() noexcept { return &vstEffect; } ++ Vst2::VstEffectInterface* getAEffect() noexcept { return &vstEffect; } + + template + void internalProcessReplacing (FloatType** inputs, FloatType** outputs, +@@ -527,7 +519,7 @@ public: + + // Send VST events to the host. + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterProcessEvents, 0, 0, outgoingEvents.events, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodePreAudioProcessingEvents, 0, 0, outgoingEvents.events, 0); + #elif JUCE_DEBUG + /* This assertion is caused when you've added some events to the + midiMessages array in your processBlock() method, which usually means +@@ -556,7 +548,7 @@ public: + internalProcessReplacing (inputs, outputs, sampleFrames, floatTempBuffers); + } + +- static void processReplacingCB (Vst2::AEffect* vstInterface, float** inputs, float** outputs, int32 sampleFrames) ++ static void processReplacingCB (Vst2::VstEffectInterface* vstInterface, float** inputs, float** outputs, int32 sampleFrames) + { + getWrapper (vstInterface)->processReplacing (inputs, outputs, sampleFrames); + } +@@ -567,7 +559,7 @@ public: + internalProcessReplacing (inputs, outputs, sampleFrames, doubleTempBuffers); + } + +- static void processDoubleReplacingCB (Vst2::AEffect* vstInterface, double** inputs, double** outputs, int32 sampleFrames) ++ static void processDoubleReplacingCB (Vst2::VstEffectInterface* vstInterface, double** inputs, double** outputs, int32 sampleFrames) + { + getWrapper (vstInterface)->processDoubleReplacing (inputs, outputs, sampleFrames); + } +@@ -579,7 +571,7 @@ public: + { + isProcessing = true; + +- auto numInAndOutChannels = static_cast (vstEffect.numInputs + vstEffect.numOutputs); ++ auto numInAndOutChannels = static_cast (vstEffect.numInputChannels + vstEffect.numOutputChannels); + floatTempBuffers .channels.calloc (numInAndOutChannels); + doubleTempBuffers.channels.calloc (numInAndOutChannels); + +@@ -598,16 +590,16 @@ public: + midiEvents.ensureSize (2048); + midiEvents.clear(); + +- vstEffect.initialDelay = processor->getLatencySamples(); ++ vstEffect.latency = processor->getLatencySamples(); + + /** If this plug-in is a synth or it can receive midi events we need to tell the + host that we want midi. In the SDK this method is marked as deprecated, but + some hosts rely on this behaviour. + */ +- if (vstEffect.flags & Vst2::effFlagsIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) ++ if (vstEffect.flags & Vst2::vstEffectFlagIsSynth || JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect) + { + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterWantMidi, 0, 1, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodePlugInWantsMidi, 0, 1, nullptr, 0); + } + + if (getHostType().isAbletonLive() +@@ -621,7 +613,7 @@ public: + hostCmd.commandSize = sizeof (int); + hostCmd.flags = AbletonLiveHostSpecific::KCantBeSuspended; + +- hostCallback (&vstEffect, Vst2::audioMasterVendorSpecific, 0, 0, &hostCmd, 0.0f); ++ hostCallback (&vstEffect, Vst2::hostOpcodeManufacturerSpecific, 0, 0, &hostCmd, 0.0f); + } + + #if JucePlugin_ProducesMidiOutput || JucePlugin_IsMidiEffect +@@ -648,28 +640,28 @@ public: + //============================================================================== + bool getCurrentPosition (AudioPlayHead::CurrentPositionInfo& info) override + { +- const Vst2::VstTimeInfo* ti = nullptr; ++ const Vst2::VstTimingInformation* ti = nullptr; + + if (hostCallback != nullptr) + { +- int32 flags = Vst2::kVstPpqPosValid | Vst2::kVstTempoValid +- | Vst2::kVstBarsValid | Vst2::kVstCyclePosValid +- | Vst2::kVstTimeSigValid | Vst2::kVstSmpteValid +- | Vst2::kVstClockValid; ++ int32 flags = Vst2::vstTimingInfoFlagMusicalPositionValid | Vst2::vstTimingInfoFlagTempoValid ++ | Vst2::vstTimingInfoFlagLastBarPositionValid | Vst2::vstTimingInfoFlagLoopPositionValid ++ | Vst2::vstTimingInfoFlagTimeSignatureValid | Vst2::vstTimingInfoFlagSmpteValid ++ | Vst2::vstTimingInfoFlagNearestClockValid; + +- auto result = hostCallback (&vstEffect, Vst2::audioMasterGetTime, 0, flags, nullptr, 0); +- ti = reinterpret_cast (result); ++ auto result = hostCallback (&vstEffect, Vst2::hostOpcodeGetTimingInfo, 0, flags, nullptr, 0); ++ ti = reinterpret_cast (result); + } + + if (ti == nullptr || ti->sampleRate <= 0) + return false; + +- info.bpm = (ti->flags & Vst2::kVstTempoValid) != 0 ? ti->tempo : 0.0; ++ info.bpm = (ti->flags & Vst2::vstTimingInfoFlagTempoValid) != 0 ? ti->tempoBPM : 0.0; + +- if ((ti->flags & Vst2::kVstTimeSigValid) != 0) ++ if ((ti->flags & Vst2::vstTimingInfoFlagTimeSignatureValid) != 0) + { +- info.timeSigNumerator = ti->timeSigNumerator; +- info.timeSigDenominator = ti->timeSigDenominator; ++ info.timeSigNumerator = ti->timeSignatureNumerator; ++ info.timeSigDenominator = ti->timeSignatureDenominator; + } + else + { +@@ -677,34 +669,34 @@ public: + info.timeSigDenominator = 4; + } + +- info.timeInSamples = (int64) (ti->samplePos + 0.5); +- info.timeInSeconds = ti->samplePos / ti->sampleRate; +- info.ppqPosition = (ti->flags & Vst2::kVstPpqPosValid) != 0 ? ti->ppqPos : 0.0; +- info.ppqPositionOfLastBarStart = (ti->flags & Vst2::kVstBarsValid) != 0 ? ti->barStartPos : 0.0; ++ info.timeInSamples = (int64) (ti->samplePosition + 0.5); ++ info.timeInSeconds = ti->samplePosition / ti->sampleRate; ++ info.ppqPosition = (ti->flags & Vst2::vstTimingInfoFlagMusicalPositionValid) != 0 ? ti->musicalPosition : 0.0; ++ info.ppqPositionOfLastBarStart = (ti->flags & Vst2::vstTimingInfoFlagLastBarPositionValid) != 0 ? ti->lastBarPosition : 0.0; + +- if ((ti->flags & Vst2::kVstSmpteValid) != 0) ++ if ((ti->flags & Vst2::vstTimingInfoFlagSmpteValid) != 0) + { + AudioPlayHead::FrameRateType rate = AudioPlayHead::fpsUnknown; + double fps = 1.0; + +- switch (ti->smpteFrameRate) ++ switch (ti->smpteRate) + { +- case Vst2::kVstSmpte239fps: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte24fps: rate = AudioPlayHead::fps24; fps = 24.0; break; +- case Vst2::kVstSmpte25fps: rate = AudioPlayHead::fps25; fps = 25.0; break; +- case Vst2::kVstSmpte2997fps: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte30fps: rate = AudioPlayHead::fps30; fps = 30.0; break; +- case Vst2::kVstSmpte2997dfps: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte30dfps: rate = AudioPlayHead::fps30drop; fps = 30.0; break; +- +- case Vst2::kVstSmpteFilm16mm: +- case Vst2::kVstSmpteFilm35mm: fps = 24.0; break; +- +- case Vst2::kVstSmpte249fps: fps = 25.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte599fps: fps = 60.0 * 1000.0 / 1001.0; break; +- case Vst2::kVstSmpte60fps: fps = 60; break; +- +- default: jassertfalse; // unknown frame-rate.. ++ case Vst2::vstSmpteRateFps239: rate = AudioPlayHead::fps23976; fps = 24.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps24: rate = AudioPlayHead::fps24; fps = 24.0; break; ++ case Vst2::vstSmpteRateFps25: rate = AudioPlayHead::fps25; fps = 25.0; break; ++ case Vst2::vstSmpteRateFps2997: rate = AudioPlayHead::fps2997; fps = 30.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps30: rate = AudioPlayHead::fps30; fps = 30.0; break; ++ case Vst2::vstSmpteRateFps2997drop: rate = AudioPlayHead::fps2997drop; fps = 30.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps30drop: rate = AudioPlayHead::fps30drop; fps = 30.0; break; ++ ++ case Vst2::vstSmpteRate16mmFilm: ++ case Vst2::vstSmpteRate35mmFilm: fps = 24.0; break; ++ ++ case Vst2::vstSmpteRateFps249: fps = 25.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps599: fps = 60.0 * 1000.0 / 1001.0; break; ++ case Vst2::vstSmpteRateFps60: fps = 60; break; ++ ++ default: jassertfalse; // unknown frame-rate.. + } + + info.frameRate = rate; +@@ -716,14 +708,14 @@ public: + info.editOriginTime = 0; + } + +- info.isRecording = (ti->flags & Vst2::kVstTransportRecording) != 0; +- info.isPlaying = (ti->flags & (Vst2::kVstTransportRecording | Vst2::kVstTransportPlaying)) != 0; +- info.isLooping = (ti->flags & Vst2::kVstTransportCycleActive) != 0; ++ info.isRecording = (ti->flags & Vst2::vstTimingInfoFlagCurrentlyRecording) != 0; ++ info.isPlaying = (ti->flags & (Vst2::vstTimingInfoFlagCurrentlyRecording | Vst2::vstTimingInfoFlagCurrentlyPlaying)) != 0; ++ info.isLooping = (ti->flags & Vst2::vstTimingInfoFlagLoopActive) != 0; + +- if ((ti->flags & Vst2::kVstCyclePosValid) != 0) ++ if ((ti->flags & Vst2::vstTimingInfoFlagLoopPositionValid) != 0) + { +- info.ppqLoopStart = ti->cycleStartPos; +- info.ppqLoopEnd = ti->cycleEndPos; ++ info.ppqLoopStart = ti->loopStartPosition; ++ info.ppqLoopEnd = ti->loopEndPosition; + } + else + { +@@ -743,7 +735,7 @@ public: + return 0.0f; + } + +- static float getParameterCB (Vst2::AEffect* vstInterface, int32 index) ++ static float getParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index) + { + return getWrapper (vstInterface)->getParameter (index); + } +@@ -759,7 +751,7 @@ public: + } + } + +- static void setParameterCB (Vst2::AEffect* vstInterface, int32 index, float value) ++ static void setParameterCB (Vst2::VstEffectInterface* vstInterface, int32 index, float value) + { + getWrapper (vstInterface)->setParameter (index, value); + } +@@ -773,19 +765,19 @@ public: + } + + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterAutomate, index, 0, nullptr, newValue); ++ hostCallback (&vstEffect, Vst2::hostOpcodeParameterChanged, index, 0, nullptr, newValue); + } + + void audioProcessorParameterChangeGestureBegin (AudioProcessor*, int index) override + { + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterBeginEdit, index, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureBegin, index, 0, nullptr, 0); + } + + void audioProcessorParameterChangeGestureEnd (AudioProcessor*, int index) override + { + if (hostCallback != nullptr) +- hostCallback (&vstEffect, Vst2::audioMasterEndEdit, index, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeParameterChangeGestureEnd, index, 0, nullptr, 0); + } + + void parameterValueChanged (int, float newValue) override +@@ -798,7 +790,7 @@ public: + + void audioProcessorChanged (AudioProcessor*) override + { +- vstEffect.initialDelay = processor->getLatencySamples(); ++ vstEffect.latency = processor->getLatencySamples(); + triggerAsyncUpdate(); + } + +@@ -806,12 +798,12 @@ public: + { + if (hostCallback != nullptr) + { +- hostCallback (&vstEffect, Vst2::audioMasterUpdateDisplay, 0, 0, nullptr, 0); +- hostCallback (&vstEffect, Vst2::audioMasterIOChanged, 0, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeUpdateView, 0, 0, nullptr, 0); ++ hostCallback (&vstEffect, Vst2::hostOpcodeIOModified, 0, 0, nullptr, 0); + } + } + +- bool getPinProperties (Vst2::VstPinProperties& properties, bool direction, int index) const ++ bool getPinProperties (Vst2::VstPinInfo& properties, bool direction, int index) const + { + if (processor->isMidiEffect()) + return false; +@@ -820,9 +812,9 @@ public: + + // fill with default + properties.flags = 0; +- properties.label[0] = 0; +- properties.shortLabel[0] = 0; +- properties.arrangementType = Vst2::kSpeakerArrEmpty; ++ properties.text[0] = 0; ++ properties.shortText[0] = 0; ++ properties.configurationType = Vst2::vstSpeakerConfigTypeEmpty; + + if ((channelIdx = processor->getOffsetInBusBufferForAbsoluteChannelIndex (direction, index, busIdx)) >= 0) + { +@@ -830,8 +822,8 @@ public: + auto& channelSet = bus.getCurrentLayout(); + auto channelType = channelSet.getTypeOfChannel (channelIdx); + +- properties.flags = Vst2::kVstPinIsActive | Vst2::kVstPinUseSpeaker; +- properties.arrangementType = SpeakerMappings::channelSetToVstArrangementType (channelSet); ++ properties.flags = Vst2::vstPinInfoFlagIsActive | Vst2::vstPinInfoFlagValid; ++ properties.configurationType = SpeakerMappings::channelSetToVstArrangementType (channelSet); + String label = bus.getName(); + + #ifdef JucePlugin_PreferredChannelConfigurations +@@ -841,8 +833,8 @@ public: + label += " " + AudioChannelSet::getAbbreviatedChannelTypeName (channelType); + #endif + +- label.copyToUTF8 (properties.label, (size_t) (Vst2::kVstMaxLabelLen + 1)); +- label.copyToUTF8 (properties.shortLabel, (size_t) (Vst2::kVstMaxShortLabelLen + 1)); ++ label.copyToUTF8 (properties.text, (size_t) (Vst2::vstMaxParameterOrPinLabelLength + 1)); ++ label.copyToUTF8 (properties.shortText, (size_t) (Vst2::vstMaxParameterOrPinShortLabelLength + 1)); + + if (channelType == AudioChannelSet::left + || channelType == AudioChannelSet::leftSurround +@@ -852,7 +844,7 @@ public: + || channelType == AudioChannelSet::topRearLeft + || channelType == AudioChannelSet::leftSurroundRear + || channelType == AudioChannelSet::wideLeft) +- properties.flags |= Vst2::kVstPinIsStereo; ++ properties.flags |= Vst2::vstPinInfoFlagIsStereo; + + return true; + } +@@ -887,15 +879,15 @@ public: + + void setHasEditorFlag (bool shouldSetHasEditor) + { +- auto hasEditor = (vstEffect.flags & Vst2::effFlagsHasEditor) != 0; ++ auto hasEditor = (vstEffect.flags & Vst2::vstEffectFlagHasEditor) != 0; + + if (shouldSetHasEditor == hasEditor) + return; + + if (shouldSetHasEditor) +- vstEffect.flags |= Vst2::effFlagsHasEditor; ++ vstEffect.flags |= Vst2::vstEffectFlagHasEditor; + else +- vstEffect.flags &= ~Vst2::effFlagsHasEditor; ++ vstEffect.flags &= ~Vst2::vstEffectFlagHasEditor; + } + + void createEditorComp() +@@ -962,59 +954,59 @@ public: + + switch (opCode) + { +- case Vst2::effOpen: return handleOpen (args); +- case Vst2::effClose: return handleClose (args); +- case Vst2::effSetProgram: return handleSetCurrentProgram (args); +- case Vst2::effGetProgram: return handleGetCurrentProgram (args); +- case Vst2::effSetProgramName: return handleSetCurrentProgramName (args); +- case Vst2::effGetProgramName: return handleGetCurrentProgramName (args); +- case Vst2::effGetParamLabel: return handleGetParameterLabel (args); +- case Vst2::effGetParamDisplay: return handleGetParameterText (args); +- case Vst2::effGetParamName: return handleGetParameterName (args); +- case Vst2::effSetSampleRate: return handleSetSampleRate (args); +- case Vst2::effSetBlockSize: return handleSetBlockSize (args); +- case Vst2::effMainsChanged: return handleResumeSuspend (args); +- case Vst2::effEditGetRect: return handleGetEditorBounds (args); +- case Vst2::effEditOpen: return handleOpenEditor (args); +- case Vst2::effEditClose: return handleCloseEditor (args); +- case Vst2::effIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf"); +- case Vst2::effGetChunk: return handleGetData (args); +- case Vst2::effSetChunk: return handleSetData (args); +- case Vst2::effProcessEvents: return handlePreAudioProcessingEvents (args); +- case Vst2::effCanBeAutomated: return handleIsParameterAutomatable (args); +- case Vst2::effString2Parameter: return handleParameterValueForText (args); +- case Vst2::effGetProgramNameIndexed: return handleGetProgramName (args); +- case Vst2::effGetInputProperties: return handleGetInputPinProperties (args); +- case Vst2::effGetOutputProperties: return handleGetOutputPinProperties (args); +- case Vst2::effGetPlugCategory: return handleGetPlugInCategory (args); +- case Vst2::effSetSpeakerArrangement: return handleSetSpeakerConfiguration (args); +- case Vst2::effSetBypass: return handleSetBypass (args); +- case Vst2::effGetEffectName: return handleGetPlugInName (args); +- case Vst2::effGetProductString: return handleGetPlugInName (args); +- case Vst2::effGetVendorString: return handleGetManufacturerName (args); +- case Vst2::effGetVendorVersion: return handleGetManufacturerVersion (args); +- case Vst2::effVendorSpecific: return handleManufacturerSpecific (args); +- case Vst2::effCanDo: return handleCanPlugInDo (args); +- case Vst2::effGetTailSize: return handleGetTailSize (args); +- case Vst2::effKeysRequired: return handleKeyboardFocusRequired (args); +- case Vst2::effGetVstVersion: return handleGetVstInterfaceVersion (args); +- case Vst2::effGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args); +- case Vst2::effGetSpeakerArrangement: return handleGetSpeakerConfiguration (args); +- case Vst2::effSetTotalSampleToProcess: return handleSetNumberOfSamplesToProcess (args); +- case Vst2::effSetProcessPrecision: return handleSetSampleFloatType (args); +- case Vst2::effGetNumMidiInputChannels: return handleGetNumMidiInputChannels(); +- case Vst2::effGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels(); +- default: return 0; +- } +- } +- +- static pointer_sized_int dispatcherCB (Vst2::AEffect* vstInterface, int32 opCode, int32 index, ++ case Vst2::plugInOpcodeOpen: return handleOpen (args); ++ case Vst2::plugInOpcodeClose: return handleClose (args); ++ case Vst2::plugInOpcodeSetCurrentProgram: return handleSetCurrentProgram (args); ++ case Vst2::plugInOpcodeGetCurrentProgram: return handleGetCurrentProgram (args); ++ case Vst2::plugInOpcodeSetCurrentProgramName: return handleSetCurrentProgramName (args); ++ case Vst2::plugInOpcodeGetCurrentProgramName: return handleGetCurrentProgramName (args); ++ case Vst2::plugInOpcodeGetParameterLabel: return handleGetParameterLabel (args); ++ case Vst2::plugInOpcodeGetParameterText: return handleGetParameterText (args); ++ case Vst2::plugInOpcodeGetParameterName: return handleGetParameterName (args); ++ case Vst2::plugInOpcodeSetSampleRate: return handleSetSampleRate (args); ++ case Vst2::plugInOpcodeSetBlockSize: return handleSetBlockSize (args); ++ case Vst2::plugInOpcodeResumeSuspend: return handleResumeSuspend (args); ++ case Vst2::plugInOpcodeGetEditorBounds: return handleGetEditorBounds (args); ++ case Vst2::plugInOpcodeOpenEditor: return handleOpenEditor (args); ++ case Vst2::plugInOpcodeCloseEditor: return handleCloseEditor (args); ++ case Vst2::plugInOpcodeIdentify: return (pointer_sized_int) ByteOrder::bigEndianInt ("NvEf"); ++ case Vst2::plugInOpcodeGetData: return handleGetData (args); ++ case Vst2::plugInOpcodeSetData: return handleSetData (args); ++ case Vst2::plugInOpcodePreAudioProcessingEvents: return handlePreAudioProcessingEvents (args); ++ case Vst2::plugInOpcodeIsParameterAutomatable: return handleIsParameterAutomatable (args); ++ case Vst2::plugInOpcodeParameterValueForText: return handleParameterValueForText (args); ++ case Vst2::plugInOpcodeGetProgramName: return handleGetProgramName (args); ++ case Vst2::plugInOpcodeGetInputPinProperties: return handleGetInputPinProperties (args); ++ case Vst2::plugInOpcodeGetOutputPinProperties: return handleGetOutputPinProperties (args); ++ case Vst2::plugInOpcodeGetPlugInCategory: return handleGetPlugInCategory (args); ++ case Vst2::plugInOpcodeSetSpeakerConfiguration: return handleSetSpeakerConfiguration (args); ++ case Vst2::plugInOpcodeSetBypass: return handleSetBypass (args); ++ case Vst2::plugInOpcodeGetPlugInName: return handleGetPlugInName (args); ++ case Vst2::plugInOpcodeGetManufacturerProductName: return handleGetPlugInName (args); ++ case Vst2::plugInOpcodeGetManufacturerName: return handleGetManufacturerName (args); ++ case Vst2::plugInOpcodeGetManufacturerVersion: return handleGetManufacturerVersion (args); ++ case Vst2::plugInOpcodeManufacturerSpecific: return handleManufacturerSpecific (args); ++ case Vst2::plugInOpcodeCanPlugInDo: return handleCanPlugInDo (args); ++ case Vst2::plugInOpcodeGetTailSize: return handleGetTailSize (args); ++ case Vst2::plugInOpcodeKeyboardFocusRequired: return handleKeyboardFocusRequired (args); ++ case Vst2::plugInOpcodeGetVstInterfaceVersion: return handleGetVstInterfaceVersion (args); ++ case Vst2::plugInOpcodeGetCurrentMidiProgram: return handleGetCurrentMidiProgram (args); ++ case Vst2::plugInOpcodeGetSpeakerArrangement: return handleGetSpeakerConfiguration (args); ++ case Vst2::plugInOpcodeSetNumberOfSamplesToProcess: return handleSetNumberOfSamplesToProcess (args); ++ case Vst2::plugInOpcodeSetSampleFloatType: return handleSetSampleFloatType (args); ++ case Vst2::pluginOpcodeGetNumMidiInputChannels: return handleGetNumMidiInputChannels(); ++ case Vst2::pluginOpcodeGetNumMidiOutputChannels: return handleGetNumMidiOutputChannels(); ++ default: return 0; ++ } ++ } ++ ++ static pointer_sized_int dispatcherCB (Vst2::VstEffectInterface* vstInterface, int32 opCode, int32 index, + pointer_sized_int value, void* ptr, float opt) + { + auto* wrapper = getWrapper (vstInterface); + VstOpCodeArguments args = { index, value, ptr, opt }; + +- if (opCode == Vst2::effClose) ++ if (opCode == Vst2::plugInOpcodeClose) + { + wrapper->dispatcher (opCode, args); + delete wrapper; +@@ -1214,13 +1206,13 @@ public: + + if (auto host = wrapper.hostCallback) + { +- auto status = host (wrapper.getAEffect(), Vst2::audioMasterCanDo, 0, 0, const_cast ("sizeWindow"), 0); ++ auto status = host (wrapper.getAEffect(), Vst2::hostOpcodeCanHostDo, 0, 0, const_cast ("sizeWindow"), 0); + + if (status == (pointer_sized_int) 1 || getHostType().isAbletonLive()) + { + const ScopedValueSetter inSizeWindowSetter (isInSizeWindow, true); + +- sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::audioMasterSizeWindow, ++ sizeWasSuccessful = (host (wrapper.getAEffect(), Vst2::hostOpcodeWindowSize, + newWidth, newHeight, nullptr, 0) != 0); + } + } +@@ -1376,12 +1368,12 @@ public: + + //============================================================================== + private: +- static JuceVSTWrapper* getWrapper (Vst2::AEffect* v) noexcept { return static_cast (v->object); } ++ static JuceVSTWrapper* getWrapper (Vst2::VstEffectInterface* v) noexcept { return static_cast (v->effectPointer); } + + bool isProcessLevelOffline() + { + return hostCallback != nullptr +- && (int32) hostCallback (&vstEffect, Vst2::audioMasterGetCurrentProcessLevel, 0, 0, nullptr, 0) == 4; ++ && (int32) hostCallback (&vstEffect, Vst2::hostOpcodeGetCurrentAudioProcessingLevel, 0, 0, nullptr, 0) == 4; + } + + static inline int32 convertHexVersionToDecimal (const unsigned int hexVersion) +@@ -1449,8 +1441,8 @@ private: + tmpBuffers.release(); + + if (processor != nullptr) +- tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputs +- + vstEffect.numOutputs); ++ tmpBuffers.tempChannels.insertMultiple (0, nullptr, vstEffect.numInputChannels ++ + vstEffect.numOutputChannels); + } + + void deleteTempChannels() +@@ -1610,7 +1602,7 @@ private: + if (editorComp != nullptr) + { + editorComp->getEditorBounds (editorBounds); +- *((Vst2::ERect**) args.ptr) = &editorBounds; ++ *((Vst2::VstEditorBounds**) args.ptr) = &editorBounds; + return (pointer_sized_int) &editorBounds; + } + +@@ -1700,7 +1692,7 @@ private: + pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args) + { + #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect +- VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents); ++ VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEventBlock*) args.ptr, midiEvents); + return 1; + #else + ignoreUnused (args); +@@ -1751,12 +1743,12 @@ private: + + pointer_sized_int handleGetInputPinProperties (VstOpCodeArguments args) + { +- return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, true, args.index)) ? 1 : 0; ++ return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, true, args.index)) ? 1 : 0; + } + + pointer_sized_int handleGetOutputPinProperties (VstOpCodeArguments args) + { +- return (processor != nullptr && getPinProperties (*(Vst2::VstPinProperties*) args.ptr, false, args.index)) ? 1 : 0; ++ return (processor != nullptr && getPinProperties (*(Vst2::VstPinInfo*) args.ptr, false, args.index)) ? 1 : 0; + } + + pointer_sized_int handleGetPlugInCategory (VstOpCodeArguments) +@@ -1766,8 +1758,8 @@ private: + + pointer_sized_int handleSetSpeakerConfiguration (VstOpCodeArguments args) + { +- auto* pluginInput = reinterpret_cast (args.value); +- auto* pluginOutput = reinterpret_cast (args.ptr); ++ auto* pluginInput = reinterpret_cast (args.value); ++ auto* pluginOutput = reinterpret_cast (args.ptr); + + if (processor->isMidiEffect()) + return 0; +@@ -1778,29 +1770,29 @@ private: + if (pluginInput != nullptr && pluginInput->type >= 0) + { + // inconsistent request? +- if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numChannels) ++ if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput).size() != pluginInput->numberOfChannels) + return 0; + } + + if (pluginOutput != nullptr && pluginOutput->type >= 0) + { + // inconsistent request? +- if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numChannels) ++ if (SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput).size() != pluginOutput->numberOfChannels) + return 0; + } + +- if (pluginInput != nullptr && pluginInput->numChannels > 0 && numIns == 0) ++ if (pluginInput != nullptr && pluginInput->numberOfChannels > 0 && numIns == 0) + return 0; + +- if (pluginOutput != nullptr && pluginOutput->numChannels > 0 && numOuts == 0) ++ if (pluginOutput != nullptr && pluginOutput->numberOfChannels > 0 && numOuts == 0) + return 0; + + auto layouts = processor->getBusesLayout(); + +- if (pluginInput != nullptr && pluginInput-> numChannels >= 0 && numIns > 0) ++ if (pluginInput != nullptr && pluginInput-> numberOfChannels >= 0 && numIns > 0) + layouts.getChannelSet (true, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginInput); + +- if (pluginOutput != nullptr && pluginOutput->numChannels >= 0 && numOuts > 0) ++ if (pluginOutput != nullptr && pluginOutput->numberOfChannels >= 0 && numOuts > 0) + layouts.getChannelSet (false, 0) = SpeakerMappings::vstArrangementTypeToChannelSet (*pluginOutput); + + #ifdef JucePlugin_PreferredChannelConfigurations +@@ -1848,7 +1840,7 @@ private: + && args.value == (int32) JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's')) + return handleSetContentScaleFactor (args.opt); + +- if (args.index == Vst2::effGetParamDisplay) ++ if (args.index == Vst2::plugInOpcodeGetParameterText) + return handleCockosGetParameterText (args.value, args.ptr, args.opt); + + if (auto callbackHandler = dynamic_cast (processor)) +@@ -1943,7 +1935,7 @@ private: + + pointer_sized_int handleGetVstInterfaceVersion (VstOpCodeArguments) + { +- return kVstVersion; ++ return Vst2::juceVstInterfaceVersion; + } + + pointer_sized_int handleGetCurrentMidiProgram (VstOpCodeArguments) +@@ -1953,8 +1945,8 @@ private: + + pointer_sized_int handleGetSpeakerConfiguration (VstOpCodeArguments args) + { +- auto** pluginInput = reinterpret_cast (args.value); +- auto** pluginOutput = reinterpret_cast (args.ptr); ++ auto** pluginInput = reinterpret_cast (args.value); ++ auto** pluginOutput = reinterpret_cast (args.ptr); + + if (pluginHasSidechainsOrAuxs() || processor->isMidiEffect()) + return false; +@@ -1962,10 +1954,10 @@ private: + auto inputLayout = processor->getChannelLayoutOfBus (true, 0); + auto outputLayout = processor->getChannelLayoutOfBus (false, 0); + +- auto speakerBaseSize = sizeof (Vst2::VstSpeakerArrangement) - (sizeof (Vst2::VstSpeakerProperties) * 8); ++ auto speakerBaseSize = sizeof (Vst2::VstSpeakerConfiguration) - (sizeof (Vst2::VstIndividualSpeakerInfo) * 8); + +- cachedInArrangement .malloc (speakerBaseSize + (static_cast (inputLayout. size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); +- cachedOutArrangement.malloc (speakerBaseSize + (static_cast (outputLayout.size()) * sizeof (Vst2::VstSpeakerArrangement)), 1); ++ cachedInArrangement .malloc (speakerBaseSize + (static_cast (inputLayout. size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1); ++ cachedOutArrangement.malloc (speakerBaseSize + (static_cast (outputLayout.size()) * sizeof (Vst2::VstSpeakerConfiguration)), 1); + + *pluginInput = cachedInArrangement. getData(); + *pluginOutput = cachedOutArrangement.getData(); +@@ -1987,7 +1979,7 @@ private: + { + if (processor != nullptr) + { +- processor->setProcessingPrecision ((args.value == Vst2::kVstProcessPrecision64 ++ processor->setProcessingPrecision ((args.value == Vst2::vstProcessingSampleTypeDouble + && processor->supportsDoublePrecisionProcessing()) + ? AudioProcessor::doublePrecision + : AudioProcessor::singlePrecision); +@@ -2061,16 +2053,16 @@ private: + } + + //============================================================================== +- Vst2::audioMasterCallback hostCallback; ++ Vst2::VstHostCallback hostCallback; + AudioProcessor* processor = {}; + double sampleRate = 44100.0; + int32 blockSize = 1024; +- Vst2::AEffect vstEffect; ++ Vst2::VstEffectInterface vstEffect; + CriticalSection stateInformationLock; + juce::MemoryBlock chunkMemory; + uint32 chunkMemoryTime = 0; + std::unique_ptr editorComp; +- Vst2::ERect editorBounds; ++ Vst2::VstEditorBounds editorBounds; + MidiBuffer midiEvents; + VSTMidiEventList outgoingEvents; + +@@ -2095,7 +2087,7 @@ private: + VstTempBuffers doubleTempBuffers; + int maxNumInChannels = 0, maxNumOutChannels = 0; + +- HeapBlock cachedInArrangement, cachedOutArrangement; ++ HeapBlock cachedInArrangement, cachedOutArrangement; + + ThreadLocalValue inParameterChangedCallback; + +@@ -2107,7 +2099,7 @@ private: + //============================================================================== + namespace + { +- Vst2::AEffect* pluginEntryPoint (Vst2::audioMasterCallback audioMaster) ++ Vst2::VstEffectInterface* pluginEntryPoint (Vst2::VstHostCallback audioMaster) + { + JUCE_AUTORELEASEPOOL + { +@@ -2115,7 +2107,7 @@ namespace + + try + { +- if (audioMaster (nullptr, Vst2::audioMasterVersion, 0, 0, nullptr, 0) != 0) ++ if (audioMaster (nullptr, Vst2::hostOpcodeVstVersion, 0, 0, nullptr, 0) != 0) + { + #if JUCE_LINUX + MessageManagerLock mmLock; +@@ -2152,8 +2144,8 @@ namespace + // Mac startup code.. + #if JUCE_MAC + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2161,8 +2153,8 @@ namespace + return pluginEntryPoint (audioMaster); + } + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_macho (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_macho (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2174,8 +2166,8 @@ namespace + // Linux startup code.. + #elif JUCE_LINUX + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2183,8 +2175,8 @@ namespace + return pluginEntryPoint (audioMaster); + } + +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) asm ("main"); +- JUCE_EXPORTED_FUNCTION Vst2::AEffect* main_plugin (Vst2::audioMasterCallback audioMaster) ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) asm ("main"); ++ JUCE_EXPORTED_FUNCTION Vst2::VstEffectInterface* main_plugin (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2199,7 +2191,7 @@ namespace + // Win32 startup code.. + #else + +- extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster) ++ extern "C" __declspec (dllexport) Vst2::VstEffectInterface* VSTPluginMain (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +@@ -2207,7 +2199,7 @@ namespace + } + + #ifndef JUCE_64BIT // (can't compile this on win64, but it's not needed anyway with VST2.4) +- extern "C" __declspec (dllexport) int main (Vst2::audioMasterCallback audioMaster) ++ extern "C" __declspec (dllexport) int main (Vst2::VstHostCallback audioMaster) + { + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; + +diff --git a/modules/juce_audio_processors/format_types/juce_VSTCommon.h b/modules/juce_audio_processors/format_types/juce_VSTCommon.h +index 25436f9bf..0862f830f 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTCommon.h ++++ b/modules/juce_audio_processors/format_types/juce_VSTCommon.h +@@ -58,25 +58,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + + static AudioChannelSet vstArrangementTypeToChannelSet (int32 arr, int fallbackNumChannels) + { +- if (arr == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled(); +- else if (arr == Vst2::kSpeakerArrMono) return AudioChannelSet::mono(); +- else if (arr == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo(); +- else if (arr == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR(); +- else if (arr == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS(); +- else if (arr == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS(); +- else if (arr == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0(); +- else if (arr == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1(); +- else if (arr == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0(); +- else if (arr == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1(); +- else if (arr == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music(); +- else if (arr == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music(); +- else if (arr == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0(); +- else if (arr == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS(); +- else if (arr == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1(); +- else if (arr == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS(); +- else if (arr == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic(); +- +- for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) ++ if (arr == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled(); ++ else if (arr == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS(); ++ else if (arr == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic(); ++ ++ for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) + { + if (m->vst2 == arr) + { +@@ -92,53 +92,53 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + return AudioChannelSet::discreteChannels (fallbackNumChannels); + } + +- static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr) ++ static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr) + { +- return vstArrangementTypeToChannelSet (arr.type, arr.numChannels); ++ return vstArrangementTypeToChannelSet (arr.type, arr.numberOfChannels); + } + + static int32 channelSetToVstArrangementType (AudioChannelSet channels) + { +- if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty; +- else if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono; +- else if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo; +- else if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine; +- else if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music; +- else if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine; +- else if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50; +- else if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51; +- else if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine; +- else if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine; +- else if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music; +- else if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music; +- else if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music; +- else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine; +- else if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music; +- else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine; +- else if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music; ++ if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty; ++ else if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono; ++ else if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR; ++ else if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC; ++ else if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS; ++ else if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS; ++ else if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs; ++ else if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs; ++ else if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs; ++ else if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs; ++ else if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr; ++ else if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr; ++ else if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr; ++ else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc; ++ else if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr; ++ else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc; ++ else if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs; + + if (channels == AudioChannelSet::disabled()) +- return Vst2::kSpeakerArrEmpty; ++ return Vst2::vstSpeakerConfigTypeEmpty; + + auto chans = channels.getChannelTypes(); + +- for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m) ++ for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m) + if (m->matches (chans)) + return m->vst2; + +- return Vst2::kSpeakerArrUserDefined; ++ return Vst2::vstSpeakerConfigTypeUser; + } + +- static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerArrangement& result) ++ static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerConfiguration& result) + { + result.type = channelSetToVstArrangementType (channels); +- result.numChannels = channels.size(); ++ result.numberOfChannels = channels.size(); + +- for (int i = 0; i < result.numChannels; ++i) ++ for (int i = 0; i < result.numberOfChannels; ++i) + { + auto& speaker = result.speakers[i]; + +- zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties)); ++ zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo)); + speaker.type = getSpeakerType (channels.getTypeOfChannel (i)); + } + } +@@ -152,7 +152,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + clear(); + } + +- VstSpeakerConfigurationHolder (const Vst2::VstSpeakerArrangement& vstConfig) ++ VstSpeakerConfigurationHolder (const Vst2::VstSpeakerConfiguration& vstConfig) + { + operator= (vstConfig); + } +@@ -171,29 +171,29 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + VstSpeakerConfigurationHolder (const AudioChannelSet& channels) + { + auto numberOfChannels = channels.size(); +- Vst2::VstSpeakerArrangement& dst = *allocate (numberOfChannels); ++ Vst2::VstSpeakerConfiguration& dst = *allocate (numberOfChannels); + + dst.type = channelSetToVstArrangementType (channels); +- dst.numChannels = numberOfChannels; ++ dst.numberOfChannels = numberOfChannels; + +- for (int i = 0; i < dst.numChannels; ++i) ++ for (int i = 0; i < dst.numberOfChannels; ++i) + { +- Vst2::VstSpeakerProperties& speaker = dst.speakers[i]; ++ Vst2::VstIndividualSpeakerInfo& speaker = dst.speakers[i]; + +- zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties)); ++ zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo)); + speaker.type = getSpeakerType (channels.getTypeOfChannel (i)); + } + } + + VstSpeakerConfigurationHolder& operator= (const VstSpeakerConfigurationHolder& vstConfig) { return operator=(vstConfig.get()); } +- VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerArrangement& vstConfig) ++ VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerConfiguration& vstConfig) + { +- Vst2::VstSpeakerArrangement& dst = *allocate (vstConfig.numChannels); ++ Vst2::VstSpeakerConfiguration& dst = *allocate (vstConfig.numberOfChannels); + + dst.type = vstConfig.type; +- dst.numChannels = vstConfig.numChannels; ++ dst.numberOfChannels = vstConfig.numberOfChannels; + +- for (int i = 0; i < dst.numChannels; ++i) ++ for (int i = 0; i < dst.numberOfChannels; ++i) + dst.speakers[i] = vstConfig.speakers[i]; + + return *this; +@@ -207,17 +207,17 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + return *this; + } + +- const Vst2::VstSpeakerArrangement& get() const { return *storage.get(); } ++ const Vst2::VstSpeakerConfiguration& get() const { return *storage.get(); } + + private: + JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder) + +- HeapBlock storage; ++ HeapBlock storage; + +- Vst2::VstSpeakerArrangement* allocate (int numChannels) ++ Vst2::VstSpeakerConfiguration* allocate (int numChannels) + { +- auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties) +- + sizeof (Vst2::VstSpeakerArrangement); ++ auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstIndividualSpeakerInfo) ++ + sizeof (Vst2::VstSpeakerConfiguration); + + storage.malloc (1, arrangementSize); + return storage.get(); +@@ -225,10 +225,10 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + + void clear() + { +- Vst2::VstSpeakerArrangement& dst = *allocate (0); ++ Vst2::VstSpeakerConfiguration& dst = *allocate (0); + +- dst.type = Vst2::kSpeakerArrEmpty; +- dst.numChannels = 0; ++ dst.type = Vst2::vstSpeakerConfigTypeEmpty; ++ dst.numberOfChannels = 0; + } + }; + +@@ -236,36 +236,36 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + static const Mapping mappings[] = + { +- { Vst2::kSpeakerArrMono, { centre, unknown } }, +- { Vst2::kSpeakerArrStereo, { left, right, unknown } }, +- { Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } }, +- { Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } }, +- { Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } }, +- { Vst2::kSpeakerArr30Music, { left, right, surround, unknown } }, +- { Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } }, +- { Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } }, +- { Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } }, +- { Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } }, +- { Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, +- { Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, +- { Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, +- { Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, +- { Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, +- { Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, +- { Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, +- { Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, +- { Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, +- { Vst2::kSpeakerArrEmpty, { unknown } } ++ { Vst2::vstSpeakerConfigTypeMono, { centre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } }, ++ { Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } }, ++ { Vst2::vstSpeakerConfigTypeEmpty, { unknown } } + }; + + return mappings; +@@ -275,25 +275,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + static const std::map speakerTypeMap = + { +- { AudioChannelSet::left, Vst2::kSpeakerL }, +- { AudioChannelSet::right, Vst2::kSpeakerR }, +- { AudioChannelSet::centre, Vst2::kSpeakerC }, +- { AudioChannelSet::LFE, Vst2::kSpeakerLfe }, +- { AudioChannelSet::leftSurround, Vst2::kSpeakerLs }, +- { AudioChannelSet::rightSurround, Vst2::kSpeakerRs }, +- { AudioChannelSet::leftCentre, Vst2::kSpeakerLc }, +- { AudioChannelSet::rightCentre, Vst2::kSpeakerRc }, +- { AudioChannelSet::surround, Vst2::kSpeakerS }, +- { AudioChannelSet::leftSurroundRear, Vst2::kSpeakerSl }, +- { AudioChannelSet::rightSurroundRear, Vst2::kSpeakerSr }, +- { AudioChannelSet::topMiddle, Vst2::kSpeakerTm }, +- { AudioChannelSet::topFrontLeft, Vst2::kSpeakerTfl }, +- { AudioChannelSet::topFrontCentre, Vst2::kSpeakerTfc }, +- { AudioChannelSet::topFrontRight, Vst2::kSpeakerTfr }, +- { AudioChannelSet::topRearLeft, Vst2::kSpeakerTrl }, +- { AudioChannelSet::topRearCentre, Vst2::kSpeakerTrc }, +- { AudioChannelSet::topRearRight, Vst2::kSpeakerTrr }, +- { AudioChannelSet::LFE2, Vst2::kSpeakerLfe2 } ++ { AudioChannelSet::left, Vst2::vstIndividualSpeakerTypeLeft }, ++ { AudioChannelSet::right, Vst2::vstIndividualSpeakerTypeRight }, ++ { AudioChannelSet::centre, Vst2::vstIndividualSpeakerTypeCentre }, ++ { AudioChannelSet::LFE, Vst2::vstIndividualSpeakerTypeLFE }, ++ { AudioChannelSet::leftSurround, Vst2::vstIndividualSpeakerTypeLeftSurround }, ++ { AudioChannelSet::rightSurround, Vst2::vstIndividualSpeakerTypeRightSurround }, ++ { AudioChannelSet::leftCentre, Vst2::vstIndividualSpeakerTypeLeftCentre }, ++ { AudioChannelSet::rightCentre, Vst2::vstIndividualSpeakerTypeRightCentre }, ++ { AudioChannelSet::surround, Vst2::vstIndividualSpeakerTypeSurround }, ++ { AudioChannelSet::leftSurroundRear, Vst2::vstIndividualSpeakerTypeLeftRearSurround }, ++ { AudioChannelSet::rightSurroundRear, Vst2::vstIndividualSpeakerTypeRightRearSurround }, ++ { AudioChannelSet::topMiddle, Vst2::vstIndividualSpeakerTypeTopMiddle }, ++ { AudioChannelSet::topFrontLeft, Vst2::vstIndividualSpeakerTypeTopFrontLeft }, ++ { AudioChannelSet::topFrontCentre, Vst2::vstIndividualSpeakerTypeTopFrontCentre }, ++ { AudioChannelSet::topFrontRight, Vst2::vstIndividualSpeakerTypeTopFrontRight }, ++ { AudioChannelSet::topRearLeft, Vst2::vstIndividualSpeakerTypeTopRearLeft }, ++ { AudioChannelSet::topRearCentre, Vst2::vstIndividualSpeakerTypeTopRearCentre }, ++ { AudioChannelSet::topRearRight, Vst2::vstIndividualSpeakerTypeTopRearRight }, ++ { AudioChannelSet::LFE2, Vst2::vstIndividualSpeakerTypeLFE2 } + }; + + if (speakerTypeMap.find (type) == speakerTypeMap.end()) +@@ -306,25 +306,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e + { + switch (type) + { +- case Vst2::kSpeakerL: return AudioChannelSet::left; +- case Vst2::kSpeakerR: return AudioChannelSet::right; +- case Vst2::kSpeakerC: return AudioChannelSet::centre; +- case Vst2::kSpeakerLfe: return AudioChannelSet::LFE; +- case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround; +- case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround; +- case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre; +- case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre; +- case Vst2::kSpeakerS: return AudioChannelSet::surround; +- case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear; +- case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear; +- case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle; +- case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft; +- case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre; +- case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight; +- case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft; +- case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre; +- case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight; +- case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2; ++ case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left; ++ case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right; ++ case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre; ++ case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE; ++ case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround; ++ case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround; ++ case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre; ++ case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre; ++ case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround; ++ case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear; ++ case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear; ++ case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle; ++ case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft; ++ case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre; ++ case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight; ++ case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft; ++ case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre; ++ case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight; ++ case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2; + default: break; + } + +diff --git a/modules/juce_audio_processors/format_types/juce_VSTInterface.h b/modules/juce_audio_processors/format_types/juce_VSTInterface.h +new file mode 100644 +index 000000000..a2f09aae9 +--- /dev/null ++++ b/modules/juce_audio_processors/format_types/juce_VSTInterface.h +@@ -0,0 +1,529 @@ ++/* ++ ============================================================================== ++ ++ This file is part of the JUCE library. ++ Copyright (c) 2017 - ROLI Ltd. ++ ++ JUCE is an open source library subject to commercial or open-source ++ licensing. ++ ++ By using JUCE, you agree to the terms of both the JUCE 5 End-User License ++ Agreement and JUCE 5 Privacy Policy (both updated and effective as of the ++ 27th April 2017). ++ ++ End User License Agreement: www.juce.com/juce-5-licence ++ Privacy Policy: www.juce.com/juce-5-privacy-policy ++ ++ Or: You may also use this code under the terms of the GPL v3 (see ++ www.gnu.org/licenses). ++ ++ JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER ++ EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE ++ DISCLAIMED. ++ ++ ============================================================================== ++*/ ++ ++#define JUCE_VSTINTERFACE_H_INCLUDED ++ ++using namespace juce; ++ ++#if JUCE_MSVC ++ #define VSTINTERFACECALL __cdecl ++ #pragma pack(push) ++ #pragma pack(8) ++#elif JUCE_MAC || JUCE_IOS ++ #define VSTINTERFACECALL ++ #if JUCE_64BIT ++ #pragma options align=power ++ #else ++ #pragma options align=mac68k ++ #endif ++#else ++ #define VSTINTERFACECALL ++ #pragma pack(push, 8) ++#endif ++ ++const int32 juceVstInterfaceVersion = 2400; ++const int32 juceVstInterfaceIdentifier = 0x56737450; // The "magic" identifier in the SDK is 'VstP'. ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstEffectInterface ++{ ++ int32 interfaceIdentifier; ++ pointer_sized_int (VSTINTERFACECALL* dispatchFunction) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt); ++ void (VSTINTERFACECALL* processAudioFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples); ++ void (VSTINTERFACECALL* setParameterValueFunction) (VstEffectInterface*, int32 parameterIndex, float value); ++ float (VSTINTERFACECALL* getParameterValueFunction) (VstEffectInterface*, int32 parameterIndex); ++ int32 numPrograms; ++ int32 numParameters; ++ int32 numInputChannels; ++ int32 numOutputChannels; ++ int32 flags; ++ pointer_sized_int hostSpace1; ++ pointer_sized_int hostSpace2; ++ int32 latency; ++ int32 deprecated1; ++ int32 deprecated2; ++ float deprecated3; ++ void* effectPointer; ++ void* userPointer; ++ int32 plugInIdentifier; ++ int32 plugInVersion; ++ void (VSTINTERFACECALL* processAudioInplaceFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples); ++ void (VSTINTERFACECALL* processDoubleAudioInplaceFunction) (VstEffectInterface*, double** inputs, double** outputs, int32 numSamples); ++ char emptySpace[56]; ++}; ++ ++typedef pointer_sized_int (VSTINTERFACECALL* VstHostCallback) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt); ++ ++enum VstEffectInterfaceFlags ++{ ++ vstEffectFlagHasEditor = 1, ++ vstEffectFlagInplaceAudio = 16, ++ vstEffectFlagDataInChunks = 32, ++ vstEffectFlagIsSynth = 256, ++ vstEffectFlagInplaceDoubleAudio = 4096 ++}; ++ ++//============================================================================== ++enum VstHostToPlugInOpcodes ++{ ++ plugInOpcodeOpen, ++ plugInOpcodeClose, ++ plugInOpcodeSetCurrentProgram, ++ plugInOpcodeGetCurrentProgram, ++ plugInOpcodeSetCurrentProgramName, ++ plugInOpcodeGetCurrentProgramName, ++ plugInOpcodeGetParameterLabel, ++ plugInOpcodeGetParameterText, ++ plugInOpcodeGetParameterName, ++ plugInOpcodeSetSampleRate = plugInOpcodeGetParameterName + 2, ++ plugInOpcodeSetBlockSize, ++ plugInOpcodeResumeSuspend, ++ plugInOpcodeGetEditorBounds, ++ plugInOpcodeOpenEditor, ++ plugInOpcodeCloseEditor, ++ plugInOpcodeDrawEditor, ++ plugInOpcodeGetMouse, ++ plugInOpcodeEditorIdle = plugInOpcodeGetMouse + 2, ++ plugInOpcodeeffEditorTop, ++ plugInOpcodeSleepEditor, ++ plugInOpcodeIdentify, ++ plugInOpcodeGetData, ++ plugInOpcodeSetData, ++ plugInOpcodePreAudioProcessingEvents, ++ plugInOpcodeIsParameterAutomatable, ++ plugInOpcodeParameterValueForText, ++ plugInOpcodeGetProgramName = plugInOpcodeParameterValueForText + 2, ++ plugInOpcodeConnectInput = plugInOpcodeGetProgramName + 2, ++ plugInOpcodeConnectOutput, ++ plugInOpcodeGetInputPinProperties, ++ plugInOpcodeGetOutputPinProperties, ++ plugInOpcodeGetPlugInCategory, ++ plugInOpcodeSetSpeakerConfiguration = plugInOpcodeGetPlugInCategory + 7, ++ plugInOpcodeSetBypass = plugInOpcodeSetSpeakerConfiguration + 2, ++ plugInOpcodeGetPlugInName, ++ plugInOpcodeGetManufacturerName = plugInOpcodeGetPlugInName + 2, ++ plugInOpcodeGetManufacturerProductName, ++ plugInOpcodeGetManufacturerVersion, ++ plugInOpcodeManufacturerSpecific, ++ plugInOpcodeCanPlugInDo, ++ plugInOpcodeGetTailSize, ++ plugInOpcodeIdle, ++ plugInOpcodeKeyboardFocusRequired = plugInOpcodeIdle + 4, ++ plugInOpcodeGetVstInterfaceVersion, ++ plugInOpcodeGetCurrentMidiProgram = plugInOpcodeGetVstInterfaceVersion + 5, ++ plugInOpcodeGetSpeakerArrangement = plugInOpcodeGetCurrentMidiProgram + 6, ++ plugInOpcodeNextPlugInUniqueID, ++ plugInOpcodeStartProcess, ++ plugInOpcodeStopProcess, ++ plugInOpcodeSetNumberOfSamplesToProcess, ++ plugInOpcodeSetSampleFloatType = plugInOpcodeSetNumberOfSamplesToProcess + 4, ++ pluginOpcodeGetNumMidiInputChannels, ++ pluginOpcodeGetNumMidiOutputChannels, ++ plugInOpcodeMaximum = pluginOpcodeGetNumMidiOutputChannels ++}; ++ ++ ++enum VstPlugInToHostOpcodes ++{ ++ hostOpcodeParameterChanged, ++ hostOpcodeVstVersion, ++ hostOpcodeCurrentId, ++ hostOpcodeIdle, ++ hostOpcodePinConnected, ++ hostOpcodePlugInWantsMidi = hostOpcodePinConnected + 2, ++ hostOpcodeGetTimingInfo, ++ hostOpcodePreAudioProcessingEvents, ++ hostOpcodeSetTime, ++ hostOpcodeTempoAt, ++ hostOpcodeGetNumberOfAutomatableParameters, ++ hostOpcodeGetParameterInterval, ++ hostOpcodeIOModified, ++ hostOpcodeNeedsIdle, ++ hostOpcodeWindowSize, ++ hostOpcodeGetSampleRate, ++ hostOpcodeGetBlockSize, ++ hostOpcodeGetInputLatency, ++ hostOpcodeGetOutputLatency, ++ hostOpcodeGetPreviousPlugIn, ++ hostOpcodeGetNextPlugIn, ++ hostOpcodeWillReplace, ++ hostOpcodeGetCurrentAudioProcessingLevel, ++ hostOpcodeGetAutomationState, ++ hostOpcodeOfflineStart, ++ hostOpcodeOfflineReadSource, ++ hostOpcodeOfflineWrite, ++ hostOpcodeOfflineGetCurrentPass, ++ hostOpcodeOfflineGetCurrentMetaPass, ++ hostOpcodeSetOutputSampleRate, ++ hostOpcodeGetOutputSpeakerConfiguration, ++ hostOpcodeGetManufacturerName, ++ hostOpcodeGetProductName, ++ hostOpcodeGetManufacturerVersion, ++ hostOpcodeManufacturerSpecific, ++ hostOpcodeSetIcon, ++ hostOpcodeCanHostDo, ++ hostOpcodeGetLanguage, ++ hostOpcodeOpenEditorWindow, ++ hostOpcodeCloseEditorWindow, ++ hostOpcodeGetDirectory, ++ hostOpcodeUpdateView, ++ hostOpcodeParameterChangeGestureBegin, ++ hostOpcodeParameterChangeGestureEnd, ++}; ++ ++//============================================================================== ++enum VstProcessingSampleType ++{ ++ vstProcessingSampleTypeFloat, ++ vstProcessingSampleTypeDouble ++}; ++ ++//============================================================================== ++// These names must be identical to the Steinberg SDK so JUCE users can set ++// exactly what they want. ++enum VstPlugInCategory ++{ ++ kPlugCategUnknown, ++ kPlugCategEffect, ++ kPlugCategSynth, ++ kPlugCategAnalysis, ++ kPlugCategMastering, ++ kPlugCategSpacializer, ++ kPlugCategRoomFx, ++ kPlugSurroundFx, ++ kPlugCategRestoration, ++ kPlugCategOfflineProcess, ++ kPlugCategShell, ++ kPlugCategGenerator ++}; ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstEditorBounds ++{ ++ int16 upper; ++ int16 leftmost; ++ int16 lower; ++ int16 rightmost; ++}; ++ ++//============================================================================== ++enum VstMaxStringLengths ++{ ++ vstMaxNameLength = 64, ++ vstMaxParameterOrPinLabelLength = 64, ++ vstMaxParameterOrPinShortLabelLength = 8, ++ vstMaxCategoryLength = 24, ++ vstMaxManufacturerStringLength = 64, ++ vstMaxPlugInNameStringLength = 64 ++}; ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstPinInfo ++{ ++ char text[vstMaxParameterOrPinLabelLength]; ++ int32 flags; ++ int32 configurationType; ++ char shortText[vstMaxParameterOrPinShortLabelLength]; ++ char unused[48]; ++}; ++ ++enum VstPinInfoFlags ++{ ++ vstPinInfoFlagIsActive = 1, ++ vstPinInfoFlagIsStereo = 2, ++ vstPinInfoFlagValid = 4 ++}; ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstEvent ++{ ++ int32 type; ++ int32 size; ++ int32 sampleOffset; ++ int32 flags; ++ char content[16]; ++}; ++ ++enum VstEventTypes ++{ ++ vstMidiEventType = 1, ++ vstSysExEventType = 6 ++}; ++ ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstEventBlock ++{ ++ int32 numberOfEvents; ++ pointer_sized_int future; ++ VstEvent* events[2]; ++}; ++ ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstMidiEvent ++{ ++ int32 type; ++ int32 size; ++ int32 sampleOffset; ++ int32 flags; ++ int32 noteSampleLength; ++ int32 noteSampleOffset; ++ char midiData[4]; ++ char tuning; ++ char noteVelocityOff; ++ char future1; ++ char future2; ++}; ++ ++enum VstMidiEventFlags ++{ ++ vstMidiEventIsRealtime = 1 ++}; ++ ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstSysExEvent ++{ ++ int32 type; ++ int32 size; ++ int32 offsetSamples; ++ int32 flags; ++ int32 sysExDumpSize; ++ pointer_sized_int future1; ++ char* sysExDump; ++ pointer_sized_int future2; ++}; ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstTimingInformation ++{ ++ double samplePosition; ++ double sampleRate; ++ double systemTimeNanoseconds; ++ double musicalPosition; ++ double tempoBPM; ++ double lastBarPosition; ++ double loopStartPosition; ++ double loopEndPosition; ++ int32 timeSignatureNumerator; ++ int32 timeSignatureDenominator; ++ int32 smpteOffset; ++ int32 smpteRate; ++ int32 samplesToNearestClock; ++ int32 flags; ++}; ++ ++enum VstTimingInformationFlags ++{ ++ vstTimingInfoFlagTransportChanged = 1, ++ vstTimingInfoFlagCurrentlyPlaying = 2, ++ vstTimingInfoFlagLoopActive = 4, ++ vstTimingInfoFlagCurrentlyRecording = 8, ++ vstTimingInfoFlagAutomationWriteModeActive = 64, ++ vstTimingInfoFlagAutomationReadModeActive = 128, ++ vstTimingInfoFlagNanosecondsValid = 256, ++ vstTimingInfoFlagMusicalPositionValid = 512, ++ vstTimingInfoFlagTempoValid = 1024, ++ vstTimingInfoFlagLastBarPositionValid = 2048, ++ vstTimingInfoFlagLoopPositionValid = 4096, ++ vstTimingInfoFlagTimeSignatureValid = 8192, ++ vstTimingInfoFlagSmpteValid = 16384, ++ vstTimingInfoFlagNearestClockValid = 32768 ++}; ++ ++//============================================================================== ++enum VstSmpteRates ++{ ++ vstSmpteRateFps24, ++ vstSmpteRateFps25, ++ vstSmpteRateFps2997, ++ vstSmpteRateFps30, ++ vstSmpteRateFps2997drop, ++ vstSmpteRateFps30drop, ++ ++ vstSmpteRate16mmFilm, ++ vstSmpteRate35mmFilm, ++ ++ vstSmpteRateFps239 = vstSmpteRate35mmFilm + 3, ++ vstSmpteRateFps249 , ++ vstSmpteRateFps599, ++ vstSmpteRateFps60 ++}; ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstIndividualSpeakerInfo ++{ ++ float azimuthalAngle; ++ float elevationAngle; ++ float radius; ++ float reserved; ++ char label[vstMaxNameLength]; ++ int32 type; ++ char unused[28]; ++}; ++ ++enum VstIndividualSpeakerType ++{ ++ vstIndividualSpeakerTypeUndefined = 0x7fffffff, ++ vstIndividualSpeakerTypeMono = 0, ++ vstIndividualSpeakerTypeLeft, ++ vstIndividualSpeakerTypeRight, ++ vstIndividualSpeakerTypeCentre, ++ vstIndividualSpeakerTypeLFE, ++ vstIndividualSpeakerTypeLeftSurround, ++ vstIndividualSpeakerTypeRightSurround, ++ vstIndividualSpeakerTypeLeftCentre, ++ vstIndividualSpeakerTypeRightCentre, ++ vstIndividualSpeakerTypeSurround, ++ vstIndividualSpeakerTypeCentreSurround = vstIndividualSpeakerTypeSurround, ++ vstIndividualSpeakerTypeLeftRearSurround, ++ vstIndividualSpeakerTypeRightRearSurround, ++ vstIndividualSpeakerTypeTopMiddle, ++ vstIndividualSpeakerTypeTopFrontLeft, ++ vstIndividualSpeakerTypeTopFrontCentre, ++ vstIndividualSpeakerTypeTopFrontRight, ++ vstIndividualSpeakerTypeTopRearLeft, ++ vstIndividualSpeakerTypeTopRearCentre, ++ vstIndividualSpeakerTypeTopRearRight, ++ vstIndividualSpeakerTypeLFE2 ++}; ++ ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct VstSpeakerConfiguration ++{ ++ int32 type; ++ int32 numberOfChannels; ++ VstIndividualSpeakerInfo speakers[8]; ++}; ++ ++enum VstSpeakerConfigurationType ++{ ++ vstSpeakerConfigTypeUser = -2, ++ vstSpeakerConfigTypeEmpty = -1, ++ vstSpeakerConfigTypeMono = 0, ++ vstSpeakerConfigTypeLR, ++ vstSpeakerConfigTypeLsRs, ++ vstSpeakerConfigTypeLcRc, ++ vstSpeakerConfigTypeSlSr, ++ vstSpeakerConfigTypeCLfe, ++ vstSpeakerConfigTypeLRC, ++ vstSpeakerConfigTypeLRS, ++ vstSpeakerConfigTypeLRCLfe, ++ vstSpeakerConfigTypeLRLfeS, ++ vstSpeakerConfigTypeLRCS, ++ vstSpeakerConfigTypeLRLsRs, ++ vstSpeakerConfigTypeLRCLfeS, ++ vstSpeakerConfigTypeLRLfeLsRs, ++ vstSpeakerConfigTypeLRCLsRs, ++ vstSpeakerConfigTypeLRCLfeLsRs, ++ vstSpeakerConfigTypeLRCLsRsCs, ++ vstSpeakerConfigTypeLRLsRsSlSr, ++ vstSpeakerConfigTypeLRCLfeLsRsCs, ++ vstSpeakerConfigTypeLRLfeLsRsSlSr, ++ vstSpeakerConfigTypeLRCLsRsLcRc, ++ vstSpeakerConfigTypeLRCLsRsSlSr, ++ vstSpeakerConfigTypeLRCLfeLsRsLcRc, ++ vstSpeakerConfigTypeLRCLfeLsRsSlSr, ++ vstSpeakerConfigTypeLRCLsRsLcRcCs, ++ vstSpeakerConfigTypeLRCLsRsCsSlSr, ++ vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, ++ vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, ++ vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2 ++}; ++ ++#if JUCE_BIG_ENDIAN ++ #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (a | (((uint32) b) << 8) | (((uint32) c) << 16) | (((uint32) d) << 24)) ++#else ++ #define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (d | (((uint32) c) << 8) | (((uint32) b) << 16) | (((uint32) a) << 24)) ++#endif ++ ++enum PresonusExtensionConstants ++{ ++ presonusVendorID = JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'), ++ presonusSetContentScaleFactor = JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's') ++}; ++ ++//============================================================================== ++/** Structure used for VSTs ++ ++ @tags{Audio} ++*/ ++struct vst2FxBank ++{ ++ int32 magic1; ++ int32 size; ++ int32 magic2; ++ int32 version1; ++ int32 fxID; ++ int32 version2; ++ int32 elements; ++ int32 current; ++ char shouldBeZero[124]; ++ int32 chunkSize; ++ char chunk[1]; ++}; ++ ++#if JUCE_MSVC ++ #pragma pack(pop) ++#elif JUCE_MAC || JUCE_IOS ++ #pragma options align=reset ++#else ++ #pragma pack(pop) ++#endif +diff --git a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h +index 85c163d59..a39d22f93 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h ++++ b/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h +@@ -50,7 +50,7 @@ public: + numEventsUsed = 0; + + if (events != nullptr) +- events->numEvents = 0; ++ events->numberOfEvents = 0; + } + + void addEvent (const void* const midiData, int numBytes, int frameOffset) +@@ -59,50 +59,50 @@ public: + + void* const ptr = (Vst2::VstMidiEvent*) (events->events [numEventsUsed]); + auto* const e = (Vst2::VstMidiEvent*) ptr; +- events->numEvents = ++numEventsUsed; ++ events->numberOfEvents = ++numEventsUsed; + + if (numBytes <= 4) + { +- if (e->type == Vst2::kVstSysExType) ++ if (e->type == Vst2::vstSysExEventType) + { +- delete[] (((Vst2::VstMidiSysexEvent*) ptr)->sysexDump); +- e->type = Vst2::kVstMidiType; +- e->byteSize = sizeof (Vst2::VstMidiEvent); +- e->noteLength = 0; +- e->noteOffset = 0; +- e->detune = 0; +- e->noteOffVelocity = 0; ++ delete[] (((Vst2::VstSysExEvent*) ptr)->sysExDump); ++ e->type = Vst2::vstMidiEventType; ++ e->size = sizeof (Vst2::VstMidiEvent); ++ e->noteSampleLength = 0; ++ e->noteSampleOffset = 0; ++ e->tuning = 0; ++ e->noteVelocityOff = 0; + } + +- e->deltaFrames = frameOffset; ++ e->sampleOffset = frameOffset; + memcpy (e->midiData, midiData, (size_t) numBytes); + } + else + { +- auto* const se = (Vst2::VstMidiSysexEvent*) ptr; ++ auto* const se = (Vst2::VstSysExEvent*) ptr; + +- if (se->type == Vst2::kVstSysExType) +- delete[] se->sysexDump; ++ if (se->type == Vst2::vstSysExEventType) ++ delete[] se->sysExDump; + +- se->sysexDump = new char [(size_t) numBytes]; +- memcpy (se->sysexDump, midiData, (size_t) numBytes); ++ se->sysExDump = new char [(size_t) numBytes]; ++ memcpy (se->sysExDump, midiData, (size_t) numBytes); + +- se->type = Vst2::kVstSysExType; +- se->byteSize = sizeof (Vst2::VstMidiSysexEvent); +- se->deltaFrames = frameOffset; ++ se->type = Vst2::vstSysExEventType; ++ se->size = sizeof (Vst2::VstSysExEvent); ++ se->offsetSamples = frameOffset; + se->flags = 0; +- se->dumpBytes = numBytes; +- se->resvd1 = 0; +- se->resvd2 = 0; ++ se->sysExDumpSize = numBytes; ++ se->future1 = 0; ++ se->future2 = 0; + } + } + + //============================================================================== + // Handy method to pull the events out of an event buffer supplied by the host + // or plugin. +- static void addEventsToMidiBuffer (const Vst2::VstEvents* events, MidiBuffer& dest) ++ static void addEventsToMidiBuffer (const Vst2::VstEventBlock* events, MidiBuffer& dest) + { +- for (int i = 0; i < events->numEvents; ++i) ++ for (int i = 0; i < events->numberOfEvents; ++i) + { + const Vst2::VstEvent* const e = events->events[i]; + +@@ -110,17 +110,17 @@ public: + { + const void* const ptr = events->events[i]; + +- if (e->type == Vst2::kVstMidiType) ++ if (e->type == Vst2::vstMidiEventType) + { + dest.addEvent ((const juce::uint8*) ((const Vst2::VstMidiEvent*) ptr)->midiData, +- 4, e->deltaFrames); ++ 4, e->sampleOffset); + } +- else if (e->type == Vst2::kVstSysExType) ++ else if (e->type == Vst2::vstSysExEventType) + { +- const auto* se = (const Vst2::VstMidiSysexEvent*) ptr; +- dest.addEvent ((const juce::uint8*) se->sysexDump, +- (int) se->dumpBytes, +- e->deltaFrames); ++ const auto* se = (const Vst2::VstSysExEvent*) ptr; ++ dest.addEvent ((const juce::uint8*) se->sysExDump, ++ (int) se->sysExDumpSize, ++ e->sampleOffset); + } + } + } +@@ -161,25 +161,25 @@ public: + } + + //============================================================================== +- HeapBlock events; ++ HeapBlock events; + + private: + int numEventsUsed, numEventsAllocated; + + static Vst2::VstEvent* allocateVSTEvent() + { +- auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstMidiSysexEvent) ? sizeof (Vst2::VstMidiEvent) +- : sizeof (Vst2::VstMidiSysexEvent)); +- e->type = Vst2::kVstMidiType; +- e->byteSize = sizeof (Vst2::VstMidiEvent); ++ auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstSysExEvent) ? sizeof (Vst2::VstMidiEvent) ++ : sizeof (Vst2::VstSysExEvent)); ++ e->type = Vst2::vstMidiEventType; ++ e->size = sizeof (Vst2::VstMidiEvent); + return e; + } + + static void freeVSTEvent (Vst2::VstEvent* e) + { +- if (e->type == Vst2::kVstSysExType) ++ if (e->type == Vst2::vstSysExEventType) + { +- delete[] (reinterpret_cast (e)->sysexDump); ++ delete[] (reinterpret_cast (e)->sysExDump); + } + + std::free (e); +diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +index bdb285290..7dff1e70f 100644 +--- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp ++++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +@@ -30,7 +30,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant") + JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996) + + #define VST_FORCE_DEPRECATED 0 +-#define JUCE_VSTINTERFACE_H_INCLUDED 1 + + namespace Vst2 + { +@@ -39,8 +38,7 @@ namespace Vst2 + // paths or use the "VST (Legacy) SDK Folder" field in the Projucer. The VST2 + // SDK can be obtained from the vstsdk3610_11_06_2018_build_37 (or older) VST3 + // SDK or JUCE version 5.3.2. +-#include +-#include ++#include "../../juce_audio_processors/format_types/juce_VSTInterface.h" + } + + #include "juce_VSTCommon.h" +@@ -66,7 +64,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4355) + #endif + + #ifndef JUCE_VST_WRAPPER_INVOKE_MAIN +-#define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain ((Vst2::audioMasterCallback) &audioMaster); ++ #define JUCE_VST_WRAPPER_INVOKE_MAIN effect = module->moduleMain (&audioMaster); + #endif + + //============================================================================== +@@ -206,8 +204,8 @@ namespace + } + + //============================================================================== +-typedef Vst2::AEffect* (VSTCALLBACK *MainCall) (Vst2::audioMasterCallback); +-static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect*, int32, int32, pointer_sized_int, void*, float); ++typedef Vst2::VstEffectInterface* (VSTINTERFACECALL *MainCall) (Vst2::VstHostCallback); ++static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface*, int32, int32, pointer_sized_int, void*, float); + + //============================================================================== + // Change this to disable logging of various VST activities +@@ -675,9 +673,9 @@ struct ModuleHandle : public ReferenceCountedObject + module.close(); + } + +- void closeEffect (Vst2::AEffect* eff) ++ void closeEffect (Vst2::VstEffectInterface* eff) + { +- eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0); ++ eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0); + } + + #if JUCE_WINDOWS +@@ -801,9 +799,9 @@ struct ModuleHandle : public ReferenceCountedObject + } + } + +- void closeEffect (Vst2::AEffect* eff) ++ void closeEffect (Vst2::VstEffectInterface* eff) + { +- eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0); ++ eff->dispatchFunction (eff, Vst2::plugInOpcodeClose, 0, 0, nullptr, 0); + } + + #endif +@@ -855,7 +853,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + const ScopedLock sl (pluginInstance.lock); + +- return effect->getParameter (effect, getParameterIndex()); ++ return effect->getParameterValueFunction (effect, getParameterIndex()); + } + + return 0.0f; +@@ -867,8 +865,8 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + const ScopedLock sl (pluginInstance.lock); + +- if (effect->getParameter (effect, getParameterIndex()) != newValue) +- effect->setParameter (effect, getParameterIndex(), newValue); ++ if (effect->getParameterValueFunction (effect, getParameterIndex()) != newValue) ++ effect->setParameterValueFunction (effect, getParameterIndex(), newValue); + } + } + +@@ -901,7 +899,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (valueType != nullptr || ! vstValueStrings.isEmpty()) + return getText (getValue(), 1024); + +- return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::effGetParamDisplay); ++ return pluginInstance.getTextForOpcode (getParameterIndex(), Vst2::plugInOpcodeGetParameterText); + } + + float getDefaultValue() const override +@@ -913,7 +911,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (name.isEmpty()) + return pluginInstance.getTextForOpcode (getParameterIndex(), +- Vst2::effGetParamName); ++ Vst2::plugInOpcodeGetParameterName); + + if (name.length() <= maximumStringLength) + return name; +@@ -933,7 +931,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + String getLabel() const override + { + return label.isEmpty() ? pluginInstance.getTextForOpcode (getParameterIndex(), +- Vst2::effGetParamLabel) ++ Vst2::plugInOpcodeGetParameterLabel) + : label; + } + +@@ -975,7 +973,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + const VSTXMLInfo::ValueType* const valueType; + }; + +- VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::AEffect* effect, ++ VSTPluginInstance (const ModuleHandle::Ptr& mh, const BusesProperties& ioConfig, Vst2::VstEffectInterface* effect, + double sampleRateToUse, int blockSizeToUse) + : AudioPluginInstance (ioConfig), + vstEffect (effect), +@@ -998,13 +996,13 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + AudioProcessorParameterGroup newParameterTree; + +- for (int i = 0; i < vstEffect->numParams; ++i) ++ for (int i = 0; i < vstEffect->numParameters; ++i) + { + String paramName; + Array shortParamNames; + float defaultValue = 0; + String label; +- bool isAutomatable = dispatch (Vst2::effCanBeAutomated, i, 0, nullptr, 0) != 0; ++ bool isAutomatable = dispatch (Vst2::plugInOpcodeIsParameterAutomatable, i, 0, nullptr, 0) != 0; + bool isDiscrete = false; + int numSteps = AudioProcessor::getDefaultNumParameterSteps(); + bool isBoolSwitch = false; +@@ -1072,7 +1070,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + ~VSTPluginInstance() override + { +- if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */) ++ if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier) + { + struct VSTDeleter : public CallbackMessage + { +@@ -1105,7 +1103,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + void cleanup() + { +- if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */) ++ if (vstEffect != nullptr && vstEffect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier) + { + #if JUCE_MAC + if (vstModule->resFileId != 0) +@@ -1130,16 +1128,16 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (auto* newEffect = constructEffect (newModule)) + { +- newEffect->resvd2 = 0; ++ newEffect->hostSpace2 = 0; + +- newEffect->dispatcher (newEffect, Vst2::effIdentify, 0, 0, nullptr, 0); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0); + + auto blockSize = jmax (32, initialBlockSize); + +- newEffect->dispatcher (newEffect, Vst2::effSetSampleRate, 0, 0, nullptr, static_cast (initialSampleRate)); +- newEffect->dispatcher (newEffect, Vst2::effSetBlockSize, 0, blockSize, nullptr, 0); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, static_cast (initialSampleRate)); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeSetBlockSize, 0, blockSize, nullptr, 0); + +- newEffect->dispatcher (newEffect, Vst2::effOpen, 0, 0, nullptr, 0); ++ newEffect->dispatchFunction (newEffect, Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0); + BusesProperties ioConfig = queryBusIO (newEffect); + + return new VSTPluginInstance (newModule, ioConfig, newEffect, initialSampleRate, blockSize); +@@ -1155,7 +1153,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + { + char buffer[512] = { 0 }; +- dispatch (Vst2::effGetEffectName, 0, 0, buffer, 0); ++ dispatch (Vst2::plugInOpcodeGetPlugInName, 0, 0, buffer, 0); + + desc.descriptiveName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim(); + +@@ -1172,7 +1170,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + { + char buffer[512] = { 0 }; +- dispatch (Vst2::effGetVendorString, 0, 0, buffer, 0); ++ dispatch (Vst2::plugInOpcodeGetManufacturerName, 0, 0, buffer, 0); + desc.manufacturerName = String::createStringFromData (buffer, (int) sizeof (buffer)).trim(); + } + +@@ -1186,7 +1184,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (vstEffect != nullptr) + { +- vstEffect->resvd2 = (pointer_sized_int) (pointer_sized_int) this; ++ vstEffect->hostSpace2 = (pointer_sized_int) (pointer_sized_int) this; + initialise (initialSampleRate, initialBlockSize); + return true; + } +@@ -1212,25 +1210,25 @@ struct VSTPluginInstance : public AudioPluginInstance, + + setRateAndBufferSizeDetails (initialSampleRate, initialBlockSize); + +- dispatch (Vst2::effIdentify, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeIdentify, 0, 0, nullptr, 0); + + if (getSampleRate() > 0) +- dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) getSampleRate()); ++ dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) getSampleRate()); + + if (getBlockSize() > 0) +- dispatch (Vst2::effSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0); + +- dispatch (Vst2::effOpen, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0); + + setRateAndBufferSizeDetails (getSampleRate(), getBlockSize()); + + if (getNumPrograms() > 1) + setCurrentProgram (0); + else +- dispatch (Vst2::effSetProgram, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, 0, nullptr, 0); + +- for (int i = vstEffect->numInputs; --i >= 0;) dispatch (Vst2::effConnectInput, i, 1, nullptr, 0); +- for (int i = vstEffect->numOutputs; --i >= 0;) dispatch (Vst2::effConnectOutput, i, 1, nullptr, 0); ++ for (int i = vstEffect->numInputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectInput, i, 1, nullptr, 0); ++ for (int i = vstEffect->numOutputChannels; --i >= 0;) dispatch (Vst2::plugInOpcodeConnectOutput, i, 1, nullptr, 0); + + if (getVstCategory() != Vst2::kPlugCategShell) // (workaround for Waves 5 plugins which crash during this call) + updateStoredProgramNames(); +@@ -1241,7 +1239,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + usesCocoaNSView = ((unsigned int) pluginCanDo ("hasCockosViewAsConfig") & 0xffff0000ul) == 0xbeef0000ul; + #endif + +- setLatencySamples (vstEffect->initialDelay); ++ setLatencySamples (vstEffect->latency); + } + + void* getPlatformSpecificData() override { return vstEffect; } +@@ -1252,7 +1250,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + char buffer[512] = { 0 }; + +- if (dispatch (Vst2::effGetProductString, 0, 0, buffer, 0) != 0) ++ if (dispatch (Vst2::plugInOpcodeGetManufacturerProductName, 0, 0, buffer, 0) != 0) + { + String productName = String::createStringFromData (buffer, (int) sizeof (buffer)); + +@@ -1266,7 +1264,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + int getUID() const + { +- int uid = vstEffect != nullptr ? vstEffect->uniqueID : 0; ++ int uid = vstEffect != nullptr ? vstEffect->plugInIdentifier : 0; + + if (uid == 0) + uid = vstModule->file.hashCode(); +@@ -1279,10 +1277,10 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (vstEffect == nullptr) + return 0.0; + +- if ((vstEffect->flags & Vst2::effFlagsNoSoundInStop) != 0) ++ if ((vstEffect->flags & 512) != 0) + return 0.0; + +- auto tailSize = dispatch (Vst2::effGetTailSize, 0, 0, nullptr, 0); ++ auto tailSize = dispatch (Vst2::plugInOpcodeGetTailSize, 0, 0, nullptr, 0); + auto sampleRate = getSampleRate(); + + // remain backward compatible with old JUCE plug-ins: anything larger +@@ -1302,11 +1300,11 @@ struct VSTPluginInstance : public AudioPluginInstance, + bool producesMidi() const override { return pluginCanDo ("sendVstMidiEvent") > 0; } + bool supportsMPE() const override { return pluginCanDo ("MPE") > 0; } + +- Vst2::VstPlugCategory getVstCategory() const noexcept { return (Vst2::VstPlugCategory) dispatch (Vst2::effGetPlugCategory, 0, 0, nullptr, 0); } ++ Vst2::VstPlugInCategory getVstCategory() const noexcept { return (Vst2::VstPlugInCategory) dispatch (Vst2::plugInOpcodeGetPlugInCategory, 0, 0, nullptr, 0); } + +- bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsIsSynth) != 0); } ++ bool isSynthPlugin() const { return (vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagIsSynth) != 0); } + +- int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::effCanDo, 0, 0, (void*) text, 0); } ++ int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::plugInOpcodeCanPlugInDo, 0, 0, (void*) text, 0); } + + //============================================================================== + void prepareToPlay (double rate, int samplesPerBlockExpected) override +@@ -1321,17 +1319,17 @@ struct VSTPluginInstance : public AudioPluginInstance, + SpeakerMappings::VstSpeakerConfigurationHolder inArr (getChannelLayoutOfBus (true, 0)); + SpeakerMappings::VstSpeakerConfigurationHolder outArr (getChannelLayoutOfBus (false, 0)); + +- dispatch (Vst2::effSetSpeakerArrangement, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f); ++ dispatch (Vst2::plugInOpcodeSetSpeakerConfiguration, 0, (pointer_sized_int) &inArr.get(), (void*) &outArr.get(), 0.0f); + } + +- vstHostTime.tempo = 120.0; +- vstHostTime.timeSigNumerator = 4; +- vstHostTime.timeSigDenominator = 4; ++ vstHostTime.tempoBPM = 120.0; ++ vstHostTime.timeSignatureNumerator = 4; ++ vstHostTime.timeSignatureDenominator = 4; + vstHostTime.sampleRate = rate; +- vstHostTime.samplePos = 0; +- vstHostTime.flags = Vst2::kVstNanosValid +- | Vst2::kVstAutomationWriting +- | Vst2::kVstAutomationReading; ++ vstHostTime.samplePosition = 0; ++ vstHostTime.flags = Vst2::vstTimingInfoFlagNanosecondsValid ++ | Vst2::vstTimingInfoFlagAutomationWriteModeActive ++ | Vst2::vstTimingInfoFlagAutomationReadModeActive; + + initialise (rate, samplesPerBlockExpected); + +@@ -1346,18 +1344,18 @@ struct VSTPluginInstance : public AudioPluginInstance, + + incomingMidi.clear(); + +- dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) rate); +- dispatch (Vst2::effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetSampleRate, 0, 0, nullptr, (float) rate); ++ dispatch (Vst2::plugInOpcodeSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0); + + if (supportsDoublePrecisionProcessing()) + { +- int32 vstPrecision = isUsingDoublePrecision() ? Vst2::kVstProcessPrecision64 +- : Vst2::kVstProcessPrecision32; ++ int32 vstPrecision = isUsingDoublePrecision() ? Vst2::vstProcessingSampleTypeDouble ++ : Vst2::vstProcessingSampleTypeFloat; + +- dispatch (Vst2::effSetProcessPrecision, 0, (pointer_sized_int) vstPrecision, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetSampleFloatType, 0, (pointer_sized_int) vstPrecision, nullptr, 0); + } + +- auto maxChannels = jmax (1, jmax (vstEffect->numInputs, vstEffect->numOutputs)); ++ auto maxChannels = jmax (1, jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels)); + + tmpBufferFloat .setSize (maxChannels, samplesPerBlockExpected); + tmpBufferDouble.setSize (maxChannels, samplesPerBlockExpected); +@@ -1365,7 +1363,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + channelBufferFloat .calloc (static_cast (maxChannels)); + channelBufferDouble.calloc (static_cast (maxChannels)); + +- outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputs), samplesPerBlockExpected); ++ outOfPlaceBuffer.setSize (jmax (1, vstEffect->numOutputChannels), samplesPerBlockExpected); + + if (! isPowerOn) + setPower (true); +@@ -1381,9 +1379,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + } + } + +- dispatch (Vst2::effStartProcess, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeStartProcess, 0, 0, nullptr, 0); + +- setLatencySamples (vstEffect->initialDelay); ++ setLatencySamples (vstEffect->latency); + } + } + +@@ -1391,7 +1389,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (initialised) + { +- dispatch (Vst2::effStopProcess, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeStopProcess, 0, 0, nullptr, 0); + setPower (false); + } + +@@ -1444,8 +1442,8 @@ struct VSTPluginInstance : public AudioPluginInstance, + //============================================================================== + bool supportsDoublePrecisionProcessing() const override + { +- return ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0 +- && (vstEffect->flags & Vst2::effFlagsCanDoubleReplacing) != 0); ++ return ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0 ++ && (vstEffect->flags & Vst2::vstEffectFlagInplaceDoubleAudio) != 0); + } + + AudioProcessorParameter* getBypassParameter() const override { return vstSupportsBypass ? bypassParam.get() : nullptr; } +@@ -1463,15 +1461,15 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (numInputBuses > 1 || numOutputBuses > 1) + return (layouts == getBusesLayout()); + +- return (layouts.getNumChannels (true, 0) <= vstEffect->numInputs +- && layouts.getNumChannels (false, 0) <= vstEffect->numOutputs); ++ return (layouts.getNumChannels (true, 0) <= vstEffect->numInputChannels ++ && layouts.getNumChannels (false, 0) <= vstEffect->numOutputChannels); + } + + //============================================================================== + #if JUCE_IOS || JUCE_ANDROID + bool hasEditor() const override { return false; } + #else +- bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsHasEditor) != 0; } ++ bool hasEditor() const override { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagHasEditor) != 0; } + #endif + + AudioProcessorEditor* createEditor() override; +@@ -1481,9 +1479,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (isValidChannel (index, true)) + { +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0) +- return String (pinProps.label, sizeof (pinProps.label)); ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return String (pinProps.text, sizeof (pinProps.text)); + } + + return {}; +@@ -1494,9 +1492,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (! isValidChannel (index, true)) + return false; + +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetInputProperties, index, 0, &pinProps, 0.0f) != 0) +- return (pinProps.flags & Vst2::kVstPinIsStereo) != 0; ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetInputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0; + + return true; + } +@@ -1505,9 +1503,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (isValidChannel (index, false)) + { +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0) +- return String (pinProps.label, sizeof (pinProps.label)); ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return String (pinProps.text, sizeof (pinProps.text)); + } + + return {}; +@@ -1518,9 +1516,9 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (! isValidChannel (index, false)) + return false; + +- Vst2::VstPinProperties pinProps; +- if (dispatch (Vst2::effGetOutputProperties, index, 0, &pinProps, 0.0f) != 0) +- return (pinProps.flags & Vst2::kVstPinIsStereo) != 0; ++ Vst2::VstPinInfo pinProps; ++ if (dispatch (Vst2::plugInOpcodeGetOutputPinProperties, index, 0, &pinProps, 0.0f) != 0) ++ return (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0; + + return true; + } +@@ -1535,12 +1533,12 @@ struct VSTPluginInstance : public AudioPluginInstance, + int getNumPrograms() override { return vstEffect != nullptr ? jmax (0, vstEffect->numPrograms) : 0; } + + // NB: some plugs return negative numbers from this function. +- int getCurrentProgram() override { return (int) dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); } ++ int getCurrentProgram() override { return (int) dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, 0, 0); } + + void setCurrentProgram (int newIndex) override + { + if (getNumPrograms() > 0 && newIndex != getCurrentProgram()) +- dispatch (Vst2::effSetProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), nullptr, 0); ++ dispatch (Vst2::plugInOpcodeSetCurrentProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), 0, 0); + } + + const String getProgramName (int index) override +@@ -1554,7 +1552,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + char nm[264] = { 0 }; + +- if (dispatch (Vst2::effGetProgramNameIndexed, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0) ++ if (dispatch (Vst2::plugInOpcodeGetProgramName, jlimit (0, getNumPrograms(), index), -1, nm, 0) != 0) + return String::fromUTF8 (nm).trim(); + } + } +@@ -1567,7 +1565,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + if (index >= 0 && index == getCurrentProgram()) + { + if (getNumPrograms() > 0 && newName != getCurrentProgramName()) +- dispatch (Vst2::effSetProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f); ++ dispatch (Vst2::plugInOpcodeSetCurrentProgramName, 0, 0, (void*) newName.substring (0, 24).toRawUTF8(), 0.0f); + } + else + { +@@ -1585,7 +1583,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + //============================================================================== + void timerCallback() override + { +- if (dispatch (Vst2::effIdle, 0, 0, nullptr, 0) == 0) ++ if (dispatch (Vst2::plugInOpcodeIdle, 0, 0, nullptr, 0) == 0) + stopTimer(); + } + +@@ -1599,7 +1597,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + switch (opcode) + { +- case Vst2::audioMasterAutomate: ++ case Vst2::hostOpcodeParameterChanged: + if (auto* param = getParameters()[index]) + param->sendValueChangedMessageToListeners (opt); + else +@@ -1607,23 +1605,23 @@ struct VSTPluginInstance : public AudioPluginInstance, + + break; + +- case Vst2::audioMasterProcessEvents: handleMidiFromPlugin ((const Vst2::VstEvents*) ptr); break; +- case Vst2::audioMasterGetTime: return getVSTTime(); +- case Vst2::audioMasterIdle: handleIdle(); break; +- case Vst2::audioMasterSizeWindow: setWindowSize (index, (int) value); return 1; +- case Vst2::audioMasterUpdateDisplay: triggerAsyncUpdate(); break; +- case Vst2::audioMasterIOChanged: setLatencySamples (vstEffect->initialDelay); break; +- case Vst2::audioMasterNeedIdle: startTimer (50); break; ++ case Vst2::hostOpcodePreAudioProcessingEvents: handleMidiFromPlugin ((const Vst2::VstEventBlock*) ptr); break; ++ case Vst2::hostOpcodeGetTimingInfo: return getVSTTime(); ++ case Vst2::hostOpcodeIdle: handleIdle(); break; ++ case Vst2::hostOpcodeWindowSize: setWindowSize (index, (int) value); return 1; ++ case Vst2::hostOpcodeUpdateView: triggerAsyncUpdate(); break; ++ case Vst2::hostOpcodeIOModified: setLatencySamples (vstEffect->latency); break; ++ case Vst2::hostOpcodeNeedsIdle: startTimer (50); break; + +- case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue); +- case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue); +- case Vst2::audioMasterWantMidi: wantsMidiMessages = true; break; +- case Vst2::audioMasterGetDirectory: return getVstDirectory(); ++ case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) (getSampleRate() > 0 ? getSampleRate() : defaultVSTSampleRateValue); ++ case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) (getBlockSize() > 0 ? getBlockSize() : defaultVSTBlockSizeValue); ++ case Vst2::hostOpcodePlugInWantsMidi: wantsMidiMessages = true; break; ++ case Vst2::hostOpcodeGetDirectory: return getVstDirectory(); + +- case Vst2::audioMasterTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0); +- case Vst2::audioMasterGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0); ++ case Vst2::hostOpcodeTempoAt: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getTempoAt ((int64) value) : 0); ++ case Vst2::hostOpcodeGetAutomationState: return (pointer_sized_int) (extraFunctions != nullptr ? extraFunctions->getAutomationState() : 0); + +- case Vst2::audioMasterBeginEdit: ++ case Vst2::hostOpcodeParameterChangeGestureBegin: + if (auto* param = getParameters()[index]) + param->beginChangeGesture(); + else +@@ -1631,7 +1629,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + + break; + +- case Vst2::audioMasterEndEdit: ++ case Vst2::hostOpcodeParameterChangeGestureEnd: + if (auto* param = getParameters()[index]) + param->endChangeGesture(); + else +@@ -1639,28 +1637,28 @@ struct VSTPluginInstance : public AudioPluginInstance, + + break; + +- case Vst2::audioMasterPinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true) +- case Vst2::audioMasterGetCurrentProcessLevel: return isNonRealtime() ? 4 : 0; ++ case Vst2::hostOpcodePinConnected: return isValidChannel (index, value == 0) ? 0 : 1; // (yes, 0 = true) ++ case Vst2::hostOpcodeGetCurrentAudioProcessingLevel: return isNonRealtime() ? 4 : 0; + + // none of these are handled (yet)... +- case Vst2::audioMasterSetTime: +- case Vst2::audioMasterGetParameterQuantization: +- case Vst2::audioMasterGetInputLatency: +- case Vst2::audioMasterGetOutputLatency: +- case Vst2::audioMasterGetPreviousPlug: +- case Vst2::audioMasterGetNextPlug: +- case Vst2::audioMasterWillReplaceOrAccumulate: +- case Vst2::audioMasterOfflineStart: +- case Vst2::audioMasterOfflineRead: +- case Vst2::audioMasterOfflineWrite: +- case Vst2::audioMasterOfflineGetCurrentPass: +- case Vst2::audioMasterOfflineGetCurrentMetaPass: +- case Vst2::audioMasterGetOutputSpeakerArrangement: +- case Vst2::audioMasterVendorSpecific: +- case Vst2::audioMasterSetIcon: +- case Vst2::audioMasterGetLanguage: +- case Vst2::audioMasterOpenWindow: +- case Vst2::audioMasterCloseWindow: ++ case Vst2::hostOpcodeSetTime: ++ case Vst2::hostOpcodeGetParameterInterval: ++ case Vst2::hostOpcodeGetInputLatency: ++ case Vst2::hostOpcodeGetOutputLatency: ++ case Vst2::hostOpcodeGetPreviousPlugIn: ++ case Vst2::hostOpcodeGetNextPlugIn: ++ case Vst2::hostOpcodeWillReplace: ++ case Vst2::hostOpcodeOfflineStart: ++ case Vst2::hostOpcodeOfflineReadSource: ++ case Vst2::hostOpcodeOfflineWrite: ++ case Vst2::hostOpcodeOfflineGetCurrentPass: ++ case Vst2::hostOpcodeOfflineGetCurrentMetaPass: ++ case Vst2::hostOpcodeGetOutputSpeakerConfiguration: ++ case Vst2::hostOpcodeManufacturerSpecific: ++ case Vst2::hostOpcodeSetIcon: ++ case Vst2::hostOpcodeGetLanguage: ++ case Vst2::hostOpcodeOpenEditorWindow: ++ case Vst2::hostOpcodeCloseEditorWindow: + break; + + default: +@@ -1675,19 +1673,19 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + switch (opcode) + { +- case Vst2::audioMasterCanDo: return handleCanDo ((const char*) ptr); +- case Vst2::audioMasterVersion: return 2400; +- case Vst2::audioMasterCurrentId: return shellUIDToCreate; +- case Vst2::audioMasterGetNumAutomatableParameters: return 0; +- case Vst2::audioMasterGetAutomationState: return 1; +- case Vst2::audioMasterGetVendorVersion: return 0x0101; ++ case Vst2::hostOpcodeCanHostDo: return handleCanDo ((const char*) ptr); ++ case Vst2::hostOpcodeVstVersion: return 2400; ++ case Vst2::hostOpcodeCurrentId: return shellUIDToCreate; ++ case Vst2::hostOpcodeGetNumberOfAutomatableParameters: return 0; ++ case Vst2::hostOpcodeGetAutomationState: return 1; ++ case Vst2::hostOpcodeGetManufacturerVersion: return 0x0101; + +- case Vst2::audioMasterGetVendorString: +- case Vst2::audioMasterGetProductString: return getHostName ((char*) ptr); ++ case Vst2::hostOpcodeGetManufacturerName: ++ case Vst2::hostOpcodeGetProductName: return getHostName ((char*) ptr); + +- case Vst2::audioMasterGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue; +- case Vst2::audioMasterGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue; +- case Vst2::audioMasterSetOutputSampleRate: return 0; ++ case Vst2::hostOpcodeGetSampleRate: return (pointer_sized_int) defaultVSTSampleRateValue; ++ case Vst2::hostOpcodeGetBlockSize: return (pointer_sized_int) defaultVSTBlockSizeValue; ++ case Vst2::hostOpcodeSetOutputSampleRate: return 0; + + default: + DBG ("*** Unhandled VST Callback: " + String ((int) opcode)); +@@ -1716,7 +1714,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + UseResFile (vstModule->resFileId); + #endif + +- result = vstEffect->dispatcher (vstEffect, opcode, index, value, ptr, opt); ++ result = vstEffect->dispatchFunction (vstEffect, opcode, index, value, ptr, opt); + + #if JUCE_MAC + auto newResFile = CurResFile(); +@@ -1922,14 +1920,14 @@ struct VSTPluginInstance : public AudioPluginInstance, + return true; + } + +- bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::effFlagsProgramChunks) != 0; } ++ bool usesChunks() const noexcept { return vstEffect != nullptr && (vstEffect->flags & Vst2::vstEffectFlagDataInChunks) != 0; } + + bool getChunkData (MemoryBlock& mb, bool isPreset, int maxSizeMB) const + { + if (usesChunks()) + { + void* data = nullptr; +- auto bytes = (size_t) dispatch (Vst2::effGetChunk, isPreset ? 1 : 0, 0, &data, 0.0f); ++ auto bytes = (size_t) dispatch (Vst2::plugInOpcodeGetData, isPreset ? 1 : 0, 0, &data, 0.0f); + + if (data != nullptr && bytes <= (size_t) maxSizeMB * 1024 * 1024) + { +@@ -1947,7 +1945,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + { + if (size > 0 && usesChunks()) + { +- dispatch (Vst2::effSetChunk, isPreset ? 1 : 0, size, (void*) data, 0.0f); ++ dispatch (Vst2::plugInOpcodeSetData, isPreset ? 1 : 0, size, (void*) data, 0.0f); + + if (! isPreset) + updateStoredProgramNames(); +@@ -1958,7 +1956,7 @@ struct VSTPluginInstance : public AudioPluginInstance, + return false; + } + +- Vst2::AEffect* vstEffect; ++ Vst2::VstEffectInterface* vstEffect; + ModuleHandle::Ptr vstModule; + + std::unique_ptr extraFunctions; +@@ -1981,7 +1979,7 @@ private: + currentValue = (newValue != 0.0f); + + if (parent.vstSupportsBypass) +- parent.dispatch (Vst2::effSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f); ++ parent.dispatch (Vst2::plugInOpcodeSetBypass, 0, currentValue ? 1 : 0, nullptr, 0.0f); + } + + float getValueForText (const String& text) const override +@@ -2028,7 +2026,7 @@ private: + CriticalSection midiInLock; + MidiBuffer incomingMidi; + VSTMidiEventList midiEventsToSend; +- Vst2::VstTimeInfo vstHostTime; ++ Vst2::VstTimingInformation vstHostTime; + + AudioBuffer tmpBufferFloat; + HeapBlock channelBufferFloat; +@@ -2065,7 +2063,7 @@ private: + if (auto* app = JUCEApplicationBase::getInstance()) + hostName = app->getApplicationName(); + +- hostName.copyToUTF8 (name, (size_t) jmin (Vst2::kVstMaxVendorStrLen, Vst2::kVstMaxProductStrLen) - 1); ++ hostName.copyToUTF8 (name, (size_t) jmin (Vst2::vstMaxManufacturerStringLength, Vst2::vstMaxPlugInNameStringLength) - 1); + return 1; + } + +@@ -2086,7 +2084,7 @@ private: + + #if JUCE_MAC + if (getActiveEditor() != nullptr) +- dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0); + #endif + + Timer::callPendingTimersSynchronously(); +@@ -2121,9 +2119,9 @@ private: + } + + //============================================================================== +- static Vst2::AEffect* constructEffect (const ModuleHandle::Ptr& module) ++ static Vst2::VstEffectInterface* constructEffect (const ModuleHandle::Ptr& module) + { +- Vst2::AEffect* effect = nullptr; ++ Vst2::VstEffectInterface* effect = nullptr; + try + { + const IdleCallRecursionPreventer icrp; +@@ -2140,10 +2138,10 @@ private: + JUCE_VST_WRAPPER_INVOKE_MAIN + } + +- if (effect != nullptr && effect->magic == 0x56737450 /* 'VstP' */) ++ if (effect != nullptr && effect->interfaceIdentifier == Vst2::juceVstInterfaceIdentifier) + { +- jassert (effect->resvd2 == 0); +- jassert (effect->object != nullptr); ++ jassert (effect->hostSpace2 == 0); ++ jassert (effect->effectPointer != 0); + + _fpreset(); // some dodgy plugs mess around with this + } +@@ -2158,11 +2156,11 @@ private: + return effect; + } + +- static BusesProperties queryBusIO (Vst2::AEffect* effect) ++ static BusesProperties queryBusIO (Vst2::VstEffectInterface* effect) + { + BusesProperties returnValue; + +- if (effect->numInputs == 0 && effect->numOutputs == 0) ++ if (effect->numInputChannels == 0 && effect->numOutputChannels == 0) + return returnValue; + + // Workaround for old broken JUCE plug-ins which would return an invalid +@@ -2173,14 +2171,14 @@ private: + // plug-in is reporting. + if (! pluginHasDefaultChannelLayouts (effect)) + { +- SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputs)); +- SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputs)); ++ SpeakerMappings::VstSpeakerConfigurationHolder canonicalIn (AudioChannelSet::canonicalChannelSet (effect->numInputChannels)); ++ SpeakerMappings::VstSpeakerConfigurationHolder canonicalOut (AudioChannelSet::canonicalChannelSet (effect->numOutputChannels)); + +- effect->dispatcher (effect, Vst2::effSetSpeakerArrangement, 0, ++ effect->dispatchFunction (effect, Vst2::plugInOpcodeSetSpeakerConfiguration, 0, + (pointer_sized_int) &canonicalIn.get(), (void*) &canonicalOut.get(), 0.0f); + } + +- HeapBlock inArrBlock (1, true), outArrBlock (1, true); ++ HeapBlock inArrBlock (1, true), outArrBlock (1, true); + + auto* inArr = inArrBlock.get(); + auto* outArr = outArrBlock.get(); +@@ -2191,35 +2189,35 @@ private: + for (int dir = 0; dir < 2; ++dir) + { + const bool isInput = (dir == 0); +- const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties); +- const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs); +- const Vst2::VstSpeakerArrangement* arr = (isInput ? inArr : outArr); ++ const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties); ++ const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels); ++ const Vst2::VstSpeakerConfiguration* arr = (isInput ? inArr : outArr); + bool busAdded = false; + +- Vst2::VstPinProperties pinProps; ++ Vst2::VstPinInfo pinProps; + AudioChannelSet layout; + + for (int ch = 0; ch < maxChannels; ch += layout.size()) + { +- if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) ++ if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) + break; + +- if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0) ++ if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0) + { +- layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.arrangementType, 0); ++ layout = SpeakerMappings::vstArrangementTypeToChannelSet (pinProps.configurationType, 0); + + if (layout.isDisabled()) + break; + } + else if (arr == nullptr) + { +- layout = ((pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono()); ++ layout = ((pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? AudioChannelSet::stereo() : AudioChannelSet::mono()); + } + else + break; + + busAdded = true; +- returnValue.addBus (isInput, pinProps.label, layout, true); ++ returnValue.addBus (isInput, pinProps.text, layout, true); + } + + // no buses? +@@ -2227,8 +2225,8 @@ private: + { + String busName = (isInput ? "Input" : "Output"); + +- if (effect->dispatcher (effect, opcode, 0, 0, &pinProps, 0.0f) != 0) +- busName = pinProps.label; ++ if (effect->dispatchFunction (effect, opcode, 0, 0, &pinProps, 0.0f) != 0) ++ busName = pinProps.text; + + if (arr != nullptr) + layout = SpeakerMappings::vstArrangementTypeToChannelSet (*arr); +@@ -2242,9 +2240,9 @@ private: + return returnValue; + } + +- static bool pluginHasDefaultChannelLayouts (Vst2::AEffect* effect) ++ static bool pluginHasDefaultChannelLayouts (Vst2::VstEffectInterface* effect) + { +- HeapBlock inArrBlock (1, true), outArrBlock (1, true); ++ HeapBlock inArrBlock (1, true), outArrBlock (1, true); + + auto* inArr = inArrBlock.get(); + auto* outArr = outArrBlock.get(); +@@ -2255,40 +2253,40 @@ private: + for (int dir = 0; dir < 2; ++dir) + { + const bool isInput = (dir == 0); +- const int opcode = (isInput ? Vst2::effGetInputProperties : Vst2::effGetOutputProperties); +- const int maxChannels = (isInput ? effect->numInputs : effect->numOutputs); ++ const int opcode = (isInput ? Vst2::plugInOpcodeGetInputPinProperties : Vst2::plugInOpcodeGetOutputPinProperties); ++ const int maxChannels = (isInput ? effect->numInputChannels : effect->numOutputChannels); + + int channels = 1; + + for (int ch = 0; ch < maxChannels; ch += channels) + { +- Vst2::VstPinProperties pinProps; ++ Vst2::VstPinInfo pinProps; + +- if (effect->dispatcher (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) ++ if (effect->dispatchFunction (effect, opcode, ch, 0, &pinProps, 0.0f) == 0) + return false; + +- if ((pinProps.flags & Vst2::kVstPinUseSpeaker) != 0) ++ if ((pinProps.flags & Vst2::vstPinInfoFlagValid) != 0) + return true; + +- channels = (pinProps.flags & Vst2::kVstPinIsStereo) != 0 ? 2 : 1; ++ channels = (pinProps.flags & Vst2::vstPinInfoFlagIsStereo) != 0 ? 2 : 1; + } + } + + return false; + } + +- static bool getSpeakerArrangementWrapper (Vst2::AEffect* effect, +- Vst2::VstSpeakerArrangement* inArr, +- Vst2::VstSpeakerArrangement* outArr) ++ static bool getSpeakerArrangementWrapper (Vst2::VstEffectInterface* effect, ++ Vst2::VstSpeakerConfiguration* inArr, ++ Vst2::VstSpeakerConfiguration* outArr) + { + // Workaround: unfortunately old JUCE VST-2 plug-ins had a bug and would crash if + // you try to get the speaker arrangement when there are no input channels present. + // Hopefully, one day (when there are no more old JUCE plug-ins around), we can + // comment out the next two lines. +- if (effect->numInputs == 0) ++ if (effect->numInputChannels == 0) + return false; + +- return (effect->dispatcher (effect, Vst2::effGetSpeakerArrangement, 0, ++ return (effect->dispatchFunction (effect, Vst2::plugInOpcodeGetSpeakerArrangement, 0, + reinterpret_cast (&inArr), &outArr, 0.0f) != 0); + } + +@@ -2322,57 +2320,57 @@ private: + if (currentPlayHead->getCurrentPosition (position)) + { + +- vstHostTime.samplePos = (double) position.timeInSamples; +- vstHostTime.tempo = position.bpm; +- vstHostTime.timeSigNumerator = position.timeSigNumerator; +- vstHostTime.timeSigDenominator = position.timeSigDenominator; +- vstHostTime.ppqPos = position.ppqPosition; +- vstHostTime.barStartPos = position.ppqPositionOfLastBarStart; +- vstHostTime.flags |= Vst2::kVstTempoValid +- | Vst2::kVstTimeSigValid +- | Vst2::kVstPpqPosValid +- | Vst2::kVstBarsValid; ++ vstHostTime.samplePosition = (double) position.timeInSamples; ++ vstHostTime.tempoBPM = position.bpm; ++ vstHostTime.timeSignatureNumerator = position.timeSigNumerator; ++ vstHostTime.timeSignatureDenominator = position.timeSigDenominator; ++ vstHostTime.musicalPosition = position.ppqPosition; ++ vstHostTime.lastBarPosition = position.ppqPositionOfLastBarStart; ++ vstHostTime.flags |= Vst2::vstTimingInfoFlagTempoValid ++ | Vst2::vstTimingInfoFlagTimeSignatureValid ++ | Vst2::vstTimingInfoFlagMusicalPositionValid ++ | Vst2::vstTimingInfoFlagLastBarPositionValid; + + int32 newTransportFlags = 0; +- if (position.isPlaying) newTransportFlags |= Vst2::kVstTransportPlaying; +- if (position.isRecording) newTransportFlags |= Vst2::kVstTransportRecording; ++ if (position.isPlaying) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyPlaying; ++ if (position.isRecording) newTransportFlags |= Vst2::vstTimingInfoFlagCurrentlyRecording; + +- if (newTransportFlags != (vstHostTime.flags & (Vst2::kVstTransportPlaying +- | Vst2::kVstTransportRecording))) +- vstHostTime.flags = (vstHostTime.flags & ~(Vst2::kVstTransportPlaying | Vst2::kVstTransportRecording)) | newTransportFlags | Vst2::kVstTransportChanged; ++ if (newTransportFlags != (vstHostTime.flags & (Vst2::vstTimingInfoFlagCurrentlyPlaying ++ | Vst2::vstTimingInfoFlagCurrentlyRecording))) ++ vstHostTime.flags = (vstHostTime.flags & ~(Vst2::vstTimingInfoFlagCurrentlyPlaying | Vst2::vstTimingInfoFlagCurrentlyRecording)) | newTransportFlags | Vst2::vstTimingInfoFlagTransportChanged; + else +- vstHostTime.flags &= ~Vst2::kVstTransportChanged; ++ vstHostTime.flags &= ~Vst2::vstTimingInfoFlagTransportChanged; + + switch (position.frameRate) + { +- case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::kVstSmpte24fps, 24.0, position.timeInSeconds); break; +- case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::kVstSmpte25fps, 25.0, position.timeInSeconds); break; +- case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::kVstSmpte30fps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::kVstSmpte60fps, 60.0, position.timeInSeconds); break; +- +- case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::kVstSmpte239fps, 24.0, position.timeInSeconds); break; +- case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997fps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte2997dfps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte30dfps, 30.0, position.timeInSeconds); break; +- case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::kVstSmpte599fps, 60.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps24: setHostTimeFrameRate (Vst2::vstSmpteRateFps24, 24.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps25: setHostTimeFrameRate (Vst2::vstSmpteRateFps25, 25.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps30: setHostTimeFrameRate (Vst2::vstSmpteRateFps30, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps60: setHostTimeFrameRate (Vst2::vstSmpteRateFps60, 60.0, position.timeInSeconds); break; ++ ++ case AudioPlayHead::fps23976: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps239, 24.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps2997: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps2997drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps2997drop, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps30drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps30drop, 30.0, position.timeInSeconds); break; ++ case AudioPlayHead::fps60drop: setHostTimeFrameRateDrop (Vst2::vstSmpteRateFps599, 60.0, position.timeInSeconds); break; + case AudioPlayHead::fpsUnknown: + default: break; + } + + if (position.isLooping) + { +- vstHostTime.cycleStartPos = position.ppqLoopStart; +- vstHostTime.cycleEndPos = position.ppqLoopEnd; +- vstHostTime.flags |= (Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive); ++ vstHostTime.loopStartPosition = position.ppqLoopStart; ++ vstHostTime.loopEndPosition = position.ppqLoopEnd; ++ vstHostTime.flags |= (Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive); + } + else + { +- vstHostTime.flags &= ~(Vst2::kVstCyclePosValid | Vst2::kVstTransportCycleActive); ++ vstHostTime.flags &= ~(Vst2::vstTimingInfoFlagLoopPositionValid | Vst2::vstTimingInfoFlagLoopActive); + } + } + } + +- vstHostTime.nanoSeconds = getVSTHostTimeNanoseconds(); ++ vstHostTime.systemTimeNanoseconds = getVSTHostTimeNanoseconds(); + + if (wantsMidiMessages) + { +@@ -2383,13 +2381,13 @@ private: + midiEventsToSend.addEvent (metadata.data, metadata.numBytes, + jlimit (0, numSamples - 1, metadata.samplePosition)); + +- vstEffect->dispatcher (vstEffect, Vst2::effProcessEvents, 0, 0, midiEventsToSend.events, 0); ++ vstEffect->dispatchFunction (vstEffect, Vst2::plugInOpcodePreAudioProcessingEvents, 0, 0, midiEventsToSend.events, 0); + } + + _clearfp(); + + // always ensure that the buffer is at least as large as the maximum number of channels +- auto maxChannels = jmax (vstEffect->numInputs, vstEffect->numOutputs); ++ auto maxChannels = jmax (vstEffect->numInputChannels, vstEffect->numOutputChannels); + auto channels = channelBuffer.get(); + + if (numChannels < maxChannels) +@@ -2428,35 +2426,35 @@ private: + //============================================================================== + inline void invokeProcessFunction (AudioBuffer& buffer, int32 sampleFrames) + { +- if ((vstEffect->flags & Vst2::effFlagsCanReplacing) != 0) ++ if ((vstEffect->flags & Vst2::vstEffectFlagInplaceAudio) != 0) + { +- vstEffect->processReplacing (vstEffect, buffer.getArrayOfWritePointers(), ++ vstEffect->processAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(), + buffer.getArrayOfWritePointers(), sampleFrames); + } + else + { +- outOfPlaceBuffer.setSize (vstEffect->numOutputs, sampleFrames); ++ outOfPlaceBuffer.setSize (vstEffect->numOutputChannels, sampleFrames); + outOfPlaceBuffer.clear(); + +- vstEffect->process (vstEffect, buffer.getArrayOfWritePointers(), +- outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames); ++ vstEffect->processAudioFunction (vstEffect, buffer.getArrayOfWritePointers(), ++ outOfPlaceBuffer.getArrayOfWritePointers(), sampleFrames); + +- for (int i = vstEffect->numOutputs; --i >= 0;) ++ for (int i = vstEffect->numOutputChannels; --i >= 0;) + buffer.copyFrom (i, 0, outOfPlaceBuffer.getReadPointer (i), sampleFrames); + } + } + + inline void invokeProcessFunction (AudioBuffer& buffer, int32 sampleFrames) + { +- vstEffect->processDoubleReplacing (vstEffect, buffer.getArrayOfWritePointers(), ++ vstEffect->processDoubleAudioInplaceFunction (vstEffect, buffer.getArrayOfWritePointers(), + buffer.getArrayOfWritePointers(), sampleFrames); + } + + //============================================================================== + void setHostTimeFrameRate (long frameRateIndex, double frameRate, double currentTime) noexcept + { +- vstHostTime.flags |= Vst2::kVstSmpteValid; +- vstHostTime.smpteFrameRate = (int32) frameRateIndex; ++ vstHostTime.flags |= Vst2::vstTimingInfoFlagSmpteValid; ++ vstHostTime.smpteRate = (int32) frameRateIndex; + vstHostTime.smpteOffset = (int32) (currentTime * 80.0 * frameRate + 0.5); + } + +@@ -2487,7 +2485,7 @@ private: + if (vstEffect == nullptr) + return {}; + +- jassert (index >= 0 && index < vstEffect->numParams); ++ jassert (index >= 0 && index < vstEffect->numParameters); + char nm[256] = { 0 }; + dispatch (opcode, index, 0, nm, 0); + return String::createStringFromData (nm, (int) sizeof (nm)).trim(); +@@ -2501,7 +2499,7 @@ private: + { + { + char nm[256] = { 0 }; +- dispatch (Vst2::effGetProgramName, 0, 0, nm, 0); ++ dispatch (Vst2::plugInOpcodeGetCurrentProgramName, 0, 0, nm, 0); + progName = String::createStringFromData (nm, (int) sizeof (nm)).trim(); + } + +@@ -2545,7 +2543,7 @@ private: + char nm[256] = { 0 }; + + // only do this if the plugin can't use indexed names.. +- if (dispatch (Vst2::effGetProgramNameIndexed, 0, -1, nm, 0) == 0) ++ if (dispatch (Vst2::plugInOpcodeGetProgramName, 0, -1, nm, 0) == 0) + { + auto oldProgram = getCurrentProgram(); + MemoryBlock oldSettings; +@@ -2563,7 +2561,7 @@ private: + } + } + +- void handleMidiFromPlugin (const Vst2::VstEvents* events) ++ void handleMidiFromPlugin (const Vst2::VstEventBlock* events) + { + if (events != nullptr) + { +@@ -2610,11 +2608,11 @@ private: + } + + //============================================================================== +- int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->version : 0; } ++ int getVersionNumber() const noexcept { return vstEffect != nullptr ? vstEffect->plugInVersion : 0; } + + String getVersion() const + { +- auto v = (unsigned int) dispatch (Vst2::effGetVendorVersion, 0, 0, nullptr, 0); ++ auto v = (unsigned int) dispatch (Vst2::plugInOpcodeGetManufacturerVersion, 0, 0, nullptr, 0); + + String s; + +@@ -2682,7 +2680,6 @@ private: + case Vst2::kPlugCategOfflineProcess: return "Offline Process"; + case Vst2::kPlugCategShell: return "Shell"; + case Vst2::kPlugCategUnknown: return "Unknown"; +- case Vst2::kPlugCategMaxCount: + default: break; + } + +@@ -2691,7 +2688,7 @@ private: + + void setPower (const bool on) + { +- dispatch (Vst2::effMainsChanged, 0, on ? 1 : 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeResumeSuspend, 0, on ? 1 : 0, nullptr, 0); + isPowerOn = on; + } + +@@ -2758,11 +2755,11 @@ public: + + activeVSTWindows.add (this); + +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + + if (rect != nullptr) +- setSize (rect->right - rect->left, rect->bottom - rect->top); ++ setSize (rect->rightmost - rect->leftmost, rect->lower - rect->upper); + else + setSize (1, 1); + +@@ -2928,7 +2925,7 @@ public: + nativeScaleFactor = (float) newScaleFactor; + + if (pluginRespondsToDPIChanges) +- dispatch (Vst2::effVendorSpecific, ++ dispatch (Vst2::plugInOpcodeManufacturerSpecific, + JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'), + JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's'), + nullptr, nativeScaleFactor); +@@ -2957,7 +2954,7 @@ public: + if (! reentrantGuard) + { + reentrantGuard = true; +- plugin.dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0); ++ plugin.dispatch (Vst2::plugInOpcodeEditorIdle, 0, 0, nullptr, 0); + reentrantGuard = false; + } + +@@ -2989,7 +2986,7 @@ public: + activeVSTWindows.add (this); + + #if JUCE_MAC +- dispatch (Vst2::effEditTop, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeeffEditorTop, 0, 0, nullptr, 0); + #endif + } + +@@ -3019,24 +3016,24 @@ private: + + isOpen = true; + +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- dispatch (Vst2::effEditOpen, 0, 0, parentWindow, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, parentWindow, 0); + + // do this before and after like in the steinberg example +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code + + // Install keyboard hooks +- pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0); ++ pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0); + + // double-check it's not too tiny + int w = 250, h = 150; + + if (rect != nullptr) + { +- w = rect->right - rect->left; +- h = rect->bottom - rect->top; ++ w = rect->rightmost - rect->leftmost; ++ h = rect->lower - rect->upper; + + if (w == 0 || h == 0) + { +@@ -3067,14 +3064,14 @@ private: + if (auto* peer = getTopLevelComponent()->getPeer()) + setScaleFactorAndDispatchMessage (peer->getPlatformScaleFactor()); + +- Vst2::ERect* rect = nullptr; ++ Vst2::VstEditorBounds* rect = nullptr; + +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); +- dispatch (Vst2::effEditOpen, 0, 0, getWindowHandle(), 0); +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); // do this before and after like in the steinberg example +- dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); ++ dispatch (Vst2::plugInOpcodeOpenEditor, 0, 0, getWindowHandle(), 0); ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); // do this before and after like in the steinberg example ++ dispatch (Vst2::plugInOpcodeGetCurrentProgram, 0, 0, nullptr, 0); // also in steinberg code + +- pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0); ++ pluginWantsKeys = (dispatch (Vst2::plugInOpcodeKeyboardFocusRequired, 0, 0, nullptr, 0) == 0); + + #if JUCE_WINDOWS + originalWndProc = 0; +@@ -3104,8 +3101,8 @@ private: + + if (rect != nullptr) + { +- auto rw = rect->right - rect->left; +- auto rh = rect->bottom - rect->top; ++ auto rw = rect->rightmost - rect->leftmost; ++ auto rh = rect->lower - rect->upper; + + if ((rw > 50 && rh > 50 && rw < 2000 && rh < 2000 && (! isWithin (w, rw, 2) || ! isWithin (h, rh, 2))) + || ((w == 0 && rw > 0) || (h == 0 && rh > 0))) +@@ -3140,8 +3137,8 @@ private: + + if (rect != nullptr) + { +- w = rect->right - rect->left; +- h = rect->bottom - rect->top; ++ w = rect->rightmost - rect->leftmost; ++ h = rect->lower - rect->upper; + + if (w == 0 || h == 0) + { +@@ -3190,7 +3187,7 @@ private: + + JUCE_VST_LOG ("Closing VST UI: " + plugin.getName()); + isOpen = false; +- dispatch (Vst2::effEditClose, 0, 0, nullptr, 0); ++ dispatch (Vst2::plugInOpcodeCloseEditor, 0, 0, nullptr, 0); + stopTimer(); + + #if JUCE_WINDOWS +@@ -3233,11 +3230,11 @@ private: + { + if (! pluginRespondsToDPIChanges) + { +- Vst2::ERect* rect = nullptr; +- dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + +- auto w = roundToInt ((rect->right - rect->left) / nativeScaleFactor); +- auto h = roundToInt ((rect->bottom - rect->top) / nativeScaleFactor); ++ auto w = roundToInt ((rect->rightmost - rect->leftmost) / nativeScaleFactor); ++ auto h = roundToInt ((rect->lower - rect->upper) / nativeScaleFactor); + + if (! isWindowSizeCorrectForPlugin (w, h)) + { +@@ -3323,8 +3320,8 @@ private: + + bool getEmbeddedViewSize (int& w, int& h) override + { +- Vst2::ERect* rect = nullptr; +- owner.dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); ++ Vst2::VstEditorBounds* rect = nullptr; ++ owner.dispatch (Vst2::plugInOpcodeGetEditorBounds, 0, 0, &rect, 0); + w = rect->right - rect->left; + h = rect->bottom - rect->top; + return true; +@@ -3350,7 +3347,7 @@ private: + if (auto* peer = getPeer()) + { + auto pos = peer->globalToLocal (getScreenPosition()); +- Vst2::ERect r; ++ Vst2::VstEditorBounds r; + r.left = (int16) pos.getX(); + r.top = (int16) pos.getY(); + r.right = (int16) (r.left + getWidth()); +@@ -3423,10 +3420,10 @@ AudioProcessorEditor* VSTPluginInstance::createEditor() + + //============================================================================== + // entry point for all callbacks from the plugin +-static pointer_sized_int VSTCALLBACK audioMaster (Vst2::AEffect* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt) ++static pointer_sized_int VSTINTERFACECALL audioMaster (Vst2::VstEffectInterface* effect, int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt) + { + if (effect != nullptr) +- if (auto* instance = (VSTPluginInstance*) (effect->resvd2)) ++ if (auto* instance = (VSTPluginInstance*) (effect->hostSpace2)) + return instance->handleCallback (opcode, index, value, ptr, opt); + + return VSTPluginInstance::handleGeneralCallback (opcode, index, value, ptr, opt); +@@ -3477,7 +3474,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray& result + // Normal plugin... + results.add (new PluginDescription (desc)); + +- instance->dispatch (Vst2::effOpen, 0, 0, nullptr, 0); ++ instance->dispatch (Vst2::plugInOpcodeOpen, 0, 0, nullptr, 0); + } + else + { +@@ -3485,7 +3482,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray& result + for (;;) + { + char shellEffectName [256] = { 0 }; +- auto uid = (int) instance->dispatch (Vst2::effShellGetNextPlugin, 0, 0, shellEffectName, 0); ++ auto uid = (int) instance->dispatch (Vst2::plugInOpcodeNextPlugInUniqueID, 0, 0, shellEffectName, 0); + + if (uid == 0) + break; +@@ -3709,8 +3706,8 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct + + AudioPluginInstance* VSTPluginFormat::getPluginInstanceFromVstEffectInterface (void* aEffect) + { +- if (auto* vstAEffect = reinterpret_cast (aEffect)) +- if (auto* instanceVST = reinterpret_cast (vstAEffect->resvd2)) ++ if (auto* vstAEffect = reinterpret_cast (aEffect)) ++ if (auto* instanceVST = reinterpret_cast (vstAEffect->hostSpace2)) + return dynamic_cast (instanceVST); + + return nullptr; diff --git a/libs/juce-current/patches/vst2-support_pt2.patch b/libs/juce-current/patches/vst2-support_pt2.patch new file mode 100644 index 00000000..81f919f9 --- /dev/null +++ b/libs/juce-current/patches/vst2-support_pt2.patch @@ -0,0 +1,47 @@ +diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +index 159ab0c7c..e3d277de2 100644 +--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +@@ -1058,7 +1058,7 @@ public: + + void paint (Graphics&) override {} + +- void getEditorBounds (Vst2::ERect& bounds) ++ void getEditorBounds (Vst2::VstEditorBounds& bounds) + { + auto b = getSizeToContainChild(); + bounds = convertToHostBounds ({ 0, 0, (int16) b.getHeight(), (int16) b.getWidth() }); +@@ -1199,8 +1199,8 @@ public: + void resizeHostWindow (int newWidth, int newHeight) + { + auto rect = convertToHostBounds ({ 0, 0, (int16) newHeight, (int16) newWidth }); +- newWidth = rect.right - rect.left; +- newHeight = rect.bottom - rect.top; ++ newWidth = rect.rightmost - rect.leftmost; ++ newHeight = rect.lower - rect.upper; + + bool sizeWasSuccessful = false; + +@@ -1329,17 +1329,17 @@ public: + #endif + + //============================================================================== +- static Vst2::ERect convertToHostBounds (const Vst2::ERect& rect) ++ static Vst2::VstEditorBounds convertToHostBounds (const Vst2::VstEditorBounds& rect) + { + auto desktopScale = Desktop::getInstance().getGlobalScaleFactor(); + + if (approximatelyEqual (desktopScale, 1.0f)) + return rect; + +- return { (int16) roundToInt (rect.top * desktopScale), +- (int16) roundToInt (rect.left * desktopScale), +- (int16) roundToInt (rect.bottom * desktopScale), +- (int16) roundToInt (rect.right * desktopScale)}; ++ return { (int16) roundToInt (rect.upper * desktopScale), ++ (int16) roundToInt (rect.leftmost * desktopScale), ++ (int16) roundToInt (rect.lower * desktopScale), ++ (int16) roundToInt (rect.rightmost * desktopScale)}; + } + + //============================================================================== diff --git a/libs/juce-current/patches/vst3-linux-fix-scale-factor.patch b/libs/juce-current/patches/vst3-linux-fix-scale-factor.patch new file mode 100644 index 00000000..bd705854 --- /dev/null +++ b/libs/juce-current/patches/vst3-linux-fix-scale-factor.patch @@ -0,0 +1,53 @@ +diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +index 4a62a262b..e00d02fbe 100644 +--- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +@@ -1177,8 +1177,26 @@ private: + if (size != nullptr && component != nullptr) + { + auto editorBounds = component->getSizeToContainChild(); ++ auto width = editorBounds.getWidth(); ++ auto height = editorBounds.getHeight(); + +- *size = convertToHostBounds ({ 0, 0, editorBounds.getWidth(), editorBounds.getHeight() }); ++ #if JUCE_LINUX ++ if (component != nullptr) ++ { ++ if (auto* peer = component->getPeer()) ++ { ++ auto scale = (float) peer->getPlatformScaleFactor(); ++ ++ if (! approximatelyEqual (scale, 1.0f)) ++ { ++ width *= scale; ++ height *= scale; ++ } ++ } ++ } ++ #endif ++ ++ *size = convertToHostBounds ({ 0, 0, width, height }); + return kResultTrue; + } + +@@ -1464,7 +1482,19 @@ private: + + if (owner.plugFrame != nullptr) + { +- auto newSize = convertToHostBounds ({ 0, 0, b.getWidth(), b.getHeight() }); ++ #if JUCE_LINUX ++ if (auto* peer = getPeer()) ++ { ++ auto scale = (float) peer->getPlatformScaleFactor(); ++ ++ if (! approximatelyEqual (scale, 1.0f)) ++ { ++ w *= scale; ++ h *= scale; ++ } ++ } ++ #endif ++ auto newSize = convertToHostBounds ({ 0, 0, w, h }); + + { + const ScopedValueSetter resizingParentSetter (resizingParent, true); diff --git a/libs/juce-current/patches/vstwrapper-fixes.patch b/libs/juce-current/patches/vstwrapper-fixes.patch new file mode 100644 index 00000000..792acd57 --- /dev/null +++ b/libs/juce-current/patches/vstwrapper-fixes.patch @@ -0,0 +1,34 @@ +diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +index d0c1884db..c87b97d49 100644 +--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp ++++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +@@ -210,9 +210,9 @@ struct SharedMessageThread : public Thread + void run() override + { + initialiseJuce_GUI(); +- initialised = true; + + MessageManager::getInstance()->setCurrentThreadAsMessageThread(); ++ initialised = true; + + while ((! threadShouldExit()) && MessageManager::getInstance()->runDispatchLoopUntil (250)) + {} +@@ -300,9 +300,6 @@ public: + // You must at least have some channels + jassert (processor->isMidiEffect() || (maxNumInChannels > 0 || maxNumOutChannels > 0)); + +- if (processor->isMidiEffect()) +- maxNumInChannels = maxNumOutChannels = 2; +- + #ifdef JucePlugin_PreferredChannelConfigurations + processor->setPlayConfigDetails (maxNumInChannels, maxNumOutChannels, 44100.0, 1024); + #endif +@@ -1827,7 +1824,7 @@ private: + + pointer_sized_int handleGetPlugInName (VstOpCodeArguments args) + { +- String (JucePlugin_Name).copyToUTF8 ((char*) args.ptr, 64 + 1); ++ String (processor->getName()).copyToUTF8 ((char*) args.ptr, 64 + 1); + return 1; + } +