mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Implement IConnectionPoint::notify
This commit is contained in:
@@ -108,6 +108,21 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaConnectionPoint::Notify& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << request.instance_id
|
||||
<< ": IConnectionPoint::notify(message = <IMessage* ";
|
||||
if (const char* id =
|
||||
const_cast<YaMessage&>(request.message).getMessageID()) {
|
||||
message << "with ID = \"" << id << "\"";
|
||||
} else {
|
||||
message << "without an ID";
|
||||
}
|
||||
message << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(
|
||||
bool is_host_vst,
|
||||
const YaEditController::SetComponentState& request) {
|
||||
|
||||
@@ -66,6 +66,7 @@ class Vst3Logger {
|
||||
bool log_request(bool is_host_vst, const Vst3PluginProxy::GetState&);
|
||||
bool log_request(bool is_host_vst, const YaConnectionPoint::Connect&);
|
||||
bool log_request(bool is_host_vst, const YaConnectionPoint::Disconnect&);
|
||||
bool log_request(bool is_host_vst, const YaConnectionPoint::Notify&);
|
||||
bool log_request(bool is_host_vst,
|
||||
const YaEditController::SetComponentState&);
|
||||
bool log_request(bool is_host_vst,
|
||||
|
||||
@@ -68,6 +68,7 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
||||
Vst3PluginProxy::GetState,
|
||||
YaConnectionPoint::Connect,
|
||||
YaConnectionPoint::Disconnect,
|
||||
YaConnectionPoint::Notify,
|
||||
YaEditController::SetComponentState,
|
||||
YaEditController::GetParameterCount,
|
||||
YaEditController::GetParameterInfo,
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "../../common.h"
|
||||
#include "../base.h"
|
||||
#include "../message.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||
@@ -119,6 +120,30 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API disconnect(IConnectionPoint* other) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IConnectionPoint::notify(message)` to
|
||||
* the Wine plugin host. Since `IAttributeList` does not have any way to
|
||||
* iterate over all values, we only support messages sent by plugins using
|
||||
* our own implementation of the interface, since there's no way to
|
||||
* serialize them otherwise. This `IConnectionPoint::notify()`
|
||||
* implementation is also only used with hosts that do not connect objects
|
||||
* directly and use connection proxies instead.
|
||||
*/
|
||||
struct Notify {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
YaMessage message;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.object(message);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
notify(Steinberg::Vst::IMessage* message) override = 0;
|
||||
|
||||
|
||||
@@ -246,9 +246,22 @@ tresult PLUGIN_API Vst3PluginProxyImpl::disconnect(IConnectionPoint* other) {
|
||||
|
||||
tresult PLUGIN_API
|
||||
Vst3PluginProxyImpl::notify(Steinberg::Vst::IMessage* message) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log("TODO IConnectionPoint::notify()");
|
||||
return Steinberg::kNotImplemented;
|
||||
// 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)) {
|
||||
return bridge.send_message(YaConnectionPoint::Notify{
|
||||
.instance_id = instance_id(), .message = *message_impl});
|
||||
} else {
|
||||
bridge.logger.log(
|
||||
"WARNING: Unknown message type passed to "
|
||||
"'IConnectionPoint::notify()', ignoring");
|
||||
return Steinberg::kNotImplemented;
|
||||
}
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
|
||||
@@ -187,6 +187,11 @@ void Vst3Bridge::run() {
|
||||
object_instances[request.other_instance_id]
|
||||
.connection_point);
|
||||
},
|
||||
[&](YaConnectionPoint::Notify& request)
|
||||
-> YaConnectionPoint::Notify::Response {
|
||||
return object_instances[request.instance_id]
|
||||
.connection_point->notify(&request.message);
|
||||
},
|
||||
[&](YaEditController::SetComponentState& request)
|
||||
-> YaEditController::SetComponentState::Response {
|
||||
return object_instances[request.instance_id]
|
||||
|
||||
Reference in New Issue
Block a user