diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index e61e30b7..19e30adb 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -24,7 +24,7 @@ Vst3Logger::Vst3Logger(Logger& generic_logger) : logger(generic_logger) {} -void Vst3Logger::log_request(bool is_host_vst, const CreateInstaneIComponent&) { +void Vst3Logger::log_request(bool is_host_vst, const YaComponent::Create&) { if (BOOST_UNLIKELY(logger.verbosity >= Logger::Verbosity::most_events)) { std::ostringstream message; // TODO: Log the cid in some readable way, if possible diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index f4cf1699..48b1d0b3 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -45,7 +45,7 @@ class Vst3Logger { // flag here indicates whether the request was initiated on the host side // (what we'll call a control message). - void log_request(bool is_host_vst, const CreateInstaneIComponent&); + void log_request(bool is_host_vst, const YaComponent::Create&); void log_request(bool is_host_vst, const WantsConfiguration&); void log_request(bool is_host_vst, const WantsPluginFactory&); diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index ca22b365..74157ec9 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -38,20 +38,8 @@ // TODO: If this approach works, maybe we can also refactor the VST2 handling to // do this since it's a bit safer and easier to read -/** - * Request the Wine plugin host to instantiate a new IComponent to pass through - * a call to `IPluginFactory::createInstance(cid, IComponent::iid, ...)`. - */ -struct CreateInstaneIComponent { - using Response = YaComponent&; - - Steinberg::TUID cid; - - template - void serialize(S& s) { - s.container1b(cid); - } -}; +// All messages for creating objects and calling interfaces on them are defined +// as part of the interfaces and implementations in `vst3/` /** * Marker struct to indicate the other side (the plugin) should send a copy of @@ -80,8 +68,7 @@ struct WantsPluginFactory { * encodes the information we request or the operation we want to perform. A * request of type `ControlRequest(T)` should send back a `T::Response`. */ -using ControlRequest = - std::variant; +using ControlRequest = std::variant; template void serialize(S& s, ControlRequest& payload) { diff --git a/src/common/serialization/vst3/component.h b/src/common/serialization/vst3/component.h index e7ba26b7..9a966587 100644 --- a/src/common/serialization/vst3/component.h +++ b/src/common/serialization/vst3/component.h @@ -35,6 +35,22 @@ using Steinberg::TBool, Steinberg::int32, Steinberg::tresult; */ class YaComponent : public Steinberg::Vst::IComponent { public: + /** + * Request the Wine plugin host to instantiate a new IComponent to pass + * through a call to `IPluginFactory::createInstance(cid, IComponent::iid, + * ...)`. + */ + struct Create { + using Response = YaComponent&; + + Steinberg::TUID cid; + + template + void serialize(S& s) { + s.container1b(cid); + } + }; + YaComponent(); /** diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index cd3e71d4..f62f1068 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -51,8 +51,8 @@ void Vst3Bridge::run() { sockets.host_vst_control.receive_messages( std::nullopt, overload{ - [&](const CreateInstaneIComponent& args) - -> CreateInstaneIComponent::Response { + [&](const YaComponent::Create& args) + -> YaComponent::Create::Response { Steinberg::IPtr component = module->getFactory() .createInstance(args.cid);