Browse Source

VST3 Host: Add cross-platform-compatible VST3 uid hash

v6.1.6
reuk 4 years ago
parent
commit
241bb8d430
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
5 changed files with 24 additions and 4 deletions
  1. +2
    -1
      extras/AudioPluginHost/CMakeLists.txt
  2. +3
    -1
      extras/Build/CMake/JUCEUtils.cmake
  3. +1
    -0
      extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.cpp
  4. +9
    -2
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  5. +9
    -0
      modules/juce_audio_processors/juce_audio_processors.h

+ 2
- 1
extras/AudioPluginHost/CMakeLists.txt View File

@@ -42,14 +42,15 @@ target_compile_definitions(AudioPluginHost PRIVATE
JUCE_ALSA=1
JUCE_DIRECTSOUND=1
JUCE_PLUGINHOST_LADSPA=1
JUCE_PLUGINHOST_VST=0
JUCE_PLUGINHOST_VST3=1
JUCE_PLUGINHOST_VST=0
JUCE_USE_CAMERA=0
JUCE_USE_CDBURNER=0
JUCE_USE_CDREADER=0
JUCE_USE_CURL=0
JUCE_USE_FLAC=0
JUCE_USE_OGGVORBIS=1
JUCE_VST3_HOST_CROSS_PLATFORM_UID=1
JUCE_WASAPI=1
JUCE_WEB_BROWSER=0)



+ 3
- 1
extras/Build/CMake/JUCEUtils.cmake View File

@@ -2257,7 +2257,9 @@ function(juce_add_pip header)

target_compile_definitions(${JUCE_PIP_NAME}
PRIVATE ${pip_moduleflags}
PUBLIC JUCE_VST3_CAN_REPLACE_VST2=0)
PUBLIC
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_VST3_HOST_CROSS_PLATFORM_UID=1)

_juce_get_pip_targets(${JUCE_PIP_NAME} pip_targets)



+ 1
- 0
extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.cpp View File

@@ -63,6 +63,7 @@ static void doBasicProjectSetup (Project& project, const NewProjectTemplates::Pr
project.getMainGroup().addNewSubGroup ("Source", 0);
project.getConfigFlag ("JUCE_STRICT_REFCOUNTEDPOINTER") = true;
project.getConfigFlag ("JUCE_VST3_HOST_CROSS_PLATFORM_UID") = true;
project.getProjectValue (Ids::useAppConfig) = false;
project.getProjectValue (Ids::addUsingNamespaceToJuceHeader) = false;


+ 9
- 2
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -81,10 +81,17 @@ static int warnOnFailureIfImplemented (int result) noexcept
//==============================================================================
static int getHashForTUID (const TUID& tuid) noexcept
{
#if JUCE_VST3_HOST_CROSS_PLATFORM_UID
const FUID fuid { tuid };
const uint32 inputArray[] { fuid.getLong1(), fuid.getLong2(), fuid.getLong3(), fuid.getLong4() };
#else
const auto& inputArray = tuid;
#endif
uint32 value = 0;
for (int i = 0; i < numElementsInArray (tuid); ++i)
value = (value * 31) + (uint32) tuid[i];
for (const auto& item : inputArray)
value = (value * 31) + (uint32) item;
return (int) value;
}


+ 9
- 0
modules/juce_audio_processors/juce_audio_processors.h View File

@@ -102,6 +102,15 @@
#define JUCE_CUSTOM_VST3_SDK 0
#endif
/** Config: JUCE_VST3_HOST_CROSS_PLATFORM_UID
If enabled, ensures that PluginDescription::uid will produce consistent values for VST3 plugins on all platforms.
It is recommended to enable this flag in all new projects.
Projects which predate this flag should leave it disabled, in case they need to interact with uid values which they previously stored.
*/
#ifndef JUCE_VST3_HOST_CROSS_PLATFORM_UID
#define JUCE_VST3_HOST_CROSS_PLATFORM_UID 0
#endif
#if ! (JUCE_PLUGINHOST_AU || JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_VST3 || JUCE_PLUGINHOST_LADSPA)
// #error "You need to set either the JUCE_PLUGINHOST_AU and/or JUCE_PLUGINHOST_VST and/or JUCE_PLUGINHOST_VST3 and/or JUCE_PLUGINHOST_LADSPA flags if you're using this module!"
#endif


Loading…
Cancel
Save