mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Also fix mutual recursion across both components
When setting the state on the audio processor, it can happen that plugin triggers a resize from the edit controller. We should also be able to handle that situation.
This commit is contained in:
@@ -374,9 +374,20 @@ tresult PLUGIN_API Vst3PluginProxyImpl::setState(Steinberg::IBStream* state) {
|
||||
if (last_created_plug_view_active) {
|
||||
return last_created_plug_view->send_mutually_recursive_message(
|
||||
std::move(message));
|
||||
} else {
|
||||
return bridge.send_message(std::move(message));
|
||||
} else if (connected_instance_id) {
|
||||
// We should also be able to handle the above situation when a
|
||||
// `setState()` on a processor triggers a resize coming from the
|
||||
// edit controller. To do that, we'll also check if the connected
|
||||
// instance has an active plug view.
|
||||
Vst3PluginProxyImpl& other_instance =
|
||||
bridge.plugin_proxies.at(*connected_instance_id).get();
|
||||
if (other_instance.last_created_plug_view_active) {
|
||||
return other_instance.last_created_plug_view
|
||||
->send_mutually_recursive_message(std::move(message));
|
||||
}
|
||||
}
|
||||
|
||||
return bridge.send_message(std::move(message));
|
||||
} else {
|
||||
bridge.logger.log(
|
||||
"WARNING: Null pointer passed to "
|
||||
@@ -425,6 +436,8 @@ tresult PLUGIN_API Vst3PluginProxyImpl::connect(IConnectionPoint* other) {
|
||||
// out which object the plugins are connected to, we'll still proxy the
|
||||
// host's connection proxy.
|
||||
if (auto other_instance = dynamic_cast<Vst3PluginProxy*>(other)) {
|
||||
connected_instance_id = other_instance->instance_id();
|
||||
|
||||
return bridge.send_message(
|
||||
YaConnectionPoint::Connect{.instance_id = instance_id(),
|
||||
.other = other_instance->instance_id()});
|
||||
|
||||
@@ -144,7 +144,7 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
*/
|
||||
Steinberg::IPtr<Vst3PluginFactoryProxyImpl> plugin_factory = nullptr;
|
||||
|
||||
private:
|
||||
public:
|
||||
/**
|
||||
* All VST3 plugin objects we created from this plugin. We keep track of
|
||||
* these in case the plugin does a host callback, so we can associate that
|
||||
@@ -156,5 +156,7 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
*/
|
||||
std::map<size_t, std::reference_wrapper<Vst3PluginProxyImpl>>
|
||||
plugin_proxies;
|
||||
|
||||
private:
|
||||
std::mutex plugin_proxies_mutex;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user