clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 052bd460e656de978a8be2f39419408a030ea2e9
parent 453be48122938cf131ded00c5e16c888e73d86ab
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sun,  1 Aug 2021 14:00:26 +0200

More work

Diffstat:
Mexamples/io/messages.hh | 32+++++++++++++++++++++++++++++---
Mexamples/plugins/remote-gui.cc | 29+++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/examples/io/messages.hh b/examples/io/messages.hh @@ -1,5 +1,7 @@ #include <stdint.h> +#include <clap/all.h> + namespace clap::messages { enum Type : uint32_t { @@ -23,7 +25,12 @@ namespace clap::messages { kShowResponse, kHideRequest, kHideResponse, - kCloseRequest, + kDestroyRequest, + kDestroyResponse, + kAttachWin32Request, + kAttachCocoaRequest, + kAttachX11Request, + kAttachResponse, // Gui, Plugin->Host kResizeRequest, @@ -83,8 +90,12 @@ namespace clap::messages { static const constexpr Type type = kHideResponse; }; - struct CloseRequest final { - static const constexpr Type type = kCloseRequest; + struct DestroyRequest final { + static const constexpr Type type = kDestroyRequest; + }; + + struct DestroyResponse final { + static const constexpr Type type = kDestroyResponse; }; struct ResizeRequest final { @@ -96,4 +107,19 @@ namespace clap::messages { struct ResizeResponse final { static const constexpr Type type = kResizeResponse; }; + + struct AttachWin32Request final { + static const constexpr Type type = kAttachWin32Request; + clap_hwnd hwnd; + }; + + struct AttachX11Request final { + static const constexpr Type type = kAttachX11Request; + unsigned long window; + char display[128]; + }; + + struct AttachResponse final { + static const constexpr Type type = kAttachResponse; + }; } // namespace clap::messages \ No newline at end of file diff --git a/examples/plugins/remote-gui.cc b/examples/plugins/remote-gui.cc @@ -80,4 +80,33 @@ namespace clap { return channel_->sendMessageSync(request, response); } + void RemoteGui::destroy() noexcept { + messages::DestroyRequest request; + messages::DestroyResponse response; + + channel_->sendMessageSync(request, response); + } + + bool RemoteGui::attachCocoa(void *nsView) noexcept { + // TODO + return false; + } + + bool RemoteGui::attachWin32(clap_hwnd window) noexcept { + messages::AttachWin32Request request{window}; + messages::AttachResponse response; + + return channel_->sendMessageSync(request, response); + } + + bool RemoteGui::attachX11(const char *display_name, unsigned long window) noexcept { + messages::AttachX11Request request; + messages::AttachResponse response; + + request.window = window; + std::snprintf(request.display, sizeof (request.display), "%s", display_name); + + return channel_->sendMessageSync(request, response); + } + } // namespace clap \ No newline at end of file