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; },
[](VstMidiKeyName& key_name) -> void* { return &key_name; },
[](VstParameterProperties& props) -> void* { return &props; },
[](VstPatchChunkInfo& info) -> void* { return &info; },
[&](const WantsVstRect&) -> void* { return string_buffer.data(); },
[](const WantsVstTimeInfo&) -> void* { return nullptr; },
[&](const WantsString&) -> void* { return string_buffer.data(); }};
+4
View File
@@ -445,6 +445,10 @@ void Vst2Logger::log_event(
[&](const VstParameterProperties&) {
message << "<writable_buffer>";
},
[&](const VstPatchChunkInfo& info) {
message << "<patch_chunk_info for " << info.numElements
<< " banks/programs>";
},
[&](const WantsAEffectUpdate&) { message << "nullptr"; },
[&](const WantsAudioShmBufferConfig&) { message << "nullptr"; },
[&](const WantsChunkBuffer&) {
+10
View File
@@ -444,6 +444,7 @@ struct Vst2Event {
VstIOProperties,
VstMidiKeyName,
VstParameterProperties,
VstPatchChunkInfo,
WantsVstRect,
WantsVstTimeInfo,
WantsString>;
@@ -642,6 +643,15 @@ void serialize(S& s, VstParameterProperties& props) {
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>
void serialize(S& s, VstRect& rect) {
s.value2b(rect.top);
+4
View File
@@ -266,6 +266,10 @@ class DispatchDataConverter : public DefaultDataConverter {
return ChunkData{
std::vector<uint8_t>(chunk_data, chunk_data + value)};
} break;
case effBeginLoadBank:
case effBeginLoadProgram:
return *static_cast<const VstPatchChunkInfo*>(data);
break;
case effProcessEvents:
return DynamicVstEvents(*static_cast<const VstEvents*>(data));
break;
+7 -7
View File
@@ -100,9 +100,10 @@ static const std::unordered_set<int> safe_mutually_recursive_requests{
* this on the main thread introduces any regressions.
*/
static const std::unordered_set<int> unsafe_requests{
effOpen, effClose, effEditGetRect, effEditOpen,
effEditClose, effEditIdle, effEditTop, effMainsChanged,
effGetChunk, effSetChunk, effSetSampleRate, effSetBlockSize};
effOpen, effClose, effEditGetRect, effEditOpen,
effEditClose, effEditIdle, effEditTop, effMainsChanged,
effGetChunk, effSetChunk, effBeginLoadBank, effBeginLoadProgram,
effSetSampleRate, effSetBlockSize};
/**
* These opcodes from `unsafe_requests` should be run under realtime scheduling
@@ -622,10 +623,9 @@ class HostCallbackDataConverter : public DefaultDataConverter {
return DefaultDataConverter::write_value(opcode, value, response);
}
Vst2EventResult send_event(
asio::local::stream_protocol::socket& socket,
const Vst2Event& event,
SerializationBufferBase& buffer) const override {
Vst2EventResult send_event(asio::local::stream_protocol::socket& socket,
const Vst2Event& event,
SerializationBufferBase& buffer) const override {
if (mutually_recursive_callbacks.contains(event.opcode)) {
return mutual_recursion_.fork([&]() {
return DefaultDataConverter::send_event(socket, event, buffer);