41 PluginHostWindowFactory host_window_factory,
42 QObject * parent =
nullptr);
47 void requestRestart () noexcept override;
48 void requestProcess () noexcept override;
49 void requestCallback () noexcept override;
52 bool implementsGui () const noexcept
override {
return true; }
53 void guiResizeHintsChanged () noexcept override;
54 bool guiRequestResize (uint32_t width, uint32_t height) noexcept override;
55 bool guiRequestShow () noexcept override;
56 bool guiRequestHide () noexcept override;
57 void guiClosed (
bool wasDestroyed) noexcept override;
60 bool implementsTimerSupport () const noexcept
override {
return true; }
61 bool timerSupportRegisterTimer (uint32_t periodMs, clap_id * timerId)
noexcept
63 bool timerSupportUnregisterTimer (clap_id timerId)
noexcept override;
66 bool implementsLog () const noexcept
override {
return true; }
67 void logLog (clap_log_severity severity,
const char * message)
68 const noexcept override;
71 bool implementsLatency () const noexcept
override {
return false; }
72 void latencyChanged () noexcept override;
75 bool threadCheckIsMainThread () const noexcept override;
76 bool threadCheckIsAudioThread () const noexcept override;
79 bool implementsParams () const noexcept
override {
return true; }
80 void paramsRescan (clap_param_rescan_flags flags)
noexcept override;
82 paramsClear (clap_id paramId, clap_param_clear_flags flags)
noexcept override;
83 void paramsRequestFlush () noexcept override;
86 bool implementsPosixFdSupport () const noexcept
override {
return true; }
87 bool posixFdSupportRegisterFd (
int fd, clap_posix_fd_flags_t flags)
noexcept
90 posixFdSupportModifyFd (
int fd, clap_posix_fd_flags_t flags)
noexcept override;
91 bool posixFdSupportUnregisterFd (
int fd)
noexcept override;
94 bool implementsThreadPool () const noexcept
override {
return true; }
95 bool threadPoolRequestExec (uint32_t numTasks)
noexcept override;
98 bool implementsState () const noexcept
override {
return true; }
99 void stateMarkDirty () noexcept override;
102 bool implementsPresetLoad () const noexcept
override {
return true; }
103 void presetLoadLoaded (
104 uint32_t locationKind,
105 const char * location,
106 const char * loadKey)
noexcept override;
107 void presetLoadOnError (
108 uint32_t locationKind,
109 const char * location,
110 const char * loadKey,
112 const char * msg)
noexcept override;
121 void prepare_for_processing_impl (
122 units::sample_rate_t sample_rate,
123 units::sample_u32_t max_block_length)
override;
128 void release_resources_impl ()
override;
131 void paramsChanged ();
132 void paramAdjusted (clap_id paramId);
133 void pluginLoadedChanged (
bool pluginLoaded);
139 void on_configuration_changed (
141 bool generateNewPluginPortsAndParams);
146 void on_ui_visibility_changed ();
159 const std::filesystem::path &path,
160 int64_t plugin_unique_id,
161 bool generate_new_ports =
true);
162 void unload_current_plugin ();
164 void create_ports_from_clap_plugin ();
169 static constexpr auto kStateKey =
"state"sv;
170 friend void to_json (nlohmann::json &j,
const ClapPlugin &p);
171 friend void from_json (
const nlohmann::json &j,
ClapPlugin &p);
176 QByteArray save_state_to_byte_array ()
const;
178 std::string save_state_impl ()
const override;
179 void load_state_impl (
const std::string &base64_state)
override;
184 void apply_state_from_byte_array (
const QByteArray &data);
187 class ClapPluginImpl;
188 std::unique_ptr<ClapPluginImpl> pimpl_;
191 std::optional<QByteArray> state_to_apply_;
202 std::unordered_map<dsp::ProcessorParameter *, clap_id> zrythm_to_clap_;