8#include "plugins/plugin_protocol.h"
9#include "utils/icloneable.h"
10#include "utils/utf8_string.h"
14#include <boost/describe.hpp>
15#include <juce_audio_processors_headless/juce_audio_processors_headless.h>
16#include <nlohmann/json_fwd.hpp>
18namespace zrythm::plugins
20using namespace std::string_view_literals;
25enum class PluginCategory : std::uint8_t
73enum class PluginArchitecture : std::uint8_t
82enum class BridgeMode : std::uint8_t
112 Q_PROPERTY (QString name READ name CONSTANT FINAL)
113 Q_PROPERTY (QString vendor READ vendor CONSTANT FINAL)
114 Q_PROPERTY (QString format READ format CONSTANT FINAL)
115 Q_PROPERTY (QString category READ category CONSTANT FINAL)
119 static std::unique_ptr<PluginDescriptor>
120 from_juce_description (
const juce::PluginDescription &juce_desc);
122 std::unique_ptr<juce::PluginDescription> to_juce_description ()
const;
131 [[nodiscard]] QString name ()
const {
return name_.to_qstring (); }
132 QString format ()
const;
133 QString vendor ()
const;
134 QString category ()
const;
143 Q_INVOKABLE
bool isInstrument ()
const;
144 Q_INVOKABLE
bool isEffect ()
const;
145 Q_INVOKABLE
bool isModulator ()
const;
146 Q_INVOKABLE
bool isMidiModifier ()
const;
173 friend void init_from (
179 static constexpr auto kAuthorKey =
"author"sv;
180 static constexpr auto kNameKey =
"name"sv;
181 static constexpr auto kWebsiteKey =
"website"sv;
182 static constexpr auto kCategoryKey =
"category"sv;
183 static constexpr auto kCategoryStringKey =
"categoryString"sv;
184 static constexpr auto kNumAudioInsKey =
"numAudioIns"sv;
185 static constexpr auto kNumAudioOutsKey =
"numAudioOuts"sv;
186 static constexpr auto kNumMidiInsKey =
"numMidiIns"sv;
187 static constexpr auto kNumMidiOutsKey =
"numMidiOuts"sv;
188 static constexpr auto kNumCtrlInsKey =
"numCtrlIns"sv;
189 static constexpr auto kNumCtrlOutsKey =
"numCtrlOuts"sv;
190 static constexpr auto kNumCvInsKey =
"numCvIns"sv;
191 static constexpr auto kNumCvOutsKey =
"numCvOuts"sv;
192 static constexpr auto kUniqueIdKey =
"uniqueId"sv;
193 static constexpr auto kDeprecatedUniqueIdKey =
"deprecatedUniqueId"sv;
194 static constexpr auto kArchitectureKey =
"architecture"sv;
195 static constexpr auto kProtocolKey =
"protocol"sv;
196 static constexpr auto kPathOrIdKey =
"pathOrId"sv;
197 static constexpr auto kMinBridgeModeKey =
"minBridgeMode"sv;
198 static constexpr auto kHasCustomUIKey =
"hasCustomUI"sv;
204 constexpr auto tie = [] (
const auto &p) {
206 p.arch_, p.protocol_, p.path_or_id_, p.unique_id_,
207 p.juce_compat_deprecated_unique_id_, p.min_bridge_mode_,
210 return tie (a) == tie (b);
217 PluginCategory category_ = PluginCategory::None;
237 PluginArchitecture
arch_ = PluginArchitecture::ARCH_64_BIT;
245 std::variant<std::filesystem::path, utils::Utf8String>
path_or_id_;
256 bool has_custom_ui_{};
258 BOOST_DESCRIBE_CLASS (
283template <>
struct hash<zrythm::plugins::PluginDescriptor>
289 h = h ^ qHash (d.
arch_);
290 if (std::holds_alternative<std::filesystem::path> (d.
path_or_id_))
293 h ^ qHash (std::get<std::filesystem::path> (d.
path_or_id_).string ());
298 h ^ qHash (std::get<zrythm::utils::Utf8String> (d.
path_or_id_).str ());
The PluginDescriptor class provides a set of static utility functions and member functions to work wi...
int num_midi_ins_
Number of MIDI input ports.
int num_ctrl_outs_
Number of output control (plugin param) ports.
int juce_compat_deprecated_unique_id_
This is additionally needed by JUCE for some plugin formats.
Protocol::ProtocolType protocol_
Plugin protocol (Lv2/DSSI/LADSPA/VST/etc.).
int64_t unique_id_
Used by some plugin formats to uniquely identify the plugin.
bool has_custom_ui() const
Returns if the Plugin has a supported custom UI.
PluginArchitecture arch_
Architecture (32/64bit).
bool is_same_plugin(const PluginDescriptor &other) const
Returns whether the two descriptors describe the same plugin, ignoring irrelevant fields.
BridgeMode min_bridge_mode_
Minimum required bridge mode.
BridgeMode get_min_bridge_mode() const
Returns the minimum bridge mode required for this plugin.
int num_midi_outs_
Number of MIDI output ports.
int num_audio_ins_
Number of audio input ports.
int num_ctrl_ins_
Number of input control (plugin param) ports.
int num_cv_outs_
Number of output CV ports.
std::variant< std::filesystem::path, utils::Utf8String > path_or_id_
Identifier, for plugin formats that use unique identifiers, or path otherwise.
Q_INVOKABLE QString serializeToString() const
Serializes the descriptor to a string.
int num_audio_outs_
Number of audio output ports.
int num_cv_ins_
Number of input CV ports.
utils::Utf8String category_str_
Lv2 plugin subcategory.
utils::Utf8String get_icon_name() const
Gets an appropriate icon name.
ProtocolType
Plugin protocol.
@ Internal
Dummy protocol for tests.
Lightweight UTF-8 string wrapper with safe conversions.