Pass pointers to IMessage objects around

Instead of serializing the actual `YaMessage`, for the reasons mentioned
in the comments. This was needed to stop iZotope VocalSynth 2 in Ardour
from segfaulting when editing parameters, because that plugin is
apparently being very naughty.
This commit is contained in:
Robbert van der Helm
2020-12-28 13:19:34 +01:00
parent 2c3312b452
commit 4226ab6e43
9 changed files with 181 additions and 53 deletions
+11 -7
View File
@@ -250,14 +250,18 @@ tresult PLUGIN_API
Vst3PluginProxyImpl::notify(Steinberg::Vst::IMessage* message) {
// Since there is no way to enumerate over all values in an
// `IAttributeList`, we can only support relaying messages that were sent by
// our own objects. This is only needed to support hosts that place a
// connection proxy between two objects instead of connecting them directly.
// If the objects are connected directly we also connected them directly on
// the Wine side, so we don't have to do any additional when those objects
// pass through messages.
if (auto message_impl = dynamic_cast<YaMessage*>(message)) {
// our own objects. Additionally, the `IMessage*` we end up passing to the
// plugin needs to have the same lifetime as the original object, because
// some plugins are being a bit naughty. That's why we pass around a pointer
// to the original message object.
// All of this is only needed to support hosts that place a connection proxy
// between two objects instead of connecting them directly. If the objects
// are connected directly we also connected them directly on the Wine side,
// so we don't have to do any additional when those objects pass through
// messages.
if (auto message_ptr = dynamic_cast<YaMessagePtr*>(message)) {
return bridge.send_message(YaConnectionPoint::Notify{
.instance_id = instance_id(), .message = *message_impl});
.instance_id = instance_id(), .message_ptr = *message_ptr});
} else {
bridge.logger.log(
"WARNING: Unknown message type passed to "