clap

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

commit 5d4ca82e5c9157e89964e697aba16cd4b59ed09e
parent 7453c94d7b95a40e434dfd725c1d3b128bc5ff29
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Sun, 17 Oct 2021 15:06:57 +0200

More work

Diffstat:
Mexamples/glue/clap-plugin.cc | 12++++++++++++
Mexamples/glue/clap-plugin.hh | 2++
Mexamples/host/plugin-host.cc | 10++++++++++
Mexamples/host/plugin-host.hh | 7+++++--
4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/examples/glue/clap-plugin.cc b/examples/glue/clap-plugin.cc @@ -234,6 +234,7 @@ namespace clap { initInterface(_hostTrackInfo, CLAP_EXT_TRACK_INFO); initInterface(_hostState, CLAP_EXT_STATE); initInterface(_hostNoteName, CLAP_EXT_NOTE_NAME); + initInterface(_hostQuickControls, CLAP_EXT_QUICK_CONTROLS); } //-------------------// @@ -931,6 +932,17 @@ namespace clap { return false; } + bool Plugin::canUseQuickControls() const noexcept { + if (!_hostQuickControls) + return false; + + if (_hostQuickControls->changed) + return true; + + hostMisbehaving("clap_host_quick_controls is partially implemented"); + return false; + } + bool Plugin::canUseState() const noexcept { if (!_hostState) return false; diff --git a/examples/glue/clap-plugin.hh b/examples/glue/clap-plugin.hh @@ -209,6 +209,7 @@ namespace clap { bool canUseFdSupport() const noexcept; bool canUseParams() const noexcept; bool canUseLatency() const noexcept; + bool canUseQuickControls() const noexcept; ///////////////////// // Thread Checking // @@ -258,6 +259,7 @@ namespace clap { const clap_host_track_info *_hostTrackInfo = nullptr; const clap_host_state *_hostState = nullptr; const clap_host_note_name *_hostNoteName = nullptr; + const clap_host_quick_controls *_hostQuickControls = nullptr; private: ///////////////////// diff --git a/examples/host/plugin-host.cc b/examples/host/plugin-host.cc @@ -994,6 +994,16 @@ void PluginHost::clapParamsRescan(const clap_host *host, uint32_t flags) { h->paramsChanged(); } +void PluginHost::clapParamsClear(const clap_host *host, clap_id param_id, clap_param_clear_flags flags) +{ + checkForMainThread(); +} + +void PluginHost::clapParamsRequestFlush(const clap_host *host) +{ + // Nothing to do we always flush and always process +} + double PluginHost::getParamValue(const clap_param_info &info) { checkForMainThread(); double value; diff --git a/examples/host/plugin-host.hh b/examples/host/plugin-host.hh @@ -93,8 +93,9 @@ private: static bool clapIsMainThread(const clap_host *host); static bool clapIsAudioThread(const clap_host *host); - static void clapParamsRescan(const clap_host *host, uint32_t flags); - static void clapParamsClear(const clap_host *host, uint32_t flags); + static void clapParamsRescan(const clap_host *host, clap_param_rescan_flags flags); + static void clapParamsClear(const clap_host *host, clap_id param_id, clap_param_clear_flags flags); + static void clapParamsRequestFlush(const clap_host *host); void scanParams(); void scanParam(int32_t index); PluginParam &checkValidParamId(const std::string_view &function, @@ -148,6 +149,8 @@ private: // static const constexpr clap_host_audio_ports_config hostAudioPortsConfig_; static const constexpr clap_host_params _hostParams = { PluginHost::clapParamsRescan, + PluginHost::clapParamsClear, + PluginHost::clapParamsRequestFlush, }; static const constexpr clap_host_quick_controls _hostQuickControls = { PluginHost::clapQuickControlsChanged,