diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 3241ac8e..f9a2c25a 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -72,6 +72,14 @@ void Vst3Logger::log_request(bool is_host_vst, }); } +void Vst3Logger::log_request(bool is_host_vst, + const YaComponent::SetIoMode& request) { + log_request_base(is_host_vst, [&](auto& message) { + message << "::setIoMode(" + << request.mode << ")"; + }); +} + void Vst3Logger::log_request(bool is_host_vst, const YaPluginFactory::Construct&) { log_request_base(is_host_vst, diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index a580575f..468887c6 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -60,6 +60,7 @@ class Vst3Logger { void log_request(bool is_host_vst, const YaComponent::Destruct&); void log_request(bool is_host_vst, const YaComponent::Initialize&); void log_request(bool is_host_vst, const YaComponent::Terminate&); + void log_request(bool is_host_vst, const YaComponent::SetIoMode&); void log_request(bool is_host_vst, const YaPluginFactory::Construct&); void log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&); void log_request(bool is_host_vst, const WantsConfiguration&); diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index 60683920..d5f875ad 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -61,6 +61,7 @@ using ControlRequest = std::variant; diff --git a/src/common/serialization/vst3/component.h b/src/common/serialization/vst3/component.h index 11ecf078..8bb5cb2b 100644 --- a/src/common/serialization/vst3/component.h +++ b/src/common/serialization/vst3/component.h @@ -171,6 +171,25 @@ class YaComponent : public Steinberg::Vst::IComponent { // From `IComponent` tresult PLUGIN_API getControllerClassId(Steinberg::TUID classId) override; + + /** + * Message to pass through a call to `IComponent::setIoMode(IoMode)` to the + * Wine plugin host. + */ + struct SetIoMode { + using Response = UniversalTResult; + + native_size_t instance_id; + + Steinberg::Vst::IoMode mode; + + template + void serialize(S& s) { + s.value8b(instance_id); + s.value4b(mode); + } + }; + virtual tresult PLUGIN_API setIoMode(Steinberg::Vst::IoMode mode) override = 0; virtual int32 PLUGIN_API diff --git a/src/plugin/bridges/vst3-impls/component.cpp b/src/plugin/bridges/vst3-impls/component.cpp index 91a7ee93..09c056b2 100644 --- a/src/plugin/bridges/vst3-impls/component.cpp +++ b/src/plugin/bridges/vst3-impls/component.cpp @@ -74,9 +74,10 @@ tresult PLUGIN_API YaComponentPluginImpl::terminate() { tresult PLUGIN_API YaComponentPluginImpl::setIoMode(Steinberg::Vst::IoMode mode) { - // TODO: Implement - bridge.logger.log("TODO: IComponent::setIoMode()"); - return Steinberg::kNotImplemented; + return bridge + .send_message(YaComponent::SetIoMode{ + .instance_id = arguments.instance_id, .mode = mode}) + .native(); } int32 PLUGIN_API diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 8e8798e8..4611d348 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -107,6 +107,11 @@ void Vst3Bridge::run() { -> YaComponent::Terminate::Response { return component_instances[request.instance_id]->terminate(); }, + [&](const YaComponent::SetIoMode& request) + -> YaComponent::SetIoMode::Response { + return component_instances[request.instance_id]->setIoMode( + request.mode); + }, [&](const YaPluginFactory::Construct&) -> YaPluginFactory::Construct::Response { return YaPluginFactory::ConstructArgs(