mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Implement the host side of the GUI functions
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
ClapHostExtensions::ClapHostExtensions(const clap_host& host) noexcept
|
||||
: audio_ports(static_cast<const clap_host_audio_ports_t*>(
|
||||
host.get_extension(&host, CLAP_EXT_AUDIO_PORTS))),
|
||||
gui(static_cast<const clap_host_gui_t*>(
|
||||
host.get_extension(&host, CLAP_EXT_GUI))),
|
||||
latency(static_cast<const clap_host_latency_t*>(
|
||||
host.get_extension(&host, CLAP_EXT_LATENCY))),
|
||||
note_ports(static_cast<const clap_host_note_ports_t*>(
|
||||
@@ -38,6 +40,7 @@ clap::host::SupportedHostExtensions ClapHostExtensions::supported()
|
||||
const noexcept {
|
||||
return clap::host::SupportedHostExtensions{
|
||||
.supports_audio_ports = audio_ports != nullptr,
|
||||
.supports_gui = gui != nullptr,
|
||||
.supports_latency = latency != nullptr,
|
||||
.supports_note_ports = note_ports != nullptr,
|
||||
.supports_params = params != nullptr,
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <clap/ext/audio-ports.h>
|
||||
#include <clap/ext/gui.h>
|
||||
#include <clap/ext/latency.h>
|
||||
#include <clap/ext/note-ports.h>
|
||||
#include <clap/ext/params.h>
|
||||
@@ -62,6 +63,7 @@ struct ClapHostExtensions {
|
||||
clap::host::SupportedHostExtensions supported() const noexcept;
|
||||
|
||||
const clap_host_audio_ports_t* audio_ports = nullptr;
|
||||
const clap_host_gui_t* gui = nullptr;
|
||||
const clap_host_latency_t* latency = nullptr;
|
||||
const clap_host_note_ports_t* note_ports = nullptr;
|
||||
const clap_host_params_t* params = nullptr;
|
||||
|
||||
@@ -115,6 +115,55 @@ ClapPluginBridge::ClapPluginBridge(const ghc::filesystem::path& plugin_path)
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](const clap::ext::gui::host::ResizeHintsChanged& request)
|
||||
-> clap::ext::gui::host::ResizeHintsChanged::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
// This callback is thread-safe
|
||||
plugin_proxy.host_extensions_.gui->resize_hints_changed(
|
||||
plugin_proxy.host_);
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](const clap::ext::gui::host::RequestResize& request)
|
||||
-> clap::ext::gui::host::RequestResize::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
// This callback is thread-safe
|
||||
return plugin_proxy.host_extensions_.gui->request_resize(
|
||||
plugin_proxy.host_, request.width, request.height);
|
||||
},
|
||||
[&](const clap::ext::gui::host::RequestShow& request)
|
||||
-> clap::ext::gui::host::RequestShow::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
// This callback is thread-safe
|
||||
return plugin_proxy.host_extensions_.gui->request_show(
|
||||
plugin_proxy.host_);
|
||||
},
|
||||
[&](const clap::ext::gui::host::RequestHide& request)
|
||||
-> clap::ext::gui::host::RequestHide::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
// This callback is thread-safe
|
||||
return plugin_proxy.host_extensions_.gui->request_hide(
|
||||
plugin_proxy.host_);
|
||||
},
|
||||
[&](const clap::ext::gui::host::Closed& request)
|
||||
-> clap::ext::gui::host::Closed::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
// This callback is thread-safe
|
||||
plugin_proxy.host_extensions_.gui->closed(
|
||||
plugin_proxy.host_, request.was_destroyed);
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](const clap::ext::latency::host::Changed& request)
|
||||
-> clap::ext::latency::host::Changed::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
|
||||
Reference in New Issue
Block a user