-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPluginControl.h
More file actions
91 lines (70 loc) · 2.97 KB
/
PluginControl.h
File metadata and controls
91 lines (70 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef __PLUGIN_CONTROL_H
#define __PLUGIN_CONTROL_H
#include <cstdlib>
#include "logging_macros.h"
#include "ladspa.h"
#include "lv2.h"
#include "lv2/atom/atom.h"
#include "json.hpp"
class PluginControl {
const LADSPA_PortDescriptor *desc;
const LADSPA_PortRangeHint *hint;
/* values selected in the interface */
LADSPA_Data sel;
/* value range */
struct { LADSPA_Data fine; LADSPA_Data coarse; } inc;
unsigned long sample_rate = 48000;
public:
enum Type {
FLOAT = 0,
INT = 1,
TOGGLE = 2,
/*
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠂⠀⠀⠀⢀⣠⠔⠈⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠎⠀⠀⠀⣠⡶⠛⠁⠀⠀⠀⢀⣠⠄⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡾⠁⠀⢀⣴⡿⠋⠀⠀⢀⣠⣴⠿⠋⠁⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠀⢀⣴⡿⠋⠀⢀⣠⣾⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣠⣾⠏⢀⣴⡿⠋⠀⣠⣶⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣴⡿⠁⣴⡿⠋⢀⣴⣾⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣼⠋⢠⣾⠟⠁⣴⣿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⡾⠁⣴⡿⠁⣠⣾⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢠⣶⣀⡅⠘⠋⢰⣾⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣿⣿⣿⣷⣾⣇⣈⣁⣠⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣿⣿⣿⣿⣿⣿⣿⣭⣥⣴⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣿⣿⢿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠉⠀⠀⠀⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
*/
ATOM = 3
};
unsigned long port;
uint32_t urid ;
LADSPA_Data min;
LADSPA_Data max;
LADSPA_Data default_value = 1; // 1 == no change in signal
bool isLogarithmic = false;
/* value in the plugin */
LADSPA_Data val;
LADSPA_Data *def;
LADSPA_Data presetValue = -1;
Type type ;
std::string lv2_name ;
bool name_allocated = false ;
LV2_Atom_Sequence * lv2AtomSequence ;
LADSPA_Data control_rounding(LADSPA_Data _val);
void setValue(float value);
void setSampleRate(unsigned long rate);
LADSPA_Data getMin();
LADSPA_Data getMax();
LADSPA_Data getDefault();
LADSPA_Data getValue();
PluginControl(const LADSPA_Descriptor *descriptor, int _port);
PluginControl(const LV2_Descriptor *descriptor, nlohmann::json j);
void print();
// unsigned long ctrl;
const char *name;
void freeMemory();
void setPresetValue(float value);
};
#endif // __PLUGIN_CONTROL_H