@@ -0,0 +1,40 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_DISTRHOARTWORK3BANDEQ_HPP | |||
#define BINARY_DISTRHOARTWORK3BANDEQ_HPP | |||
namespace DistrhoArtwork3BandEQ | |||
{ | |||
extern const char* aboutData; | |||
const unsigned int aboutDataSize = 172710; | |||
const unsigned int aboutWidth = 303; | |||
const unsigned int aboutHeight = 190; | |||
extern const char* aboutButtonHoverData; | |||
const unsigned int aboutButtonHoverDataSize = 5888; | |||
const unsigned int aboutButtonHoverWidth = 92; | |||
const unsigned int aboutButtonHoverHeight = 16; | |||
extern const char* aboutButtonNormalData; | |||
const unsigned int aboutButtonNormalDataSize = 5888; | |||
const unsigned int aboutButtonNormalWidth = 92; | |||
const unsigned int aboutButtonNormalHeight = 16; | |||
extern const char* backgroundData; | |||
const unsigned int backgroundDataSize = 437472; | |||
const unsigned int backgroundWidth = 392; | |||
const unsigned int backgroundHeight = 372; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 15376; | |||
const unsigned int knobWidth = 62; | |||
const unsigned int knobHeight = 62; | |||
extern const char* sliderData; | |||
const unsigned int sliderDataSize = 6000; | |||
const unsigned int sliderWidth = 50; | |||
const unsigned int sliderHeight = 30; | |||
} | |||
#endif // BINARY_DISTRHOARTWORK3BANDEQ_HPP | |||
@@ -0,0 +1,258 @@ | |||
/* | |||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* For a full copy of the license see the LICENSE file. | |||
*/ | |||
#include "DistrhoPlugin3BandEQ.hpp" | |||
#include <cmath> | |||
static const float kAMP_DB = 8.656170245f; | |||
static const float kDC_ADD = 1e-30f; | |||
static const float kPI = 3.141592654f; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
DistrhoPlugin3BandEQ::DistrhoPlugin3BandEQ() | |||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||
{ | |||
// set default values | |||
d_setProgram(0); | |||
// reset | |||
d_deactivate(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Init | |||
void DistrhoPlugin3BandEQ::d_initParameter(uint32_t index, Parameter& parameter) | |||
{ | |||
switch (index) | |||
{ | |||
case paramLow: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Low"; | |||
parameter.symbol = "low"; | |||
parameter.unit = "dB"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = -24.0f; | |||
parameter.ranges.max = 24.0f; | |||
break; | |||
case paramMid: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Mid"; | |||
parameter.symbol = "mid"; | |||
parameter.unit = "dB"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = -24.0f; | |||
parameter.ranges.max = 24.0f; | |||
break; | |||
case paramHigh: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "High"; | |||
parameter.symbol = "high"; | |||
parameter.unit = "dB"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = -24.0f; | |||
parameter.ranges.max = 24.0f; | |||
break; | |||
case paramMaster: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Master"; | |||
parameter.symbol = "master"; | |||
parameter.unit = "dB"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = -24.0f; | |||
parameter.ranges.max = 24.0f; | |||
break; | |||
case paramLowMidFreq: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Low-Mid Freq"; | |||
parameter.symbol = "low_mid"; | |||
parameter.unit = "Hz"; | |||
parameter.ranges.def = 440.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 1000.0f; | |||
break; | |||
case paramMidHighFreq: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Mid-High Freq"; | |||
parameter.symbol = "mid_high"; | |||
parameter.unit = "Hz"; | |||
parameter.ranges.def = 1000.0f; | |||
parameter.ranges.min = 1000.0f; | |||
parameter.ranges.max = 20000.0f; | |||
break; | |||
} | |||
} | |||
void DistrhoPlugin3BandEQ::d_initProgramName(uint32_t index, d_string& programName) | |||
{ | |||
if (index != 0) | |||
return; | |||
programName = "Default"; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Internal data | |||
float DistrhoPlugin3BandEQ::d_getParameterValue(uint32_t index) const | |||
{ | |||
switch (index) | |||
{ | |||
case paramLow: | |||
return fLow; | |||
case paramMid: | |||
return fMid; | |||
case paramHigh: | |||
return fHigh; | |||
case paramMaster: | |||
return fMaster; | |||
case paramLowMidFreq: | |||
return fLowMidFreq; | |||
case paramMidHighFreq: | |||
return fMidHighFreq; | |||
default: | |||
return 0.0f; | |||
} | |||
} | |||
void DistrhoPlugin3BandEQ::d_setParameterValue(uint32_t index, float value) | |||
{ | |||
if (d_getSampleRate() <= 0.0) | |||
return; | |||
switch (index) | |||
{ | |||
case paramLow: | |||
fLow = value; | |||
lowVol = std::exp( (fLow/48.0f) * 48.0f / kAMP_DB); | |||
break; | |||
case paramMid: | |||
fMid = value; | |||
midVol = std::exp( (fMid/48.0f) * 48.0f / kAMP_DB); | |||
break; | |||
case paramHigh: | |||
fHigh = value; | |||
highVol = std::exp( (fHigh/48.0f) * 48.0f / kAMP_DB); | |||
break; | |||
case paramMaster: | |||
fMaster = value; | |||
outVol = std::exp( (fMaster/48.0f) * 48.0f / kAMP_DB); | |||
break; | |||
case paramLowMidFreq: | |||
fLowMidFreq = std::fmin(value, fMidHighFreq); | |||
freqLP = fLowMidFreq; | |||
xLP = std::exp(-2.0f * kPI * freqLP / (float)d_getSampleRate()); | |||
a0LP = 1.0f - xLP; | |||
b1LP = -xLP; | |||
break; | |||
case paramMidHighFreq: | |||
fMidHighFreq = std::fmax(value, fLowMidFreq); | |||
freqHP = fMidHighFreq; | |||
xHP = std::exp(-2.0f * kPI * freqHP / (float)d_getSampleRate()); | |||
a0HP = 1.0f - xHP; | |||
b1HP = -xHP; | |||
break; | |||
} | |||
} | |||
void DistrhoPlugin3BandEQ::d_setProgram(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
fLow = 0.0f; | |||
fMid = 0.0f; | |||
fHigh = 0.0f; | |||
fMaster = 0.0f; | |||
fLowMidFreq = 220.0f; | |||
fMidHighFreq = 2000.0f; | |||
// Internal stuff | |||
lowVol = midVol = highVol = outVol = 1.0f; | |||
freqLP = 200.0f; | |||
freqHP = 2000.0f; | |||
// reset filter values | |||
d_activate(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Process | |||
void DistrhoPlugin3BandEQ::d_activate() | |||
{ | |||
const float sr = (float)d_getSampleRate(); | |||
xLP = std::exp(-2.0f * kPI * freqLP / sr); | |||
a0LP = 1.0f - xLP; | |||
b1LP = -xLP; | |||
xHP = std::exp(-2.0f * kPI * freqHP / sr); | |||
a0HP = 1.0f - xHP; | |||
b1HP = -xHP; | |||
} | |||
void DistrhoPlugin3BandEQ::d_deactivate() | |||
{ | |||
out1LP = out2LP = out1HP = out2HP = 0.0f; | |||
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f; | |||
} | |||
void DistrhoPlugin3BandEQ::d_run(const float** inputs, float** outputs, uint32_t frames) | |||
{ | |||
const float* in1 = inputs[0]; | |||
const float* in2 = inputs[1]; | |||
float* out1 = outputs[0]; | |||
float* out2 = outputs[1]; | |||
for (uint32_t i=0; i < frames; ++i) | |||
{ | |||
tmp1LP = a0LP * in1[i] - b1LP * tmp1LP + kDC_ADD; | |||
tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + kDC_ADD; | |||
out1LP = tmp1LP - kDC_ADD; | |||
out2LP = tmp2LP - kDC_ADD; | |||
tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + kDC_ADD; | |||
tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + kDC_ADD; | |||
out1HP = in1[i] - tmp1HP - kDC_ADD; | |||
out2HP = in2[i] - tmp2HP - kDC_ADD; | |||
out1[i] = (out1LP*lowVol + (in1[i] - out1LP - out1HP)*midVol + out1HP*highVol) * outVol; | |||
out2[i] = (out2LP*lowVol + (in2[i] - out2LP - out2HP)*midVol + out2HP*highVol) * outVol; | |||
} | |||
} | |||
// ----------------------------------------------------------------------- | |||
Plugin* createPlugin() | |||
{ | |||
return new DistrhoPlugin3BandEQ(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,113 @@ | |||
/* | |||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* For a full copy of the license see the LICENSE file. | |||
*/ | |||
#ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
#define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
#include "DistrhoPlugin.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class DistrhoPlugin3BandEQ : public Plugin | |||
{ | |||
public: | |||
enum Parameters | |||
{ | |||
paramLow = 0, | |||
paramMid, | |||
paramHigh, | |||
paramMaster, | |||
paramLowMidFreq, | |||
paramMidHighFreq, | |||
paramCount | |||
}; | |||
DistrhoPlugin3BandEQ(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
const char* d_getLabel() const noexcept override | |||
{ | |||
return "3BandEQ"; | |||
} | |||
const char* d_getMaker() const noexcept override | |||
{ | |||
return "DISTRHO"; | |||
} | |||
const char* d_getLicense() const noexcept override | |||
{ | |||
return "LGPL"; | |||
} | |||
uint32_t d_getVersion() const noexcept override | |||
{ | |||
return 0x1000; | |||
} | |||
long d_getUniqueId() const noexcept override | |||
{ | |||
return d_cconst('D', '3', 'E', 'Q'); | |||
} | |||
// ------------------------------------------------------------------- | |||
// Init | |||
void d_initParameter(uint32_t index, Parameter& parameter) override; | |||
void d_initProgramName(uint32_t index, d_string& programName) override; | |||
// ------------------------------------------------------------------- | |||
// Internal data | |||
float d_getParameterValue(uint32_t index) const override; | |||
void d_setParameterValue(uint32_t index, float value) override; | |||
void d_setProgram(uint32_t index) override; | |||
// ------------------------------------------------------------------- | |||
// Process | |||
void d_activate() override; | |||
void d_deactivate() override; | |||
void d_run(const float** inputs, float** outputs, uint32_t frames) override; | |||
// ------------------------------------------------------------------- | |||
private: | |||
float fLow, fMid, fHigh, fMaster, fLowMidFreq, fMidHighFreq; | |||
float lowVol, midVol, highVol, outVol; | |||
float freqLP, freqHP; | |||
float xLP, a0LP, b1LP; | |||
float xHP, a0HP, b1HP; | |||
float out1LP, out2LP, out1HP, out2HP; | |||
float tmp1LP, tmp2LP, tmp1HP, tmp2HP; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPlugin3BandEQ) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED |
@@ -0,0 +1,35 @@ | |||
/* | |||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* For a full copy of the license see the LICENSE file. | |||
*/ | |||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_NAME "3 Band EQ" | |||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||
#define DISTRHO_PLUGIN_IS_SYNTH 0 | |||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||
#define DISTRHO_PLUGIN_WANT_LATENCY 0 | |||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||
#define DISTRHO_PLUGIN_WANT_STATE 0 | |||
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0 | |||
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandEQ" | |||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,225 @@ | |||
/* | |||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* For a full copy of the license see the LICENSE file. | |||
*/ | |||
#include "DistrhoPlugin3BandEQ.hpp" | |||
#include "DistrhoUI3BandEQ.hpp" | |||
using DGL::Point; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||
: UI(), | |||
fAboutWindow(this) | |||
{ | |||
// background | |||
fImgBackground = Image(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR); | |||
// about | |||
Image aboutImage(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(aboutImage); | |||
// sliders | |||
Image sliderImage(DistrhoArtwork3BandEQ::sliderData, DistrhoArtwork3BandEQ::sliderWidth, DistrhoArtwork3BandEQ::sliderHeight); | |||
Point<int> sliderPosStart(57, 43); | |||
Point<int> sliderPosEnd(57, 43 + 160); | |||
// slider Low | |||
fSliderLow = new ImageSlider(this, sliderImage); | |||
fSliderLow->setStartPos(sliderPosStart); | |||
fSliderLow->setEndPos(sliderPosEnd); | |||
fSliderLow->setRange(-24.0f, 24.0f); | |||
fSliderLow->setCallback(this); | |||
// slider Mid | |||
sliderPosStart.setX(120); | |||
sliderPosEnd.setX(120); | |||
fSliderMid = new ImageSlider(*fSliderLow); | |||
fSliderMid->setStartPos(sliderPosStart); | |||
fSliderMid->setEndPos(sliderPosEnd); | |||
// slider High | |||
sliderPosStart.setX(183); | |||
sliderPosEnd.setX(183); | |||
fSliderHigh = new ImageSlider(*fSliderLow); | |||
fSliderHigh->setStartPos(sliderPosStart); | |||
fSliderHigh->setEndPos(sliderPosEnd); | |||
// slider Master | |||
sliderPosStart.setX(287); | |||
sliderPosEnd.setX(287); | |||
fSliderMaster = new ImageSlider(*fSliderLow); | |||
fSliderMaster->setStartPos(sliderPosStart); | |||
fSliderMaster->setEndPos(sliderPosEnd); | |||
// knobs | |||
Image knobImage(DistrhoArtwork3BandEQ::knobData, DistrhoArtwork3BandEQ::knobWidth, DistrhoArtwork3BandEQ::knobHeight); | |||
// knob Low-Mid | |||
fKnobLowMid = new ImageKnob(this, knobImage); | |||
fKnobLowMid->setPos(65, 269); | |||
fKnobLowMid->setRange(0.0f, 1000.0f); | |||
fKnobLowMid->setRotationAngle(270); | |||
fKnobLowMid->setCallback(this); | |||
// knob Mid-High | |||
fKnobMidHigh = new ImageKnob(this, knobImage); | |||
fKnobMidHigh->setPos(159, 269); | |||
fKnobMidHigh->setRange(1000.0f, 20000.0f); | |||
fKnobMidHigh->setRotationAngle(270); | |||
fKnobMidHigh->setCallback(this); | |||
// about button | |||
Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtwork3BandEQ::aboutButtonHoverData, DistrhoArtwork3BandEQ::aboutButtonHoverWidth, DistrhoArtwork3BandEQ::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(264, 300); | |||
fButtonAbout->setCallback(this); | |||
// set default values | |||
d_programChanged(0); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// DSP Callbacks | |||
void DistrhoUI3BandEQ::d_parameterChanged(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case DistrhoPlugin3BandEQ::paramLow: | |||
fSliderLow->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandEQ::paramMid: | |||
fSliderMid->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandEQ::paramHigh: | |||
fSliderHigh->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandEQ::paramMaster: | |||
fSliderMaster->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandEQ::paramLowMidFreq: | |||
fKnobLowMid->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandEQ::paramMidHighFreq: | |||
fKnobMidHigh->setValue(value); | |||
break; | |||
} | |||
} | |||
void DistrhoUI3BandEQ::d_programChanged(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
fSliderLow->setValue(0.0f); | |||
fSliderMid->setValue(0.0f); | |||
fSliderHigh->setValue(0.0f); | |||
fSliderMaster->setValue(0.0f); | |||
fKnobLowMid->setValue(220.0f); | |||
fKnobMidHigh->setValue(2000.0f); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Widget Callbacks | |||
void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int) | |||
{ | |||
if (button != fButtonAbout) | |||
return; | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobLowMid) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, true); | |||
else if (knob == fKnobMidHigh) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, true); | |||
} | |||
void DistrhoUI3BandEQ::imageKnobDragFinished(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobLowMid) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, false); | |||
else if (knob == fKnobMidHigh) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, false); | |||
} | |||
void DistrhoUI3BandEQ::imageKnobValueChanged(ImageKnob* knob, float value) | |||
{ | |||
if (knob == fKnobLowMid) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramLowMidFreq, value); | |||
else if (knob == fKnobMidHigh) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramMidHighFreq, value); | |||
} | |||
void DistrhoUI3BandEQ::imageSliderDragStarted(ImageSlider* slider) | |||
{ | |||
if (slider == fSliderLow) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramLow, true); | |||
else if (slider == fSliderMid) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramMid, true); | |||
else if (slider == fSliderHigh) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramHigh, true); | |||
else if (slider == fSliderMaster) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramMaster, true); | |||
} | |||
void DistrhoUI3BandEQ::imageSliderDragFinished(ImageSlider* slider) | |||
{ | |||
if (slider == fSliderLow) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramLow, false); | |||
else if (slider == fSliderMid) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramMid, false); | |||
else if (slider == fSliderHigh) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramHigh, false); | |||
else if (slider == fSliderMaster) | |||
d_editParameter(DistrhoPlugin3BandEQ::paramMaster, false); | |||
} | |||
void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value) | |||
{ | |||
if (slider == fSliderLow) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramLow, value); | |||
else if (slider == fSliderMid) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramMid, value); | |||
else if (slider == fSliderHigh) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramHigh, value); | |||
else if (slider == fSliderMaster) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramMaster, value); | |||
} | |||
void DistrhoUI3BandEQ::onDisplay() | |||
{ | |||
fImgBackground.draw(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
UI* createUI() | |||
{ | |||
return new DistrhoUI3BandEQ(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,95 @@ | |||
/* | |||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* For a full copy of the license see the LICENSE file. | |||
*/ | |||
#ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
#define DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
#include "DistrhoUI.hpp" | |||
#include "ImageAboutWindow.hpp" | |||
#include "ImageButton.hpp" | |||
#include "ImageKnob.hpp" | |||
#include "ImageSlider.hpp" | |||
#include "DistrhoArtwork3BandEQ.hpp" | |||
using DGL::Image; | |||
using DGL::ImageAboutWindow; | |||
using DGL::ImageButton; | |||
using DGL::ImageKnob; | |||
using DGL::ImageSlider; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class DistrhoUI3BandEQ : public UI, | |||
public ImageButton::Callback, | |||
public ImageKnob::Callback, | |||
public ImageSlider::Callback | |||
{ | |||
public: | |||
DistrhoUI3BandEQ(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
uint d_getWidth() const noexcept override | |||
{ | |||
return DistrhoArtwork3BandEQ::backgroundWidth; | |||
} | |||
uint d_getHeight() const noexcept override | |||
{ | |||
return DistrhoArtwork3BandEQ::backgroundHeight; | |||
} | |||
// ------------------------------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_programChanged(uint32_t index) override; | |||
// ------------------------------------------------------------------- | |||
// Widget Callbacks | |||
void imageButtonClicked(ImageButton* button, int) override; | |||
void imageKnobDragStarted(ImageKnob* knob) override; | |||
void imageKnobDragFinished(ImageKnob* knob) override; | |||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||
void imageSliderDragStarted(ImageSlider* slider) override; | |||
void imageSliderDragFinished(ImageSlider* slider) override; | |||
void imageSliderValueChanged(ImageSlider* slider, float value) override; | |||
void onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
ImageAboutWindow fAboutWindow; | |||
ScopedPointer<ImageButton> fButtonAbout; | |||
ScopedPointer<ImageKnob> fKnobLowMid, fKnobMidHigh; | |||
ScopedPointer<ImageSlider> fSliderLow, fSliderMid, fSliderHigh, fSliderMaster; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUI3BandEQ) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED |
@@ -0,0 +1,27 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
# -------------------------------------------------------------- | |||
# Project name, used for binaries | |||
NAME = 3BandEQ | |||
# -------------------------------------------------------------- | |||
# Files to build | |||
OBJS_DSP = \ | |||
DistrhoPlugin3BandEQ.cpp.o | |||
OBJS_UI = \ | |||
DistrhoArtwork3BandEQ.cpp.o \ | |||
DistrhoUI3BandEQ.cpp.o | |||
# -------------------------------------------------------------- | |||
# Do some magic | |||
include ../Makefile.mk | |||
# -------------------------------------------------------------- |