mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Implement IPlugView::getSize()
This commit is contained in:
@@ -461,6 +461,13 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Vst3Logger::log_request(bool is_host_vst,
|
||||||
|
const YaPlugView::GetSize& request) {
|
||||||
|
return log_request_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << request.owner_instance_id << ": IPlugView::getSize(size*)";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@@ -725,6 +732,19 @@ void Vst3Logger::log_response(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_response(bool is_host_vst,
|
||||||
|
const YaPlugView::GetSizeResponse& response) {
|
||||||
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << response.result.string();
|
||||||
|
if (response.result == Steinberg::kResultOk) {
|
||||||
|
message << ", <ViewRect* with left = " << response.updated_size.left
|
||||||
|
<< ", top = " << response.updated_size.top
|
||||||
|
<< ", right = " << response.updated_size.right
|
||||||
|
<< ", bottom = " << response.updated_size.bottom << ">";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Vst3Logger::log_response(bool is_host_vst,
|
void Vst3Logger::log_response(bool is_host_vst,
|
||||||
const YaPluginFactory::ConstructArgs& args) {
|
const YaPluginFactory::ConstructArgs& args) {
|
||||||
log_response_base(is_host_vst, [&](auto& message) {
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ class Vst3Logger {
|
|||||||
bool log_request(bool is_host_vst,
|
bool log_request(bool is_host_vst,
|
||||||
const YaPlugView::IsPlatformTypeSupported&);
|
const YaPlugView::IsPlatformTypeSupported&);
|
||||||
bool log_request(bool is_host_vst, const YaPlugView::Attached&);
|
bool log_request(bool is_host_vst, const YaPlugView::Attached&);
|
||||||
|
bool log_request(bool is_host_vst, const YaPlugView::GetSize&);
|
||||||
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&);
|
||||||
@@ -147,6 +148,7 @@ class Vst3Logger {
|
|||||||
const YaEditController::GetParamValueByStringResponse&);
|
const YaEditController::GetParamValueByStringResponse&);
|
||||||
void log_response(bool is_host_vst,
|
void log_response(bool is_host_vst,
|
||||||
const YaEditController::CreateViewResponse&);
|
const YaEditController::CreateViewResponse&);
|
||||||
|
void log_response(bool is_host_vst, const YaPlugView::GetSizeResponse&);
|
||||||
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&);
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
|||||||
YaEditController::CreateView,
|
YaEditController::CreateView,
|
||||||
YaPlugView::IsPlatformTypeSupported,
|
YaPlugView::IsPlatformTypeSupported,
|
||||||
YaPlugView::Attached,
|
YaPlugView::Attached,
|
||||||
|
YaPlugView::GetSize,
|
||||||
YaPluginBase::Initialize,
|
YaPluginBase::Initialize,
|
||||||
YaPluginBase::Terminate,
|
YaPluginBase::Terminate,
|
||||||
YaPluginFactory::Construct,
|
YaPluginFactory::Construct,
|
||||||
|
|||||||
@@ -120,6 +120,39 @@ class YaPlugView : public Steinberg::IPlugView {
|
|||||||
virtual tresult PLUGIN_API onKeyUp(char16 key,
|
virtual tresult PLUGIN_API onKeyUp(char16 key,
|
||||||
int16 keyCode,
|
int16 keyCode,
|
||||||
int16 modifiers) override = 0;
|
int16 modifiers) override = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The response code and editor size returned by a call to
|
||||||
|
* `IPlugView::getSize(&size)`.
|
||||||
|
*/
|
||||||
|
struct GetSizeResponse {
|
||||||
|
UniversalTResult result;
|
||||||
|
Steinberg::ViewRect updated_size;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.object(result);
|
||||||
|
s.object(updated_size);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message to pass through a call to `IPlugView::getSize(&size)`.
|
||||||
|
*/
|
||||||
|
struct GetSize {
|
||||||
|
using Response = GetSizeResponse;
|
||||||
|
|
||||||
|
native_size_t owner_instance_id;
|
||||||
|
|
||||||
|
Steinberg::ViewRect size;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(owner_instance_id);
|
||||||
|
s.object(size);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
virtual tresult PLUGIN_API getSize(Steinberg::ViewRect* size) override = 0;
|
virtual tresult PLUGIN_API getSize(Steinberg::ViewRect* size) override = 0;
|
||||||
virtual tresult PLUGIN_API
|
virtual tresult PLUGIN_API
|
||||||
onSize(Steinberg::ViewRect* newSize) override = 0;
|
onSize(Steinberg::ViewRect* newSize) override = 0;
|
||||||
@@ -135,3 +168,13 @@ class YaPlugView : public Steinberg::IPlugView {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
namespace Steinberg {
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s, ViewRect& rect) {
|
||||||
|
s.value4b(rect.left);
|
||||||
|
s.value4b(rect.top);
|
||||||
|
s.value4b(rect.right);
|
||||||
|
s.value4b(rect.bottom);
|
||||||
|
}
|
||||||
|
} // namespace Steinberg
|
||||||
|
|||||||
@@ -87,9 +87,19 @@ tresult PLUGIN_API Vst3PlugViewProxyImpl::onKeyUp(char16 key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API Vst3PlugViewProxyImpl::getSize(Steinberg::ViewRect* size) {
|
tresult PLUGIN_API Vst3PlugViewProxyImpl::getSize(Steinberg::ViewRect* size) {
|
||||||
// TODO: Implement
|
if (size) {
|
||||||
bridge.logger.log("TODO: IPlugView::getSize()");
|
const GetSizeResponse response =
|
||||||
return Steinberg::kNotImplemented;
|
bridge.send_message(YaPlugView::GetSize{
|
||||||
|
.owner_instance_id = owner_instance_id(), .size = *size});
|
||||||
|
|
||||||
|
*size = response.updated_size;
|
||||||
|
|
||||||
|
return response.result;
|
||||||
|
} else {
|
||||||
|
bridge.logger.log(
|
||||||
|
"WARNING: Null pointer passed to 'IPlugView::getSize()'");
|
||||||
|
return Steinberg::kInvalidArgument;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API Vst3PlugViewProxyImpl::onSize(Steinberg::ViewRect* newSize) {
|
tresult PLUGIN_API Vst3PlugViewProxyImpl::onSize(Steinberg::ViewRect* newSize) {
|
||||||
|
|||||||
@@ -446,6 +446,14 @@ void Vst3Bridge::run() {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
[&](YaPlugView::GetSize& request) -> YaPlugView::GetSize::Response {
|
||||||
|
const tresult result =
|
||||||
|
object_instances[request.owner_instance_id]
|
||||||
|
.plug_view->getSize(&request.size);
|
||||||
|
|
||||||
|
return YaPlugView::GetSizeResponse{
|
||||||
|
.result = result, .updated_size = request.size};
|
||||||
|
},
|
||||||
[&](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
|
||||||
|
|||||||
Reference in New Issue
Block a user