-
Notifications
You must be signed in to change notification settings - Fork 2
/
PluginNeuralCapture.hpp
152 lines (113 loc) · 3.82 KB
/
PluginNeuralCapture.hpp
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* Neural Capture audio effect based on DISTRHO Plugin Framework (DPF)
*
* SPDX-License-Identifier: GPL-2.0 license
*
* Copyright (C) 2023 brummer <brummer@web.de>
*/
#ifndef PLUGIN_NEURALCAPTURE_H
#define PLUGIN_NEURALCAPTURE_H
#include "DistrhoPlugin.hpp"
#include "profiler.h"
START_NAMESPACE_DISTRHO
#ifndef MIN
#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
#endif
#ifndef MAX
#define MAX(a,b) ( (a) > (b) ? (a) : (b) )
#endif
#ifndef CLAMP
#define CLAMP(v, min, max) (MIN((max), MAX((min), (v))))
#endif
#ifndef DB_CO
#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f)
#endif
// -----------------------------------------------------------------------
class PluginNeuralCapture : public Plugin {
public:
enum Parameters {
paramButton = 0,
paramState = 1,
paramMeter = 2,
paramError = 3,
paramCount
};
PluginNeuralCapture();
~PluginNeuralCapture();
protected:
// -------------------------------------------------------------------
// Information
const char* getLabel() const noexcept override {
return "Neural Record";
}
const char* getDescription() const override {
return "A Neural Record plug to make the process of cloning external soft/hardware a bit more comfortable ";
}
const char* getMaker() const noexcept override {
return "brummer";
}
const char* getHomePage() const override {
return "https://github.com/brummer10/neuralrecord";
}
const char* getLicense() const noexcept override {
return "https://spdx.org/licenses/GPL-2.0-or-later";
}
uint32_t getVersion() const noexcept override {
return d_version(0, 1, 3);
}
// Go to:
//
// http://service.steinberg.de/databases/plugin.nsf/plugIn
//
// Get a proper plugin UID and fill it in here!
int64_t getUniqueId() const noexcept override {
return d_cconst('a', 'b', 'c', 'd');
}
// -------------------------------------------------------------------
// Init
void initParameter(uint32_t index, Parameter& parameter) override;
void initProgramName(uint32_t index, String& programName) override;
// -------------------------------------------------------------------
// Internal data
float getParameterValue(uint32_t index) const override;
void setParameterValue(uint32_t index, float value) override;
void loadProgram(uint32_t index) override;
void setOutputParameterValue(uint32_t index, float value);
// -------------------------------------------------------------------
// Optional
// Optional callback to inform the plugin about a sample rate change.
void sampleRateChanged(double newSampleRate) override;
// -------------------------------------------------------------------
// Process
void activate() override;
void run(const float**, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
float fParams[paramCount];
double fSampleRate;
float button;
float state;
float meter;
float p_error;
// pointer to dsp class
profiler::Profil* profil;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginNeuralCapture)
};
struct Preset {
const char* name;
float params[PluginNeuralCapture::paramCount];
};
const Preset factoryPresets[] = {
{
"Default",
{ 0.f, 0.f, 0.f, 0.f }
}
//,{
// "Another preset", // preset name
// {-14.0f, ...} // array of presetCount float param values
//}
};
const uint presetCount = sizeof(factoryPresets) / sizeof(Preset);
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // #ifndef PLUGIN_NEURALCAPTURE_H