Work around improperly late initializing plugins

This fixes the Roland Cloud plugins.
This commit is contained in:
Robbert van der Helm
2020-05-10 13:42:20 +02:00
parent ba91971829
commit 686ca11ba8
5 changed files with 53 additions and 7 deletions
+9
View File
@@ -283,6 +283,14 @@ auto passthrough_event(AEffect* plugin, F callback) {
[&](DynamicSpeakerArrangement& speaker_arrangement) -> void* {
return &speaker_arrangement.as_c_speaker_arrangement();
},
[&](WantsAEffectUpdate&) -> void* {
// The host will never actually ask for an updated `AEffect`
// object since that should not be a thing. This is purely a
// meant as a workaround for plugins that initialize their
// `AEffect` object after the plugin has already finished
// initializing.
return nullptr;
},
[&](WantsChunkBuffer&) -> void* { return string_buffer.data(); },
[&](VstIOProperties& props) -> void* { return &props; },
[&](VstMidiKeyName& key_name) -> void* { return &key_name; },
@@ -335,6 +343,7 @@ auto passthrough_event(AEffect* plugin, F callback) {
[&](VstParameterProperties& props) -> EventResultPayload {
return props;
},
[&](WantsAEffectUpdate&) -> EventResultPayload { return *plugin; },
[&](WantsVstRect&) -> EventResultPayload {
// The plugin has written a pointer to a VstRect struct into the
// data poitner
+4 -3
View File
@@ -201,14 +201,15 @@ void Logger::log_event(bool is_dispatch,
message << "<" << speaker_arrangement.speakers.size()
<< " output_speakers>";
},
[&](const WantsChunkBuffer&) {
message << "<writable_buffer>";
},
[&](const VstIOProperties&) { message << "<io_properties>"; },
[&](const VstMidiKeyName&) { message << "<key_name>"; },
[&](const VstParameterProperties&) {
message << "<writable_buffer>";
},
[&](const WantsAEffectUpdate&) { message << "<nullptr>"; },
[&](const WantsChunkBuffer&) {
message << "<writable_buffer>";
},
[&](const WantsVstRect&) { message << "<writable_buffer>"; },
[&](const WantsVstTimeInfo&) { message << "<nullptr>"; },
[&](const WantsString&) { message << "<writable_string>"; }},
+13 -2
View File
@@ -285,6 +285,15 @@ class alignas(16) DynamicSpeakerArrangement {
std::vector<uint8_t> speaker_arrangement_buffer;
};
/**
* Marker struct to indicate that the other side (the Wine VST host) should send
* an updated copy of the plugin's `AEffect` object. Should not be needed since
* the plugin should be calling `audioMasterIOChanged()` after it has changed
* its object, but some improperly coded plugins will only initialize their
* flags, IO properties and parameter counts after `effEditOpen()`.
*/
struct WantsAEffectUpdate {};
/**
* Marker struct to indicate that that the event writes arbitrary data into one
* of its own buffers and uses the void pointer to store start of that data,
@@ -352,6 +361,7 @@ using EventPayload = std::variant<std::nullptr_t,
AEffect,
DynamicVstEvents,
DynamicSpeakerArrangement,
WantsAEffectUpdate,
WantsChunkBuffer,
VstIOProperties,
VstMidiKeyName,
@@ -382,8 +392,9 @@ void serialize(S& s, EventPayload& payload) {
[](S& s, VstIOProperties& props) { s.object(props); },
[](S& s, VstMidiKeyName& key_name) { s.object(key_name); },
[](S& s, VstParameterProperties& props) { s.object(props); },
[](S&, WantsChunkBuffer&) {}, [](S&, WantsVstRect&) {},
[](S&, WantsVstTimeInfo&) {}, [](S&, WantsString&) {}});
[](S&, WantsAEffectUpdate&) {}, [](S&, WantsChunkBuffer&) {},
[](S&, WantsVstRect&) {}, [](S&, WantsVstTimeInfo&) {},
[](S&, WantsString&) {}});
}
/**