Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
clapplugin.hh
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#ifndef __ASE_CLAP_PLUGIN_HH__
3#define __ASE_CLAP_PLUGIN_HH__
4
5#include <ase/device.hh>
6#include <clap/clap.h>
7
8namespace Ase {
9
10class ClapFileHandle;
11class ClapAudioProcessor;
12
13// == ClapPluginDescriptor ==
15 ClapFileHandle &clapfile_;
16public:
18 std::string id, name, version, vendor, features;
19 std::string description, url, manual_url, support_url;
20 explicit ClapPluginDescriptor (ClapFileHandle &clapfile);
21 void open () const;
22 void close () const;
23 const clap_plugin_entry* entry () const;
24 ClapFileHandle& file_handle () const { return clapfile_; }
25 static void add_descriptor (const String &pluginpath, Collection &infos);
26 static const Collection& collect_descriptors ();
27};
28
29// == ClapParamUpdate ==
31 int64_t steady_time = 0; // unimplemented
32 clap_id param_id = CLAP_INVALID_ID;
33 double value = NAN;
34};
36
37// == ClapParamInfo ==
39 clap_id param_id = CLAP_INVALID_ID; // uint32_t
40 uint32_t flags = 0; // clap_param_info_flags
41 String ident, name, module;
42 double min_value = NAN, max_value = NAN, default_value = NAN, current_value = NAN;
43 String min_value_text, max_value_text, default_value_text, current_value_text;
44 /*ctor*/ ClapParamInfo ();
45 void unset ();
46 static String hints_from_param_info_flags (clap_param_info_flags flags);
47};
49
50// == ClapPluginHandle ==
52public:
53 const ClapPluginDescriptor &descriptor;
54 const std::vector<clap_audio_ports_config_t> &audio_ports_configs = audio_ports_configs_;
55 const std::vector<clap_audio_port_info_t> &audio_iport_infos = audio_iport_infos_;
56 const std::vector<clap_audio_port_info_t> &audio_oport_infos = audio_oport_infos_;
57 const std::vector<clap_note_port_info_t> &note_iport_infos = note_iport_infos_;
58 const std::vector<clap_note_port_info_t> &note_oport_infos = note_oport_infos_;
59protected:
60 std::vector<clap_audio_ports_config_t> audio_ports_configs_;
61 std::vector<clap_audio_port_info_t> audio_iport_infos_, audio_oport_infos_;
62 std::vector<clap_note_port_info_t> note_iport_infos_, note_oport_infos_;
63 std::vector<clap_audio_buffer_t> audio_inputs_, audio_outputs_;
64 std::vector<float*> data32ptrs_;
65 explicit ClapPluginHandle (const ClapPluginDescriptor &descriptor);
66 virtual ~ClapPluginHandle ();
67public:
68 String clapid () const { return descriptor.id; }
69 virtual void load_state (WritNode &xs) = 0;
70 virtual void save_state (WritNode &xs, const String &device_path) = 0;
71 virtual bool param_set_property (clap_id param_id, PropertyP prop) = 0;
72 virtual PropertyP param_get_property (clap_id param_id) = 0;
73 virtual double param_get_value (clap_id param_id, String *text = nullptr) = 0;
74 virtual bool param_set_value (clap_id param_id, double v) = 0;
75 virtual bool param_set_value (clap_id param_id, const String &stringvalue) = 0;
76 virtual ClapParamInfoS param_infos () = 0;
77 virtual void params_changed () = 0;
78 virtual bool clap_activate () = 0;
79 virtual bool clap_activated () const = 0;
80 virtual void clap_deactivate () = 0;
81 virtual void show_gui () = 0;
82 virtual void hide_gui () = 0;
83 virtual bool gui_visible () = 0;
84 virtual bool supports_gui () = 0;
85 virtual void destroy_gui () = 0;
86 virtual void destroy () = 0;
87 virtual AudioProcessorP audio_processor () = 0;
88 static ClapPluginHandleP make_clap_handle (const ClapPluginDescriptor &descriptor, AudioProcessorP audio_processor);
89 static CString audio_processor_type();
90 friend class ClapAudioProcessor;
91};
92
93// == CLAP utilities ==
94StringS list_clap_files ();
95const char* clap_event_type_string (int etype);
96String clap_event_to_string (const clap_event_note_t *enote);
97DeviceInfo clap_device_info (const ClapPluginDescriptor &descriptor);
98
99} // Ase
100
101#endif // __ASE_CLAP_PLUGIN_HH__
Compact, deduplicating string variant for constant strings.
Definition memory.hh:138
Base type for classes that have a Property.
Definition gadget.hh:12
One entry in a Writ serialization document.
Definition serialize.hh:24
The Anklang C++ API namespace.
Definition api.hh:9
Info for device types.
Definition api.hh:203
typedef int64_t