mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-04 03:40:07 +00:00
VST3 Host: Add cross-platform-compatible VST3 uid hash
This commit is contained in:
parent
be0c36001d
commit
241bb8d430
5 changed files with 24 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue