Implement IConnectionPoint::disconnect

This commit is contained in:
Robbert van der Helm
2020-12-19 12:39:08 +01:00
parent 8251249959
commit 71493299ec
8 changed files with 63 additions and 5 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ incomplete list of things that still have to be done before this can be used:
- Interfaces left to implement: - Interfaces left to implement:
- `IHostApplication::createComponent()` - `IHostApplication::createComponent()`
- The other parts of `IConnectionPoint`, including support for host provided proxies - `IConnectionPoint::notify()`, and support for indirectly connecting
components through message passing 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
@@ -283,6 +283,15 @@ void Vst3Logger::log_request(bool is_host_vst,
}); });
} }
void Vst3Logger::log_request(bool is_host_vst,
const YaConnectionPoint::Disconnect& request) {
log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id
<< ": IConnectionPoint::disconnect(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
@@ -80,6 +80,7 @@ class Vst3Logger {
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, const YaConnectionPoint::Connect&);
void log_request(bool is_host_vst, const YaConnectionPoint::Disconnect&);
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
@@ -76,6 +76,7 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
YaComponent::ActivateBus, YaComponent::ActivateBus,
YaComponent::SetActive, YaComponent::SetActive,
YaConnectionPoint::Connect, YaConnectionPoint::Connect,
YaConnectionPoint::Disconnect,
YaEditController2::SetComponentState, YaEditController2::SetComponentState,
YaEditController2::GetParameterCount, YaEditController2::GetParameterCount,
YaEditController2::GetParameterInfo, YaEditController2::GetParameterInfo,
+1 -1
View File
@@ -23,7 +23,7 @@ VST3 host interfaces are implemented as follows:
| ------------------- | ------------------ | | ------------------- | ------------------ |
| `YaHostApplication` | `IHostApplication` | | `YaHostApplication` | `IHostApplication` |
The following (host) interfaces are also implemented fur serialization purposes: The following (host) interfaces are also implemented for serialization purposes:
| yabridge class | Interfaces | Notes | | yabridge class | Interfaces | Notes |
| -------------------- | ------------------- | ---------------------------------------------------------------------- | | -------------------- | ------------------- | ---------------------------------------------------------------------- |
@@ -70,6 +70,8 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
/** /**
* Message to pass through a call to * Message to pass through a call to
* `IConnectionPoint::connect(other_instance_id)` to the Wine plugin host. * `IConnectionPoint::connect(other_instance_id)` to the Wine plugin host.
* At the moment this is only implemented for directly connecting objects
* created by the plugin without any proxies in between them.
*/ */
struct Connect { struct Connect {
using Response = UniversalTResult; using Response = UniversalTResult;
@@ -91,6 +93,31 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
}; };
virtual tresult PLUGIN_API connect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API connect(IConnectionPoint* other) override = 0;
/**
* Message to pass through a call to
* `IConnectionPoint::disconnect(other_instance_id)` to the Wine plugin
* host. At the moment this is only implemented for directly connecting
* objects created by the plugin without any proxies in between them.
*/
struct Disconnect {
using Response = UniversalTResult;
native_size_t instance_id;
/**
* The other object backed by a `Vst3PluginProxy` this object was
* connected to and should be disconnected from. When connecting.
*/
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 disconnect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API disconnect(IConnectionPoint* other) override = 0;
virtual tresult PLUGIN_API virtual tresult PLUGIN_API
notify(Steinberg::Vst::IMessage* message) override = 0; notify(Steinberg::Vst::IMessage* message) override = 0;
+13 -3
View File
@@ -207,9 +207,19 @@ tresult PLUGIN_API Vst3PluginProxyImpl::connect(IConnectionPoint* other) {
} }
tresult PLUGIN_API Vst3PluginProxyImpl::disconnect(IConnectionPoint* other) { tresult PLUGIN_API Vst3PluginProxyImpl::disconnect(IConnectionPoint* other) {
// TODO: Implement // See `Vst3PluginProxyImpl::connect()`
bridge.logger.log("TODO IConnectionPoint::disconnect()"); if (auto other_proxy = dynamic_cast<Vst3PluginProxy*>(other)) {
return Steinberg::kNotImplemented; return bridge.send_message(YaConnectionPoint::Disconnect{
.instance_id = instance_id(),
.other_instance_id = other_proxy->instance_id()});
} else {
// TODO: Add support for `ConnectionProxy` and similar objects
bridge.logger.log(
"WARNING: The host passed a proxy proxy object to "
"'IConnectionPoint::disconnect()'. This is currently not "
"supported.");
return Steinberg::kNotImplemented;
}
} }
tresult PLUGIN_API tresult PLUGIN_API
+9
View File
@@ -261,6 +261,15 @@ void Vst3Bridge::run() {
object_instances[request.other_instance_id] object_instances[request.other_instance_id]
.connection_point); .connection_point);
}, },
[&](const YaConnectionPoint::Disconnect& request)
-> YaConnectionPoint::Disconnect::Response {
// TODO: Add support for connecting objects through a proxy
// object provided by the host
return object_instances[request.instance_id]
.connection_point->disconnect(
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]