Files
yabridge/src/common/serialization/vst3/connection-point-proxy.h
T
Robbert van der Helm 70cb6dad89 Allow indirect IConnectionPoint connections
This is needed to support Ardour. These extra hops and serialization
steps will probably hurt performance, but outside of some huge hacks (to
connect the components directly anyways) there's not much else we can
do.
2020-12-25 14:21:18 +01:00

75 lines
2.7 KiB
C++

// yabridge: a Wine VST bridge
// Copyright (C) 2020 Robbert van der Helm
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma once
#include "../common.h"
#include "plugin/connection-point.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
/**
* This is only needed to...proxy a connection point proxy. Most hosts will
* connect a plugin's processor and controller directly using
* `IConnectionPoint::connect()`. But some hosts, like Ardour, will place a
* proxy object between them that forwards calls to
* `IConnectionPoint::notify()`. When objects are connected directly by the host
* we can also connect them directly in the Wine plugin host, but when the host
* uses proxies we'll also have to go through that proxy. The purpose of this
* class is to provide a proxy for such a connection proxy. So when the plugin
* calls `notify()` on an object of this class, then we will forward that call
* to the `IConnectionPoint` proxy provided by the host, which will then in turn
* call `IConnectionPoint::notify()` on the other object and we'll then forward
* that message again to them Wine plugin host.
*/
class Vst3ConnectionPointProxy : public YaConnectionPoint {
public:
// We had to define this in `YaConnectionPoint` to work around circular
// includes
using ConstructArgs =
YaConnectionPoint::Vst3ConnectionPointProxyConstructArgs;
/**
* Instantiate this instance with arguments read from an actual
* `IConnectionPoint` object/proxy.
*
* @note This object will be created as part of handling
* `IConnectionPoint::connect()` if the connection is indirect.
*/
Vst3ConnectionPointProxy(const ConstructArgs&& args);
/**
* This object will be destroyed again during
* `IConnectionPoint::disconnect()`.
*/
virtual ~Vst3ConnectionPointProxy();
DECLARE_FUNKNOWN_METHODS
/**
* Get the instance ID of the owner of this object.
*/
inline size_t owner_instance_id() const {
return arguments.owner_instance_id;
}
private:
ConstructArgs arguments;
};
#pragma GCC diagnostic pop