commit 7453c94d7b95a40e434dfd725c1d3b128bc5ff29 parent 9e6163ab46fa23bc50ae8461a16b54b586673401 Author: Alexandre BIQUE <bique.alexandre@gmail.com> Date: Sat, 16 Oct 2021 22:25:58 +0200 Add some more check methods to the glue layer Diffstat:
M | examples/glue/clap-plugin.cc | | | 15 | +++++++++++++++ |
M | examples/glue/clap-plugin.hh | | | 2 | ++ |
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/examples/glue/clap-plugin.cc b/examples/glue/clap-plugin.cc @@ -965,6 +965,21 @@ namespace clap { std::terminate(); } + void Plugin::checkAudioThread() const noexcept { + if (!_hostThreadCheck || !_hostThreadCheck->is_audio_thread || + _hostThreadCheck->is_audio_thread(_host)) + return; + + std::terminate(); + } + + void Plugin::checkParamThread() const noexcept { + if (isActive()) + checkAudioThread(); + else + checkMainThread(); + } + void Plugin::ensureMainThread(const char *method) const noexcept { if (!_hostThreadCheck || !_hostThreadCheck->is_main_thread || _hostThreadCheck->is_main_thread(_host)) diff --git a/examples/glue/clap-plugin.hh b/examples/glue/clap-plugin.hh @@ -214,6 +214,8 @@ namespace clap { // Thread Checking // ///////////////////// void checkMainThread() const noexcept; + void checkAudioThread() const noexcept; + void checkParamThread() const noexcept; void ensureMainThread(const char *method) const noexcept; void ensureAudioThread(const char *method) const noexcept;