Partially implement IConnectionPoint::connect()

This now works for direct connections, which is probably how most hosts
will use this.
This commit is contained in:
Robbert van der Helm
2020-12-18 14:09:20 +01:00
parent 41a9ca5a36
commit cfa4849467
8 changed files with 50 additions and 8 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ incomplete list of things that still have to be done before this can be used:
- Interfaces left to implement: - Interfaces left to implement:
- `YaHostApplicationHostImpl::createComponent()` - `YaHostApplicationHostImpl::createComponent()`
- `IConnectionPoint` to supplement `IComponent` - The other parts of `IConnectionPoint`, including support for host provided proxies
- Finish implementing `IEditController{,2}` - Finish implementing `IEditController{,2}`
- All other mandatory interfaces - All other mandatory interfaces
- All other optional interfaces - All other optional interfaces
+9
View File
@@ -270,6 +270,15 @@ void Vst3Logger::log_request(bool is_host_vst,
}); });
} }
void Vst3Logger::log_request(bool is_host_vst,
const YaConnectionPoint::Connect& request) {
log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id
<< ": IConnectionPoint::connect(other = <IConnectionPoint* #"
<< request.other_instance_id << ">)";
});
}
void Vst3Logger::log_request( void Vst3Logger::log_request(
bool is_host_vst, bool is_host_vst,
const YaEditController2::SetComponentState& request) { const YaEditController2::SetComponentState& request) {
+1
View File
@@ -79,6 +79,7 @@ class Vst3Logger {
void log_request(bool is_host_vst, const YaComponent::GetRoutingInfo&); void log_request(bool is_host_vst, const YaComponent::GetRoutingInfo&);
void log_request(bool is_host_vst, const YaComponent::ActivateBus&); void log_request(bool is_host_vst, const YaComponent::ActivateBus&);
void log_request(bool is_host_vst, const YaComponent::SetActive&); void log_request(bool is_host_vst, const YaComponent::SetActive&);
void log_request(bool is_host_vst, const YaConnectionPoint::Connect&);
void log_request(bool is_host_vst, void log_request(bool is_host_vst,
const YaEditController2::SetComponentState&); const YaEditController2::SetComponentState&);
void log_request(bool is_host_vst, void log_request(bool is_host_vst,
+1
View File
@@ -75,6 +75,7 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
YaComponent::GetRoutingInfo, YaComponent::GetRoutingInfo,
YaComponent::ActivateBus, YaComponent::ActivateBus,
YaComponent::SetActive, YaComponent::SetActive,
YaConnectionPoint::Connect,
YaEditController2::SetComponentState, YaEditController2::SetComponentState,
YaEditController2::GetParameterCount, YaEditController2::GetParameterCount,
YaEditController2::GetParameterInfo, YaEditController2::GetParameterInfo,
@@ -67,6 +67,29 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
inline bool supported() const { return arguments.supported; } inline bool supported() const { return arguments.supported; }
/**
* Message to pass through a call to
* `IConnectionPoint::connect(other_instance_id)` to the Wine plugin host.
*/
struct Connect {
using Response = UniversalTResult;
native_size_t instance_id;
/**
* The other object this object should be connected to. When connecting
* two `Vst3PluginProxy` objects, we can directly connect the underlying
* objects on the Wine side.
*/
native_size_t other_instance_id;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.value8b(other_instance_id);
}
};
virtual tresult PLUGIN_API connect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API connect(IConnectionPoint* other) override = 0;
virtual tresult PLUGIN_API disconnect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API disconnect(IConnectionPoint* other) override = 0;
virtual tresult PLUGIN_API virtual tresult PLUGIN_API
@@ -193,13 +193,9 @@ tresult PLUGIN_API Vst3PluginProxyImpl::connect(IConnectionPoint* other) {
// identify the other object by its instance IDs and then connect the // identify the other object by its instance IDs and then connect the
// objects in the Wine plugin host directly // objects in the Wine plugin host directly
if (auto other_proxy = dynamic_cast<Vst3PluginProxy*>(other)) { if (auto other_proxy = dynamic_cast<Vst3PluginProxy*>(other)) {
// TODO: Remove debug return bridge.send_message(YaConnectionPoint::Connect{
bridge.logger.log("Host is trying to connect us with instance " + .instance_id = arguments.instance_id,
std::to_string(other_proxy->instance_id())); .other_instance_id = other_proxy->instance_id()});
// TODO: Implement
bridge.logger.log("TODO IConnectionPoint::connect()");
return Steinberg::kNotImplemented;
} else { } else {
// TODO: Add support for `ConnectionProxy` and similar objects // TODO: Add support for `ConnectionProxy` and similar objects
bridge.logger.log( bridge.logger.log(
+11
View File
@@ -32,6 +32,7 @@ InstanceInterfaces::InstanceInterfaces(
: object(object), : object(object),
audio_processor(object), audio_processor(object),
component(object), component(object),
connection_point(object),
edit_controller(object), edit_controller(object),
plugin_base(object) {} plugin_base(object) {}
@@ -250,6 +251,16 @@ void Vst3Bridge::run() {
return object_instances[request.instance_id] return object_instances[request.instance_id]
.component->setActive(request.state); .component->setActive(request.state);
}, },
[&](const YaConnectionPoint::Connect& request)
-> YaConnectionPoint::Connect::Response {
// We can directly connect the underlying objects
// TODO: Add support for connecting objects through a proxy
// object provided by the host
return object_instances[request.instance_id]
.connection_point->connect(
object_instances[request.other_instance_id]
.connection_point);
},
[&](YaEditController2::SetComponentState& request) [&](YaEditController2::SetComponentState& request)
-> YaEditController2::SetComponentState::Response { -> YaEditController2::SetComponentState::Response {
return object_instances[request.instance_id] return object_instances[request.instance_id]
+1
View File
@@ -54,6 +54,7 @@ struct InstanceInterfaces {
Steinberg::FUnknownPtr<Steinberg::Vst::IAudioProcessor> audio_processor; Steinberg::FUnknownPtr<Steinberg::Vst::IAudioProcessor> audio_processor;
Steinberg::FUnknownPtr<Steinberg::Vst::IComponent> component; Steinberg::FUnknownPtr<Steinberg::Vst::IComponent> component;
Steinberg::FUnknownPtr<Steinberg::Vst::IConnectionPoint> connection_point;
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController> edit_controller; Steinberg::FUnknownPtr<Steinberg::Vst::IEditController> edit_controller;
Steinberg::FUnknownPtr<Steinberg::IPluginBase> plugin_base; Steinberg::FUnknownPtr<Steinberg::IPluginBase> plugin_base;
}; };