diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index d7a8f10d..ec1d4544 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -710,6 +710,17 @@ bool Vst3Logger::log_request( }); } +bool Vst3Logger::log_request( + bool is_host_vst, + const YaUnitHandler::NotifyProgramListChange& request) { + return log_request_base(is_host_vst, [&](auto& message) { + message << request.owner_instance_id + << ": IUnitHandler::notifyProgramListChange(listId = " + << request.list_id + << ", programIndex = " << request.program_index << ")"; + }); +} + void Vst3Logger::log_response(bool is_host_vst, const Ack&) { log_response_base(is_host_vst, [&](auto& message) { message << "ACK"; }); } diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 72696842..26abcf35 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -141,6 +141,8 @@ class Vst3Logger { bool log_request(bool is_host_vst, const YaPlugFrame::ResizeView&); bool log_request(bool is_host_vst, const YaUnitHandler::NotifyUnitSelection&); + bool log_request(bool is_host_vst, + const YaUnitHandler::NotifyProgramListChange&); void log_response(bool is_host_vst, const Ack&); void log_response( diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index 5fea6574..86e6d6a1 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -154,7 +154,8 @@ using CallbackRequest = std::variant; + YaUnitHandler::NotifyUnitSelection, + YaUnitHandler::NotifyProgramListChange>; template void serialize(S& s, CallbackRequest& payload) { diff --git a/src/common/serialization/vst3/component-handler/unit-handler.h b/src/common/serialization/vst3/component-handler/unit-handler.h index 0f322a40..21e82cfe 100644 --- a/src/common/serialization/vst3/component-handler/unit-handler.h +++ b/src/common/serialization/vst3/component-handler/unit-handler.h @@ -82,6 +82,28 @@ class YaUnitHandler : public Steinberg::Vst::IUnitHandler { virtual tresult PLUGIN_API notifyUnitSelection(Steinberg::Vst::UnitID unitId) override = 0; + + /** + * Message to pass through a call to + * `IUnitHandler::notifyProgramListChange(list_id, program_index)` to the + * unit handler provided by the host. + */ + struct NotifyProgramListChange { + using Response = UniversalTResult; + + native_size_t owner_instance_id; + + Steinberg::Vst::ProgramListID list_id; + int32 program_index; + + template + void serialize(S& s) { + s.value8b(owner_instance_id); + s.value4b(list_id); + s.value4b(program_index); + } + }; + virtual tresult PLUGIN_API notifyProgramListChange(Steinberg::Vst::ProgramListID listId, int32 programIndex) override = 0; diff --git a/src/plugin/bridges/vst3.cpp b/src/plugin/bridges/vst3.cpp index c0480f2b..fcb9eee0 100644 --- a/src/plugin/bridges/vst3.cpp +++ b/src/plugin/bridges/vst3.cpp @@ -151,6 +151,13 @@ Vst3PluginBridge::Vst3PluginBridge() .get() .unit_handler->notifyUnitSelection(request.unit_id); }, + [&](const YaUnitHandler::NotifyProgramListChange& request) + -> YaUnitHandler::NotifyProgramListChange::Response { + return plugin_proxies.at(request.owner_instance_id) + .get() + .unit_handler->notifyProgramListChange( + request.list_id, request.program_index); + }, }); }); } diff --git a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp index f16ae185..ece96996 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp @@ -76,7 +76,8 @@ tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitSelection( tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyProgramListChange( Steinberg::Vst::ProgramListID listId, int32 programIndex) { - // TODO: Implement - std::cerr << "TODO: IUnitHandler::notifyProgramListChange" << std::endl; - return Steinberg::kNotImplemented; + return bridge.send_message(YaUnitHandler::NotifyProgramListChange{ + .owner_instance_id = owner_instance_id(), + .list_id = listId, + .program_index = programIndex}); }