feat: implement basic distortion
This commit is contained in:
parent
6ccb93615f
commit
ce7844d7af
2 changed files with 49 additions and 14 deletions
|
|
@ -9,6 +9,8 @@
|
|||
#define DISTRHO_PLUGIN_NUM_INPUTS 2
|
||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
|
||||
|
||||
#define DISTRHO_PLUGIN_NUM_PARAMETERS 1
|
||||
|
||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0
|
||||
#define DISTRHO_PLUGIN_WANT_STATE 0
|
||||
|
||||
|
|
@ -20,12 +22,4 @@
|
|||
|
||||
#define DISTRHO_PLUGIN_CLAP_ID "moe.liam.squidgesoft.SquidgeDistortion"
|
||||
|
||||
enum Parameters {
|
||||
kGain,
|
||||
kTone,
|
||||
kVolume,
|
||||
// add your parameters here
|
||||
kParameterCount // must be last
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,12 +1,19 @@
|
|||
#include "DistrhoPlugin.hpp"
|
||||
#include "DistrhoPluginInfo.h"
|
||||
|
||||
#include "../../core/Clipper.hpp"
|
||||
#include "../../core/Gain.hpp"
|
||||
|
||||
START_NAMESPACE_DISTRHO
|
||||
|
||||
class SquidgeDistortion : public Plugin {
|
||||
|
||||
public:
|
||||
SquidgeDistortion()
|
||||
: Plugin(kParameterCount, 0, 0), gain(1.0), tone(1.0), volume(1.0) {}
|
||||
enum Parameters {
|
||||
kParamGain,
|
||||
kParameterCount // must be last
|
||||
};
|
||||
SquidgeDistortion() : Plugin(kParameterCount, 0, 0), gain_(2.0f) {}
|
||||
|
||||
protected:
|
||||
const char *getLabel() const override { return "SquidgeDistortion"; }
|
||||
|
|
@ -18,12 +25,46 @@ protected:
|
|||
uint32_t getVersion() const override { return d_version(0, 1, 0); }
|
||||
int64_t getUniqueId() const override { return d_cconst('S', 'Q', 'D', 'T'); }
|
||||
|
||||
void run(const float **inputs, float **outputs, uint32_t frames) override {}
|
||||
void initParameter(uint32_t index, Parameter ¶meter) override {
|
||||
parameter.unit = "!";
|
||||
switch (index) {
|
||||
case kParamGain:
|
||||
parameter.name = "Gain";
|
||||
parameter.symbol = "gain";
|
||||
parameter.ranges.min = 1.0f;
|
||||
parameter.ranges.def = 2.0f;
|
||||
parameter.ranges.max = 10.0f;
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float getParameterValue(uint32_t index) const override {
|
||||
switch (index) {
|
||||
case kParamGain:
|
||||
return gain_.getGain();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void setParameterValue(uint32_t index, float value) override {
|
||||
switch (index) {
|
||||
case kParamGain:
|
||||
gain_.setGain(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void run(const float **inputs, float **outputs, uint32_t frames) override {
|
||||
gain_.processStereo(inputs[0], inputs[1], outputs[0], outputs[1], frames);
|
||||
clipper_.processStereo(outputs[0], outputs[1], outputs[0], outputs[1],
|
||||
frames);
|
||||
}
|
||||
|
||||
private:
|
||||
float gain;
|
||||
float tone;
|
||||
float volume;
|
||||
Gain gain_;
|
||||
Clipper clipper_;
|
||||
|
||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SquidgeDistortion);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue