Add support for VST2 effBeginLoad{Bank,Program}

A user reported that REAPER was using these on the REAPER forum, but I
have not been able to reproduce that. And they went MIA after posting
about it. But hopefully this helps.
This commit is contained in:
Robbert van der Helm
2022-06-08 14:27:04 +02:00
parent 65cf9cd782
commit d9de22ddbd
5 changed files with 26 additions and 7 deletions
+1
View File
@@ -504,6 +504,7 @@ Vst2EventResult passthrough_event(AEffect* plugin,
[](VstIOProperties& props) -> void* { return &props; }, [](VstIOProperties& props) -> void* { return &props; },
[](VstMidiKeyName& key_name) -> void* { return &key_name; }, [](VstMidiKeyName& key_name) -> void* { return &key_name; },
[](VstParameterProperties& props) -> void* { return &props; }, [](VstParameterProperties& props) -> void* { return &props; },
[](VstPatchChunkInfo& info) -> void* { return &info; },
[&](const WantsVstRect&) -> void* { return string_buffer.data(); }, [&](const WantsVstRect&) -> void* { return string_buffer.data(); },
[](const WantsVstTimeInfo&) -> void* { return nullptr; }, [](const WantsVstTimeInfo&) -> void* { return nullptr; },
[&](const WantsString&) -> void* { return string_buffer.data(); }}; [&](const WantsString&) -> void* { return string_buffer.data(); }};
+4
View File
@@ -445,6 +445,10 @@ void Vst2Logger::log_event(
[&](const VstParameterProperties&) { [&](const VstParameterProperties&) {
message << "<writable_buffer>"; message << "<writable_buffer>";
}, },
[&](const VstPatchChunkInfo& info) {
message << "<patch_chunk_info for " << info.numElements
<< " banks/programs>";
},
[&](const WantsAEffectUpdate&) { message << "nullptr"; }, [&](const WantsAEffectUpdate&) { message << "nullptr"; },
[&](const WantsAudioShmBufferConfig&) { message << "nullptr"; }, [&](const WantsAudioShmBufferConfig&) { message << "nullptr"; },
[&](const WantsChunkBuffer&) { [&](const WantsChunkBuffer&) {
+10
View File
@@ -444,6 +444,7 @@ struct Vst2Event {
VstIOProperties, VstIOProperties,
VstMidiKeyName, VstMidiKeyName,
VstParameterProperties, VstParameterProperties,
VstPatchChunkInfo,
WantsVstRect, WantsVstRect,
WantsVstTimeInfo, WantsVstTimeInfo,
WantsString>; WantsString>;
@@ -642,6 +643,15 @@ void serialize(S& s, VstParameterProperties& props) {
s.container1b(props.future); s.container1b(props.future);
} }
template <typename S>
void serialize(S& s, VstPatchChunkInfo& info) {
s.value4b(info.version);
s.value4b(info.pluginUniqueID);
s.value4b(info.pluginVersion);
s.value4b(info.numElements);
s.container1b(info.future);
}
template <typename S> template <typename S>
void serialize(S& s, VstRect& rect) { void serialize(S& s, VstRect& rect) {
s.value2b(rect.top); s.value2b(rect.top);
+4
View File
@@ -266,6 +266,10 @@ class DispatchDataConverter : public DefaultDataConverter {
return ChunkData{ return ChunkData{
std::vector<uint8_t>(chunk_data, chunk_data + value)}; std::vector<uint8_t>(chunk_data, chunk_data + value)};
} break; } break;
case effBeginLoadBank:
case effBeginLoadProgram:
return *static_cast<const VstPatchChunkInfo*>(data);
break;
case effProcessEvents: case effProcessEvents:
return DynamicVstEvents(*static_cast<const VstEvents*>(data)); return DynamicVstEvents(*static_cast<const VstEvents*>(data));
break; break;
+3 -3
View File
@@ -102,7 +102,8 @@ static const std::unordered_set<int> safe_mutually_recursive_requests{
static const std::unordered_set<int> unsafe_requests{ static const std::unordered_set<int> unsafe_requests{
effOpen, effClose, effEditGetRect, effEditOpen, effOpen, effClose, effEditGetRect, effEditOpen,
effEditClose, effEditIdle, effEditTop, effMainsChanged, effEditClose, effEditIdle, effEditTop, effMainsChanged,
effGetChunk, effSetChunk, effSetSampleRate, effSetBlockSize}; effGetChunk, effSetChunk, effBeginLoadBank, effBeginLoadProgram,
effSetSampleRate, effSetBlockSize};
/** /**
* These opcodes from `unsafe_requests` should be run under realtime scheduling * These opcodes from `unsafe_requests` should be run under realtime scheduling
@@ -622,8 +623,7 @@ class HostCallbackDataConverter : public DefaultDataConverter {
return DefaultDataConverter::write_value(opcode, value, response); return DefaultDataConverter::write_value(opcode, value, response);
} }
Vst2EventResult send_event( Vst2EventResult send_event(asio::local::stream_protocol::socket& socket,
asio::local::stream_protocol::socket& socket,
const Vst2Event& event, const Vst2Event& event,
SerializationBufferBase& buffer) const override { SerializationBufferBase& buffer) const override {
if (mutually_recursive_callbacks.contains(event.opcode)) { if (mutually_recursive_callbacks.contains(event.opcode)) {