mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
VST2 Client: Fix compilation issue when compiling with JUCE_VST3_CAN_REPLACE_VST2
This commit is contained in:
parent
bc6a7ecdf5
commit
34f7d467c9
2 changed files with 26 additions and 23 deletions
|
|
@ -65,27 +65,6 @@ struct PluginUtilities
|
|||
static PluginHostType hostType;
|
||||
return hostType;
|
||||
}
|
||||
|
||||
#if JucePlugin_Build_VST
|
||||
static bool handleManufacturerSpecificVST2Opcode ([[maybe_unused]] int32 index,
|
||||
[[maybe_unused]] pointer_sized_int value,
|
||||
[[maybe_unused]] void* ptr,
|
||||
float)
|
||||
{
|
||||
#if JUCE_VST3_CAN_REPLACE_VST2
|
||||
if ((index == (int32) ByteOrder::bigEndianInt ("stCA") || index == (int32) ByteOrder::bigEndianInt ("stCa"))
|
||||
&& value == (int32) ByteOrder::bigEndianInt ("FUID") && ptr != nullptr)
|
||||
{
|
||||
const auto uidString = VST3ClientExtensions::convertVST2PluginId (JucePlugin_VSTUniqueID, JucePlugin_Name, VST3ClientExtensions::InterfaceType::component);
|
||||
MemoryBlock uidValue;
|
||||
uidValue.loadFromHexString (uidString);
|
||||
uidValue.copyTo (ptr, 0, uidValue.getSize());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace juce::detail
|
||||
|
|
|
|||
|
|
@ -1798,10 +1798,34 @@ private:
|
|||
return convertHexVersionToDecimal (JucePlugin_VersionCode);
|
||||
}
|
||||
|
||||
static std::optional<pointer_sized_int> handleVST3Compatibility ([[maybe_unused]] VstOpCodeArguments args)
|
||||
{
|
||||
#if ! JUCE_VST3_CAN_REPLACE_VST2
|
||||
return {};
|
||||
#else
|
||||
if (args.index != (int32) ByteOrder::bigEndianInt ("stCA")
|
||||
&& args.index != (int32) ByteOrder::bigEndianInt ("stCa"))
|
||||
return {};
|
||||
|
||||
if (args.value != (int32) ByteOrder::bigEndianInt ("FUID"))
|
||||
return {};
|
||||
|
||||
if (args.ptr == nullptr)
|
||||
return 0;
|
||||
|
||||
const auto uid = VST3ClientExtensions::convertVST2PluginId (JucePlugin_VSTUniqueID, JucePlugin_Name, VST3ClientExtensions::InterfaceType::component);
|
||||
const auto uidString = String ((const char *) uid.data(), uid.size());
|
||||
MemoryBlock uidValue;
|
||||
uidValue.loadFromHexString (uidString);
|
||||
uidValue.copyTo (args.ptr, 0, uidValue.getSize());
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
pointer_sized_int handleManufacturerSpecific (VstOpCodeArguments args)
|
||||
{
|
||||
if (detail::PluginUtilities::handleManufacturerSpecificVST2Opcode (args.index, args.value, args.ptr, args.opt))
|
||||
return 1;
|
||||
if (const auto result = handleVST3Compatibility (args))
|
||||
return *result;
|
||||
|
||||
if (args.index == (int32) ByteOrder::bigEndianInt ("PreS")
|
||||
&& args.value == (int32) ByteOrder::bigEndianInt ("AeCs"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue