feat: add initial implementation of squidgeTemplate plugin with basic gain parameter
This commit is contained in:
parent
062d1e074c
commit
55ec7f7c19
3 changed files with 115 additions and 0 deletions
79
plugins/SquidgeTemplate/SquidgeTemplate.cpp
Normal file
79
plugins/SquidgeTemplate/SquidgeTemplate.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#include "DistrhoDetails.hpp"
|
||||
#include "DistrhoPlugin.hpp"
|
||||
#include "DistrhoPluginInfo.h"
|
||||
|
||||
#include "../../core/Gain.hpp"
|
||||
|
||||
START_NAMESPACE_DISTRHO
|
||||
|
||||
class squidgeTemplate : public Plugin
|
||||
{
|
||||
public:
|
||||
enum Parameters
|
||||
{
|
||||
kParamGain,
|
||||
kParameterCount
|
||||
};
|
||||
|
||||
squidgeTemplate()
|
||||
: Plugin(kParameterCount, 0, 0), gain_(1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
const char *getLabel() const override { return "squidgeTemplate"; }
|
||||
const char *getDescription() const override { return "Generic squidge plugin template."; }
|
||||
const char *getMaker() const override { return "SquidgeSoft"; }
|
||||
const char *getLicense() const override { return "GPL3"; }
|
||||
uint32_t getVersion() const override { return d_version(0, 1, 0); }
|
||||
int64_t getUniqueId() const override { return d_cconst('S', 'Q', 'T', 'P'); }
|
||||
|
||||
void initParameter(uint32_t index, Parameter ¶meter) override
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case kParamGain:
|
||||
parameter.name = "Gain";
|
||||
parameter.symbol = "gain";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.def = 1.0f;
|
||||
parameter.ranges.max = 2.0f;
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float getParameterValue(uint32_t index) const override
|
||||
{
|
||||
if (index == kParamGain)
|
||||
return gain_.getGain();
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void setParameterValue(uint32_t index, float value) override
|
||||
{
|
||||
if (index == kParamGain)
|
||||
gain_.setGain(value);
|
||||
}
|
||||
|
||||
void run(const float **inputs, float **outputs, uint32_t frames) override
|
||||
{
|
||||
gain_.processStereo(inputs[0], inputs[1], outputs[0], outputs[1], frames);
|
||||
}
|
||||
|
||||
void sampleRateChanged(double /*newSr*/) override
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
Gain gain_;
|
||||
|
||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(squidgeTemplate)
|
||||
};
|
||||
|
||||
Plugin *createPlugin()
|
||||
{
|
||||
return new squidgeTemplate();
|
||||
}
|
||||
|
||||
END_NAMESPACE_DISTRHO
|
||||
Loading…
Add table
Add a link
Reference in a new issue