mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Implement IUnitHandler::notifyUnitSelection
This commit is contained in:
@@ -700,6 +700,16 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Vst3Logger::log_request(
|
||||||
|
bool is_host_vst,
|
||||||
|
const YaUnitHandler::NotifyUnitSelection& request) {
|
||||||
|
return log_request_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << request.owner_instance_id
|
||||||
|
<< ": IUnitHandler::notifyUnitSelection(unitId = "
|
||||||
|
<< request.unit_id << ")";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Vst3Logger::log_response(bool is_host_vst, const Ack&) {
|
void Vst3Logger::log_response(bool is_host_vst, const Ack&) {
|
||||||
log_response_base(is_host_vst, [&](auto& message) { message << "ACK"; });
|
log_response_base(is_host_vst, [&](auto& message) { message << "ACK"; });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ class Vst3Logger {
|
|||||||
const YaComponentHandler::RestartComponent&);
|
const YaComponentHandler::RestartComponent&);
|
||||||
bool log_request(bool is_host_vst, const YaHostApplication::GetName&);
|
bool log_request(bool is_host_vst, const YaHostApplication::GetName&);
|
||||||
bool log_request(bool is_host_vst, const YaPlugFrame::ResizeView&);
|
bool log_request(bool is_host_vst, const YaPlugFrame::ResizeView&);
|
||||||
|
bool log_request(bool is_host_vst,
|
||||||
|
const YaUnitHandler::NotifyUnitSelection&);
|
||||||
|
|
||||||
void log_response(bool is_host_vst, const Ack&);
|
void log_response(bool is_host_vst, const Ack&);
|
||||||
void log_response(
|
void log_response(
|
||||||
|
|||||||
@@ -153,7 +153,8 @@ using CallbackRequest = std::variant<WantsConfiguration,
|
|||||||
// there
|
// there
|
||||||
YaConnectionPoint::Notify,
|
YaConnectionPoint::Notify,
|
||||||
YaHostApplication::GetName,
|
YaHostApplication::GetName,
|
||||||
YaPlugFrame::ResizeView>;
|
YaPlugFrame::ResizeView,
|
||||||
|
YaUnitHandler::NotifyUnitSelection>;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s, CallbackRequest& payload) {
|
void serialize(S& s, CallbackRequest& payload) {
|
||||||
|
|||||||
@@ -61,6 +61,25 @@ class YaUnitHandler : public Steinberg::Vst::IUnitHandler {
|
|||||||
|
|
||||||
inline bool supported() const { return arguments.supported; }
|
inline bool supported() const { return arguments.supported; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message to pass through a call to
|
||||||
|
* `IUnitHandler::notifyUnitSelection(unit_id)` to the unit handler provided
|
||||||
|
* by the host.
|
||||||
|
*/
|
||||||
|
struct NotifyUnitSelection {
|
||||||
|
using Response = UniversalTResult;
|
||||||
|
|
||||||
|
native_size_t owner_instance_id;
|
||||||
|
|
||||||
|
Steinberg::Vst::UnitID unit_id;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(owner_instance_id);
|
||||||
|
s.value4b(unit_id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
virtual tresult PLUGIN_API
|
virtual tresult PLUGIN_API
|
||||||
notifyUnitSelection(Steinberg::Vst::UnitID unitId) override = 0;
|
notifyUnitSelection(Steinberg::Vst::UnitID unitId) override = 0;
|
||||||
virtual tresult PLUGIN_API
|
virtual tresult PLUGIN_API
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ class YaPluginFactoryImpl : public YaPluginFactory {
|
|||||||
void** obj) override;
|
void** obj) override;
|
||||||
tresult PLUGIN_API setHostContext(Steinberg::FUnknown* context) override;
|
tresult PLUGIN_API setHostContext(Steinberg::FUnknown* context) override;
|
||||||
|
|
||||||
// The following pointers are cast from `host_context` if `setHostContext()`
|
// The following pointers are cast from `host_context` if
|
||||||
// has been called
|
// `IPluginFactory3::setHostContext()` has been called
|
||||||
|
|
||||||
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application;
|
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application;
|
||||||
|
|
||||||
|
|||||||
@@ -357,6 +357,10 @@ tresult PLUGIN_API Vst3PluginProxyImpl::setComponentHandler(
|
|||||||
// this component handler
|
// this component handler
|
||||||
component_handler = handler;
|
component_handler = handler;
|
||||||
|
|
||||||
|
// Automatically converted smart pointers for when the plugin performs a
|
||||||
|
// callback later
|
||||||
|
unit_handler = component_handler;
|
||||||
|
|
||||||
return bridge.send_message(YaEditController::SetComponentHandler{
|
return bridge.send_message(YaEditController::SetComponentHandler{
|
||||||
.instance_id = instance_id(),
|
.instance_id = instance_id(),
|
||||||
.component_handler_proxy_args =
|
.component_handler_proxy_args =
|
||||||
|
|||||||
@@ -152,11 +152,16 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
|||||||
*/
|
*/
|
||||||
Vst3PlugViewProxyImpl* last_created_plug_view = nullptr;
|
Vst3PlugViewProxyImpl* last_created_plug_view = nullptr;
|
||||||
|
|
||||||
// The following pointers are cast from `host_context` if `setHostContext()`
|
// The following pointers are cast from `host_context` if
|
||||||
// has been called
|
// `IPluginBase::initialize()` has been called
|
||||||
|
|
||||||
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application;
|
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application;
|
||||||
|
|
||||||
|
// The following pointers are cast from `component_handler` if
|
||||||
|
// `IEditController::setComponentHandler()` has been called
|
||||||
|
|
||||||
|
Steinberg::FUnknownPtr<Steinberg::Vst::IUnitHandler> unit_handler;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vst3PluginBridge& bridge;
|
Vst3PluginBridge& bridge;
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,12 @@ Vst3PluginBridge::Vst3PluginBridge()
|
|||||||
return plug_view->plug_frame->resizeView(plug_view,
|
return plug_view->plug_frame->resizeView(plug_view,
|
||||||
&request.new_size);
|
&request.new_size);
|
||||||
},
|
},
|
||||||
|
[&](const YaUnitHandler::NotifyUnitSelection& request)
|
||||||
|
-> YaUnitHandler::NotifyUnitSelection::Response {
|
||||||
|
return plugin_proxies.at(request.owner_instance_id)
|
||||||
|
.get()
|
||||||
|
.unit_handler->notifyUnitSelection(request.unit_id);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,8 @@ Vst3ComponentHandlerProxyImpl::restartComponent(int32 flags) {
|
|||||||
|
|
||||||
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitSelection(
|
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitSelection(
|
||||||
Steinberg::Vst::UnitID unitId) {
|
Steinberg::Vst::UnitID unitId) {
|
||||||
// TODO: Implement
|
return bridge.send_message(YaUnitHandler::NotifyUnitSelection{
|
||||||
std::cerr << "TODO: IUnitHandler::notifyUnitSelection" << std::endl;
|
.owner_instance_id = owner_instance_id(), .unit_id = unitId});
|
||||||
return Steinberg::kNotImplemented;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyProgramListChange(
|
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyProgramListChange(
|
||||||
|
|||||||
Reference in New Issue
Block a user