From 9b5c6f16663a1abd1fb356d993d4671eaa941285 Mon Sep 17 00:00:00 2001 From: Nanako <469449812@qq.com> Date: Tue, 30 Jul 2024 20:55:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BD=E6=95=B0=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/audio/plugin_host/plugin_host.h | 7 +++++-- core/audio/plugin_host/vst2/vst2_plugin_host.cpp | 2 +- core/audio/plugin_host/vst2/vst2_plugin_host.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/audio/plugin_host/plugin_host.h b/core/audio/plugin_host/plugin_host.h index 31dd821..6aff088 100644 --- a/core/audio/plugin_host/plugin_host.h +++ b/core/audio/plugin_host/plugin_host.h @@ -41,7 +41,7 @@ public: [[nodiscard]] uint64_t get_uid() const { return id; } [[nodiscard]] plugin_host_type get_type() const { return type_; } - virtual bool load_plugin(const char* path) = 0; + virtual bool load(const char* path) = 0; virtual void set_enabled(bool enabled) = 0; @@ -100,6 +100,8 @@ public: virtual float get_param_max_value(int32_t index) { return 1.0f; } void init_channel_interface(); + [[nodiscard]] auto is_loading() const -> bool { return loading_; } + void over_loading() { loading_ = false; } std::string name; std::string vendor; @@ -122,8 +124,9 @@ protected: virtual void on_close_editor() = 0; private: - bool editor_opened = false; const uint64_t id = 0; plugin_host_type type_; int32_t user_latency_ = 0; + bool editor_opened = false; + std::atomic loading_ = true; }; diff --git a/core/audio/plugin_host/vst2/vst2_plugin_host.cpp b/core/audio/plugin_host/vst2/vst2_plugin_host.cpp index a61ac0e..979bad9 100644 --- a/core/audio/plugin_host/vst2/vst2_plugin_host.cpp +++ b/core/audio/plugin_host/vst2/vst2_plugin_host.cpp @@ -172,7 +172,7 @@ vst2_plugin_host::~vst2_plugin_host() { effect_ = nullptr; } -bool vst2_plugin_host::load_plugin(const char* path) { +bool vst2_plugin_host::load(const char* path) { // load vst library_ = get_vst2_library(path); // get main function diff --git a/core/audio/plugin_host/vst2/vst2_plugin_host.h b/core/audio/plugin_host/vst2/vst2_plugin_host.h index f217571..bdad33b 100644 --- a/core/audio/plugin_host/vst2/vst2_plugin_host.h +++ b/core/audio/plugin_host/vst2/vst2_plugin_host.h @@ -44,7 +44,7 @@ public: static constexpr auto type = plugin_host_type::vst2; vst2_plugin_host(); ~vst2_plugin_host() override; - bool load_plugin(const char* path) override; + bool load(const char* path) override; void set_enabled(bool enabled) override; [[nodiscard]] bool is_enabled() const override;