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;
127 void release_resources_impl ()
override;
130 void paramsChanged ();
131 void paramAdjusted (clap_id paramId);
132 void pluginLoadedChanged (
bool pluginLoaded);
138 void on_configuration_changed (
140 bool generateNewPluginPortsAndParams);
145 void on_ui_visibility_changed ();
158 const std::filesystem::path &path,
159 int64_t plugin_unique_id,
160 bool generate_new_ports =
true);
161 void unload_current_plugin ();
163 void create_ports_from_clap_plugin ();
168 static constexpr auto kStateKey =
"state"sv;
169 friend void to_json (nlohmann::json &j,
const ClapPlugin &p);
170 friend void from_json (
const nlohmann::json &j,
ClapPlugin &p);
175 QByteArray save_state_to_byte_array ()
const;
177 std::string save_state_impl ()
const override;
178 void load_state_impl (
const std::string &base64_state)
override;
183 void apply_state_from_byte_array (
const QByteArray &data);
186 class ClapPluginImpl;
187 std::unique_ptr<ClapPluginImpl> pimpl_;
190 std::optional<QByteArray> state_to_apply_;
201 std::unordered_map<dsp::ProcessorParameter *, clap_id> zrythm_to_clap_;