mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Implement the Wine side for createView()
This commit is contained in:
@@ -414,6 +414,15 @@ bool Vst3Logger::log_request(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Vst3Logger::log_request(bool is_host_vst,
|
||||||
|
const YaEditController::CreateView& request) {
|
||||||
|
return log_request_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << request.instance_id
|
||||||
|
<< ": IEditController::createView(name = " << request.name
|
||||||
|
<< ")";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
bool Vst3Logger::log_request(bool is_host_vst,
|
bool Vst3Logger::log_request(bool is_host_vst,
|
||||||
const YaPluginBase::Initialize& request) {
|
const YaPluginBase::Initialize& request) {
|
||||||
return log_request_base(is_host_vst, [&](auto& message) {
|
return log_request_base(is_host_vst, [&](auto& message) {
|
||||||
@@ -661,7 +670,19 @@ void Vst3Logger::log_response(
|
|||||||
log_response_base(is_host_vst, [&](auto& message) {
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
message << response.result.string();
|
message << response.result.string();
|
||||||
if (response.result == Steinberg::kResultOk) {
|
if (response.result == Steinberg::kResultOk) {
|
||||||
message << ", " << response.value_normalized << std::endl;
|
message << ", " << response.value_normalized;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_response(
|
||||||
|
bool is_host_vst,
|
||||||
|
const YaEditController::CreateViewResponse& response) {
|
||||||
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
if (response.plug_view_args) {
|
||||||
|
message << "<IPlugView*>";
|
||||||
|
} else {
|
||||||
|
message << "<nullptr>";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ class Vst3Logger {
|
|||||||
const YaEditController::SetParamNormalized&);
|
const YaEditController::SetParamNormalized&);
|
||||||
bool log_request(bool is_host_vst,
|
bool log_request(bool is_host_vst,
|
||||||
const YaEditController::SetComponentHandler&);
|
const YaEditController::SetComponentHandler&);
|
||||||
|
bool log_request(bool is_host_vst, const YaEditController::CreateView&);
|
||||||
bool log_request(bool is_host_vst, const YaPluginBase::Initialize&);
|
bool log_request(bool is_host_vst, const YaPluginBase::Initialize&);
|
||||||
bool log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
bool log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
||||||
bool log_request(bool is_host_vst, const YaPluginFactory::Construct&);
|
bool log_request(bool is_host_vst, const YaPluginFactory::Construct&);
|
||||||
@@ -140,6 +141,8 @@ class Vst3Logger {
|
|||||||
const YaEditController::GetParamStringByValueResponse&);
|
const YaEditController::GetParamStringByValueResponse&);
|
||||||
void log_response(bool is_host_vst,
|
void log_response(bool is_host_vst,
|
||||||
const YaEditController::GetParamValueByStringResponse&);
|
const YaEditController::GetParamValueByStringResponse&);
|
||||||
|
void log_response(bool is_host_vst,
|
||||||
|
const YaEditController::CreateViewResponse&);
|
||||||
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
||||||
void log_response(bool is_host_vst, const Configuration&);
|
void log_response(bool is_host_vst, const Configuration&);
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
|
|||||||
YaEditController::GetParamNormalized,
|
YaEditController::GetParamNormalized,
|
||||||
YaEditController::SetParamNormalized,
|
YaEditController::SetParamNormalized,
|
||||||
YaEditController::SetComponentHandler,
|
YaEditController::SetComponentHandler,
|
||||||
|
YaEditController::CreateView,
|
||||||
YaPluginBase::Initialize,
|
YaPluginBase::Initialize,
|
||||||
YaPluginBase::Terminate,
|
YaPluginBase::Terminate,
|
||||||
YaPluginFactory::Construct,
|
YaPluginFactory::Construct,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "../../common.h"
|
#include "../../common.h"
|
||||||
#include "../base.h"
|
#include "../base.h"
|
||||||
#include "../component-handler-proxy.h"
|
#include "../component-handler-proxy.h"
|
||||||
|
#include "../plug-view-proxy.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
@@ -361,6 +362,40 @@ class YaEditController : public Steinberg::Vst::IEditController {
|
|||||||
|
|
||||||
virtual tresult PLUGIN_API setComponentHandler(
|
virtual tresult PLUGIN_API setComponentHandler(
|
||||||
Steinberg::Vst::IComponentHandler* handler) override = 0;
|
Steinberg::Vst::IComponentHandler* handler) override = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `IPlugView` proxy arguments returned from a call to
|
||||||
|
* `IEditController::createView(name)`. If not empty, then we'll use this to
|
||||||
|
* construct a proxy object that can send control messages to the plugin
|
||||||
|
* instance's actual `IPlugView` object.
|
||||||
|
*/
|
||||||
|
struct CreateViewResponse {
|
||||||
|
std::optional<Vst3PlugViewProxy::ConstructArgs> plug_view_args;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.ext(plug_view_args, bitsery::ext::StdOptional{});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message to pass through a call to `IEditController::createView(name)` to
|
||||||
|
* the Wine plugin host.
|
||||||
|
*/
|
||||||
|
struct CreateView {
|
||||||
|
using Response = CreateViewResponse;
|
||||||
|
|
||||||
|
native_size_t instance_id;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(instance_id);
|
||||||
|
s.text1b(name, 128);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
virtual Steinberg::IPlugView* PLUGIN_API
|
virtual Steinberg::IPlugView* PLUGIN_API
|
||||||
createView(Steinberg::FIDString name) override = 0;
|
createView(Steinberg::FIDString name) override = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -371,6 +371,25 @@ void Vst3Bridge::run() {
|
|||||||
object_instances[request.instance_id]
|
object_instances[request.instance_id]
|
||||||
.component_handler_proxy);
|
.component_handler_proxy);
|
||||||
},
|
},
|
||||||
|
[&](const YaEditController::CreateView& request)
|
||||||
|
-> YaEditController::CreateView::Response {
|
||||||
|
object_instances[request.instance_id].plug_view =
|
||||||
|
Steinberg::owned(
|
||||||
|
object_instances[request.instance_id]
|
||||||
|
.edit_controller->createView(request.name.c_str()));
|
||||||
|
|
||||||
|
// We'll create a proxy so the host can call functions on this
|
||||||
|
// `IPlugView` object
|
||||||
|
return YaEditController::CreateViewResponse{
|
||||||
|
.plug_view_args =
|
||||||
|
(object_instances[request.instance_id].plug_view
|
||||||
|
? std::make_optional<
|
||||||
|
Vst3PlugViewProxy::ConstructArgs>(
|
||||||
|
object_instances[request.instance_id]
|
||||||
|
.plug_view,
|
||||||
|
request.instance_id)
|
||||||
|
: std::nullopt)};
|
||||||
|
},
|
||||||
[&](YaPluginBase::Initialize& request)
|
[&](YaPluginBase::Initialize& request)
|
||||||
-> YaPluginBase::Initialize::Response {
|
-> YaPluginBase::Initialize::Response {
|
||||||
// If we got passed a host context, we'll create a proxy object
|
// If we got passed a host context, we'll create a proxy object
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ struct InstanceInterfaces {
|
|||||||
*/
|
*/
|
||||||
Steinberg::IPtr<Steinberg::FUnknown> object;
|
Steinberg::IPtr<Steinberg::FUnknown> object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `IPlugView` object the plugin returned from a call to
|
||||||
|
* `IEditController::createView()`.
|
||||||
|
*
|
||||||
|
* XXX: Technically VST3 supports multiple named views, so we could have
|
||||||
|
* multiple different view for a single plugin. This is not used within
|
||||||
|
* the SDK, so a single pointer should be fine for now.
|
||||||
|
*/
|
||||||
|
Steinberg::IPtr<Steinberg::IPlugView> plug_view;
|
||||||
|
|
||||||
// All smart pointers below are created from `component`. They will be null
|
// All smart pointers below are created from `component`. They will be null
|
||||||
// pointers if `component` did not implement the interface.
|
// pointers if `component` did not implement the interface.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user