clap

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

commit be6c160f554cac2263b78751cc472592f9e62321
parent 16a4acec0444267e2bd883cc0608d99053712676
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sun,  1 Aug 2021 18:26:21 +0200

Spawn the gui process

Diffstat:
Mexamples/plugins/plugin-helper.cc | 22+++++++++++++++++-----
Mexamples/plugins/plugin-helper.hh | 3++-
Mexamples/plugins/remote-gui.cc | 5+++--
3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/examples/plugins/plugin-helper.cc b/examples/plugins/plugin-helper.cc @@ -80,6 +80,23 @@ namespace clap { return true; } + bool PluginHelper::guiCreate() noexcept { + remoteGui_.reset(new RemoteGui(*this)); + + if (!remoteGui_->spawn()) + { + remoteGui_.reset(); + return false; + } + + return true; + } + + void PluginHelper::guiDestroy() noexcept { + if (remoteGui_) + remoteGui_->destroy(); + } + bool PluginHelper::guiSize(uint32_t *width, uint32_t *height) noexcept { if (!remoteGui_) return false; @@ -101,9 +118,4 @@ namespace clap { if (remoteGui_) remoteGui_->hide(); } - - void PluginHelper::guiDestroy() noexcept { - if (remoteGui_) - remoteGui_->destroy(); - } } // namespace clap \ No newline at end of file diff --git a/examples/plugins/plugin-helper.hh b/examples/plugins/plugin-helper.hh @@ -79,6 +79,8 @@ namespace clap { // clap_plugin_gui // //-----------------// bool implementsGui() const noexcept override { return true; } + bool guiCreate() noexcept override; + void guiDestroy() noexcept override; bool guiCanResize() const noexcept override { return false; } bool guiSize(uint32_t *width, uint32_t *height) noexcept override; void guiRoundSize(uint32_t *width, uint32_t *height) noexcept override { @@ -87,7 +89,6 @@ namespace clap { void guiSetScale(double scale) noexcept override; void guiShow() noexcept override; void guiHide() noexcept override; - void guiDestroy() noexcept override; //---------------------// // clap_plugin_gui_x11 // diff --git a/examples/plugins/remote-gui.cc b/examples/plugins/remote-gui.cc @@ -6,7 +6,8 @@ #include <cassert> #include "remote-gui.hh" -#include <messages.hh> +#include "path-provider.hh" +#include "../io/messages.hh" namespace clap { @@ -34,7 +35,7 @@ namespace clap { ::close(sockets[0]); char socketStr[16]; ::snprintf(socketStr, sizeof(socketStr), "%d", sockets[1]); - ::execl("clap-gui", "--socket", socketStr); + ::execl(PathProvider::instance()->getGuiExecutable().c_str(), "--socket", socketStr); std::terminate(); } else { // Parent