Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
plugin_configuration.h
1// SPDX-FileCopyrightText: © 2021-2022, 2024-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "plugins/plugin_descriptor.h"
7
8#include <nlohmann/json_fwd.hpp>
9
10namespace zrythm::plugins
11{
12
18class PluginConfiguration : public QObject
19{
20 Q_OBJECT
21 Q_PROPERTY (
22 zrythm::plugins::PluginDescriptor * descriptor READ descriptor CONSTANT)
23 QML_ELEMENT
24 QML_UNCREATABLE ("")
25
26public:
27 PluginConfiguration (QObject * parent = nullptr) : QObject (parent) { };
28
29 // ============================================================================
30 // QML Interface
31 // ============================================================================
32
33 PluginDescriptor * descriptor () const { return descr_.get (); }
34
35 // ============================================================================
36
41 static std::unique_ptr<PluginConfiguration>
44 enum class HostingType : std::uint8_t
45 {
49 JUCE,
50
56 Custom
57 };
58
59public:
64 void validate ();
65
66 void print () const;
67
68 friend void init_from (
69 PluginConfiguration &obj,
70 const PluginConfiguration &other,
71 utils::ObjectCloneType clone_type);
72
73 zrythm::plugins::PluginDescriptor * get_descriptor () const
74 {
75 return descr_.get ();
76 }
77
78 auto get_name () const { return get_descriptor ()->name_; }
79
80 void copy_fields_from (const PluginConfiguration &other);
81
82private:
83 static constexpr auto kDescriptorKey = "descriptor"sv;
84 static constexpr auto kForceGenericUIKey = "forceGenericUI"sv;
85 static constexpr auto kBridgeModeKey = "bridgeMode"sv;
86 friend void to_json (nlohmann::json &j, const PluginConfiguration &p);
87 friend void from_json (const nlohmann::json &j, PluginConfiguration &p);
88
89public:
91 std::unique_ptr<zrythm::plugins::PluginDescriptor> descr_;
92
93 HostingType hosting_type_{ HostingType::JUCE };
94
96 bool force_generic_ui_{};
97
99 zrythm::plugins::BridgeMode bridge_mode_{};
100
101 BOOST_DESCRIBE_CLASS (
103 (),
104 (descr_, hosting_type_, force_generic_ui_, bridge_mode_),
105 (),
106 ())
107};
108
109}
Configuration for instantiating a plugin descriptor.
zrythm::plugins::BridgeMode bridge_mode_
Requested carla bridge mode.
static std::unique_ptr< PluginConfiguration > create_new_for_descriptor(const zrythm::plugins::PluginDescriptor &descr)
Creates a plugin setting with the recommended settings for the given plugin descriptor based on the c...
std::unique_ptr< zrythm::plugins::PluginDescriptor > descr_
The descriptor of the plugin this setting is for.
@ Custom
Plugin hosted via custom plugin format implementation.
bool force_generic_ui_
Whether to force a generic UI.
void validate()
Makes sure the setting is valid in the current run and changes any fields to make it conform.
The PluginDescriptor class provides a set of static utility functions and member functions to work wi...