@@ -13,8 +13,8 @@ libs: | |||
plugins: libs | |||
$(MAKE) -C plugins/3BandEQ | |||
# $(MAKE) -C plugins/3BandSplitter | |||
# $(MAKE) -C plugins/PingPongPan | |||
$(MAKE) -C plugins/3BandSplitter | |||
$(MAKE) -C plugins/PingPongPan | |||
gen: plugins dpf/utils/lv2_ttl_generator | |||
@$(CURDIR)/dpf/utils/generate-ttl.sh | |||
@@ -28,8 +28,8 @@ clean: | |||
$(MAKE) clean -C dpf/dgl | |||
$(MAKE) clean -C dpf/utils/lv2-ttl-generator | |||
$(MAKE) clean -C plugins/3BandEQ | |||
# $(MAKE) clean -C plugins/3BandSplitter | |||
# $(MAKE) clean -C plugins/PingPongPan | |||
$(MAKE) clean -C plugins/3BandSplitter | |||
$(MAKE) clean -C plugins/PingPongPan | |||
# -------------------------------------------------------------- | |||
@@ -0,0 +1,40 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP | |||
#define BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP | |||
namespace DistrhoArtwork3BandSplitter | |||
{ | |||
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_DISTRHOARTWORK3BANDSPLITTER_HPP | |||
@@ -0,0 +1,266 @@ | |||
/* | |||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter 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 "DistrhoPlugin3BandSplitter.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 | |||
// ----------------------------------------------------------------------- | |||
DistrhoPlugin3BandSplitter::DistrhoPlugin3BandSplitter() | |||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||
{ | |||
// set default values | |||
d_setProgram(0); | |||
// reset | |||
d_deactivate(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Init | |||
void DistrhoPlugin3BandSplitter::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 DistrhoPlugin3BandSplitter::d_initProgramName(uint32_t index, d_string& programName) | |||
{ | |||
if (index != 0) | |||
return; | |||
programName = "Default"; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Internal data | |||
float DistrhoPlugin3BandSplitter::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 DistrhoPlugin3BandSplitter::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 DistrhoPlugin3BandSplitter::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 DistrhoPlugin3BandSplitter::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 DistrhoPlugin3BandSplitter::d_deactivate() | |||
{ | |||
out1LP = out2LP = out1HP = out2HP = 0.0f; | |||
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f; | |||
} | |||
void DistrhoPlugin3BandSplitter::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]; | |||
float* out3 = outputs[2]; | |||
float* out4 = outputs[3]; | |||
float* out5 = outputs[4]; | |||
float* out6 = outputs[5]; | |||
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 * outVol; | |||
out2[i] = out2LP*lowVol * outVol; | |||
out3[i] = (in1[i] - out1LP - out1HP)*midVol * outVol; | |||
out4[i] = (in2[i] - out2LP - out2HP)*midVol * outVol; | |||
out5[i] = out1HP*highVol * outVol; | |||
out6[i] = out2HP*highVol * outVol; | |||
} | |||
} | |||
// ----------------------------------------------------------------------- | |||
Plugin* createPlugin() | |||
{ | |||
return new DistrhoPlugin3BandSplitter(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,113 @@ | |||
/* | |||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter 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_3BANDSPLITTER_HPP_INCLUDED | |||
#define DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED | |||
#include "DistrhoPlugin.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class DistrhoPlugin3BandSplitter : public Plugin | |||
{ | |||
public: | |||
enum Parameters | |||
{ | |||
paramLow = 0, | |||
paramMid, | |||
paramHigh, | |||
paramMaster, | |||
paramLowMidFreq, | |||
paramMidHighFreq, | |||
paramCount | |||
}; | |||
DistrhoPlugin3BandSplitter(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
const char* d_getLabel() const noexcept override | |||
{ | |||
return "3BandSplitter"; | |||
} | |||
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', 'S'); | |||
} | |||
// ------------------------------------------------------------------- | |||
// 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(DistrhoPlugin3BandSplitter) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED |
@@ -0,0 +1,35 @@ | |||
/* | |||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter 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 Splitter" | |||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||
#define DISTRHO_PLUGIN_IS_SYNTH 0 | |||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 6 | |||
#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/3BandSplitter" | |||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,225 @@ | |||
/* | |||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter 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 "DistrhoPlugin3BandSplitter.hpp" | |||
#include "DistrhoUI3BandSplitter.hpp" | |||
using DGL::Point; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() | |||
: UI(), | |||
fAboutWindow(this) | |||
{ | |||
// background | |||
fImgBackground = Image(DistrhoArtwork3BandSplitter::backgroundData, DistrhoArtwork3BandSplitter::backgroundWidth, DistrhoArtwork3BandSplitter::backgroundHeight, GL_BGR); | |||
// about | |||
Image aboutImage(DistrhoArtwork3BandSplitter::aboutData, DistrhoArtwork3BandSplitter::aboutWidth, DistrhoArtwork3BandSplitter::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(aboutImage); | |||
// sliders | |||
Image sliderImage(DistrhoArtwork3BandSplitter::sliderData, DistrhoArtwork3BandSplitter::sliderWidth, DistrhoArtwork3BandSplitter::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(DistrhoArtwork3BandSplitter::knobData, DistrhoArtwork3BandSplitter::knobWidth, DistrhoArtwork3BandSplitter::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(DistrhoArtwork3BandSplitter::aboutButtonNormalData, DistrhoArtwork3BandSplitter::aboutButtonNormalWidth, DistrhoArtwork3BandSplitter::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtwork3BandSplitter::aboutButtonHoverData, DistrhoArtwork3BandSplitter::aboutButtonHoverWidth, DistrhoArtwork3BandSplitter::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(264, 300); | |||
fButtonAbout->setCallback(this); | |||
// set default values | |||
d_programChanged(0); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// DSP Callbacks | |||
void DistrhoUI3BandSplitter::d_parameterChanged(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case DistrhoPlugin3BandSplitter::paramLow: | |||
fSliderLow->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandSplitter::paramMid: | |||
fSliderMid->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandSplitter::paramHigh: | |||
fSliderHigh->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandSplitter::paramMaster: | |||
fSliderMaster->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandSplitter::paramLowMidFreq: | |||
fKnobLowMid->setValue(value); | |||
break; | |||
case DistrhoPlugin3BandSplitter::paramMidHighFreq: | |||
fKnobMidHigh->setValue(value); | |||
break; | |||
} | |||
} | |||
void DistrhoUI3BandSplitter::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 DistrhoUI3BandSplitter::imageButtonClicked(ImageButton* button, int) | |||
{ | |||
if (button != fButtonAbout) | |||
return; | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUI3BandSplitter::imageKnobDragStarted(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobLowMid) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramLowMidFreq, true); | |||
else if (knob == fKnobMidHigh) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMidHighFreq, true); | |||
} | |||
void DistrhoUI3BandSplitter::imageKnobDragFinished(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobLowMid) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramLowMidFreq, false); | |||
else if (knob == fKnobMidHigh) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMidHighFreq, false); | |||
} | |||
void DistrhoUI3BandSplitter::imageKnobValueChanged(ImageKnob* knob, float value) | |||
{ | |||
if (knob == fKnobLowMid) | |||
d_setParameterValue(DistrhoPlugin3BandSplitter::paramLowMidFreq, value); | |||
else if (knob == fKnobMidHigh) | |||
d_setParameterValue(DistrhoPlugin3BandSplitter::paramMidHighFreq, value); | |||
} | |||
void DistrhoUI3BandSplitter::imageSliderDragStarted(ImageSlider* slider) | |||
{ | |||
if (slider == fSliderLow) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramLow, true); | |||
else if (slider == fSliderMid) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMid, true); | |||
else if (slider == fSliderHigh) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramHigh, true); | |||
else if (slider == fSliderMaster) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMaster, true); | |||
} | |||
void DistrhoUI3BandSplitter::imageSliderDragFinished(ImageSlider* slider) | |||
{ | |||
if (slider == fSliderLow) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramLow, false); | |||
else if (slider == fSliderMid) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMid, false); | |||
else if (slider == fSliderHigh) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramHigh, false); | |||
else if (slider == fSliderMaster) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMaster, false); | |||
} | |||
void DistrhoUI3BandSplitter::imageSliderValueChanged(ImageSlider* slider, float value) | |||
{ | |||
if (slider == fSliderLow) | |||
d_setParameterValue(DistrhoPlugin3BandSplitter::paramLow, value); | |||
else if (slider == fSliderMid) | |||
d_setParameterValue(DistrhoPlugin3BandSplitter::paramMid, value); | |||
else if (slider == fSliderHigh) | |||
d_setParameterValue(DistrhoPlugin3BandSplitter::paramHigh, value); | |||
else if (slider == fSliderMaster) | |||
d_setParameterValue(DistrhoPlugin3BandSplitter::paramMaster, value); | |||
} | |||
void DistrhoUI3BandSplitter::onDisplay() | |||
{ | |||
fImgBackground.draw(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
UI* createUI() | |||
{ | |||
return new DistrhoUI3BandSplitter(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,95 @@ | |||
/* | |||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter 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_3BANDSPLITTER_HPP_INCLUDED | |||
#define DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED | |||
#include "DistrhoUI.hpp" | |||
#include "ImageAboutWindow.hpp" | |||
#include "ImageButton.hpp" | |||
#include "ImageKnob.hpp" | |||
#include "ImageSlider.hpp" | |||
#include "DistrhoArtwork3BandSplitter.hpp" | |||
using DGL::Image; | |||
using DGL::ImageAboutWindow; | |||
using DGL::ImageButton; | |||
using DGL::ImageKnob; | |||
using DGL::ImageSlider; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class DistrhoUI3BandSplitter : public UI, | |||
public ImageButton::Callback, | |||
public ImageKnob::Callback, | |||
public ImageSlider::Callback | |||
{ | |||
public: | |||
DistrhoUI3BandSplitter(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
uint d_getWidth() const noexcept override | |||
{ | |||
return DistrhoArtwork3BandSplitter::backgroundWidth; | |||
} | |||
uint d_getHeight() const noexcept override | |||
{ | |||
return DistrhoArtwork3BandSplitter::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(DistrhoUI3BandSplitter) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED |
@@ -0,0 +1,27 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
# -------------------------------------------------------------- | |||
# Project name, used for binaries | |||
NAME = 3BandSplitter | |||
# -------------------------------------------------------------- | |||
# Files to build | |||
OBJS_DSP = \ | |||
DistrhoPlugin3BandSplitter.cpp.o | |||
OBJS_UI = \ | |||
DistrhoArtwork3BandSplitter.cpp.o \ | |||
DistrhoUI3BandSplitter.cpp.o | |||
# -------------------------------------------------------------- | |||
# Do some magic | |||
include ../Makefile.mk | |||
# -------------------------------------------------------------- |
@@ -0,0 +1,35 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_DISTRHOARTWORKPINGPONGPAN_HPP | |||
#define BINARY_DISTRHOARTWORKPINGPONGPAN_HPP | |||
namespace DistrhoArtworkPingPongPan | |||
{ | |||
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 = 7600; | |||
const unsigned int aboutButtonHoverWidth = 95; | |||
const unsigned int aboutButtonHoverHeight = 20; | |||
extern const char* aboutButtonNormalData; | |||
const unsigned int aboutButtonNormalDataSize = 7600; | |||
const unsigned int aboutButtonNormalWidth = 95; | |||
const unsigned int aboutButtonNormalHeight = 20; | |||
extern const char* backgroundData; | |||
const unsigned int backgroundDataSize = 157080; | |||
const unsigned int backgroundWidth = 308; | |||
const unsigned int backgroundHeight = 170; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 17956; | |||
const unsigned int knobWidth = 67; | |||
const unsigned int knobHeight = 67; | |||
} | |||
#endif // BINARY_DISTRHOARTWORKPINGPONGPAN_HPP | |||
@@ -0,0 +1,35 @@ | |||
/* | |||
* DISTRHO PingPongPan Plugin, based on PingPongPan 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 "Ping Pong Pan" | |||
#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/PingPongPan" | |||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,161 @@ | |||
/* | |||
* DISTRHO PingPongPan Plugin, based on PingPongPan 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 "DistrhoPluginPingPongPan.hpp" | |||
#include <cmath> | |||
static const float k2PI = 6.283185307f; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
DistrhoPluginPingPongPan::DistrhoPluginPingPongPan() | |||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||
{ | |||
// set default values | |||
d_setProgram(0); | |||
// reset | |||
d_deactivate(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Init | |||
void DistrhoPluginPingPongPan::d_initParameter(uint32_t index, Parameter& parameter) | |||
{ | |||
switch (index) | |||
{ | |||
case paramFreq: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Frequency"; | |||
parameter.symbol = "freq"; | |||
parameter.ranges.def = 50.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 100.0f; | |||
break; | |||
case paramWidth: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Width"; | |||
parameter.symbol = "with"; | |||
parameter.unit = "%"; | |||
parameter.ranges.def = 75.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 100.0f; | |||
break; | |||
} | |||
} | |||
void DistrhoPluginPingPongPan::d_initProgramName(uint32_t index, d_string& programName) | |||
{ | |||
if (index != 0) | |||
return; | |||
programName = "Default"; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Internal data | |||
float DistrhoPluginPingPongPan::d_getParameterValue(uint32_t index) const | |||
{ | |||
switch (index) | |||
{ | |||
case paramFreq: | |||
return fFreq; | |||
case paramWidth: | |||
return fWidth; | |||
default: | |||
return 0.0f; | |||
} | |||
} | |||
void DistrhoPluginPingPongPan::d_setParameterValue(uint32_t index, float value) | |||
{ | |||
if (d_getSampleRate() <= 0.0) | |||
return; | |||
switch (index) | |||
{ | |||
case paramFreq: | |||
fFreq = value; | |||
waveSpeed = (k2PI * fFreq / 100.0f)/(float)d_getSampleRate(); | |||
break; | |||
case paramWidth: | |||
fWidth = value; | |||
break; | |||
} | |||
} | |||
void DistrhoPluginPingPongPan::d_setProgram(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
fFreq = 50.0f; | |||
fWidth = 75.0f; | |||
// reset filter values | |||
d_activate(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Process | |||
void DistrhoPluginPingPongPan::d_activate() | |||
{ | |||
waveSpeed = (k2PI * fFreq / 100.0f)/(float)d_getSampleRate(); | |||
} | |||
void DistrhoPluginPingPongPan::d_deactivate() | |||
{ | |||
wavePos = 0.0f; | |||
} | |||
void DistrhoPluginPingPongPan::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) | |||
{ | |||
pan = std::fmin(std::fmax(std::sin(wavePos) * (fWidth/100.0f), -1.0f), 1.0f); | |||
if ((wavePos += waveSpeed) >= k2PI) | |||
wavePos -= k2PI; | |||
out1[i] = in1[i] * (pan > 0.0f ? 1.0f-pan : 1.0f); | |||
out2[i] = in2[i] * (pan < 0.0f ? 1.0f+pan : 1.0f); | |||
} | |||
} | |||
// ----------------------------------------------------------------------- | |||
Plugin* createPlugin() | |||
{ | |||
return new DistrhoPluginPingPongPan(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,104 @@ | |||
/* | |||
* DISTRHO PingPongPan Plugin, based on PingPongPan 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_PINGPONGPAN_HPP_INCLUDED | |||
#define DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED | |||
#include "DistrhoPlugin.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class DistrhoPluginPingPongPan : public Plugin | |||
{ | |||
public: | |||
enum Parameters | |||
{ | |||
paramFreq = 0, | |||
paramWidth, | |||
paramCount | |||
}; | |||
DistrhoPluginPingPongPan(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
const char* d_getLabel() const noexcept override | |||
{ | |||
return "PingPongPan"; | |||
} | |||
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', 'P', 'P', 'P'); | |||
} | |||
// ------------------------------------------------------------------- | |||
// 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 fFreq; | |||
float fWidth; | |||
float waveSpeed; | |||
float pan, wavePos; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginPingPongPan) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED |
@@ -0,0 +1,140 @@ | |||
/* | |||
* DISTRHO PingPongPan Plugin, based on PingPongPan 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 "DistrhoPluginPingPongPan.hpp" | |||
#include "DistrhoUIPingPongPan.hpp" | |||
using DGL::Point; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
DistrhoUIPingPongPan::DistrhoUIPingPongPan() | |||
: UI(), | |||
fAboutWindow(this) | |||
{ | |||
// background | |||
fImgBackground = Image(DistrhoArtworkPingPongPan::backgroundData, DistrhoArtworkPingPongPan::backgroundWidth, DistrhoArtworkPingPongPan::backgroundHeight, GL_BGR); | |||
Image imageAbout(DistrhoArtworkPingPongPan::aboutData, DistrhoArtworkPingPongPan::aboutWidth, DistrhoArtworkPingPongPan::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(imageAbout); | |||
// knobs | |||
Image knobImage(DistrhoArtworkPingPongPan::knobData, DistrhoArtworkPingPongPan::knobWidth, DistrhoArtworkPingPongPan::knobHeight); | |||
// knob Low-Mid | |||
fKnobFreq = new ImageKnob(this, knobImage); | |||
fKnobFreq->setPos(60, 58); | |||
fKnobFreq->setRange(0.0f, 100.0f); | |||
fKnobFreq->setRotationAngle(270); | |||
fKnobFreq->setCallback(this); | |||
// knob Mid-High | |||
fKnobWidth = new ImageKnob(this, knobImage); | |||
fKnobWidth->setPos(182, 58); | |||
fKnobWidth->setRange(0.0f, 100.0f); | |||
fKnobWidth->setRotationAngle(270); | |||
fKnobWidth->setCallback(this); | |||
// about button | |||
Image aboutImageNormal(DistrhoArtworkPingPongPan::aboutButtonNormalData, DistrhoArtworkPingPongPan::aboutButtonNormalWidth, DistrhoArtworkPingPongPan::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtworkPingPongPan::aboutButtonHoverData, DistrhoArtworkPingPongPan::aboutButtonHoverWidth, DistrhoArtworkPingPongPan::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(183, 8); | |||
fButtonAbout->setCallback(this); | |||
// set default values | |||
d_programChanged(0); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// DSP Callbacks | |||
void DistrhoUIPingPongPan::d_parameterChanged(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case DistrhoPluginPingPongPan::paramFreq: | |||
fKnobFreq->setValue(value); | |||
break; | |||
case DistrhoPluginPingPongPan::paramWidth: | |||
fKnobWidth->setValue(value); | |||
break; | |||
} | |||
} | |||
void DistrhoUIPingPongPan::d_programChanged(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
fKnobFreq->setValue(50.0f); | |||
fKnobWidth->setValue(75.0f); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Widget Callbacks | |||
void DistrhoUIPingPongPan::imageButtonClicked(ImageButton* button, int) | |||
{ | |||
if (button != fButtonAbout) | |||
return; | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUIPingPongPan::imageKnobDragStarted(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobFreq) | |||
d_editParameter(DistrhoPluginPingPongPan::paramFreq, true); | |||
else if (knob == fKnobWidth) | |||
d_editParameter(DistrhoPluginPingPongPan::paramWidth, true); | |||
} | |||
void DistrhoUIPingPongPan::imageKnobDragFinished(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobFreq) | |||
d_editParameter(DistrhoPluginPingPongPan::paramFreq, false); | |||
else if (knob == fKnobWidth) | |||
d_editParameter(DistrhoPluginPingPongPan::paramWidth, false); | |||
} | |||
void DistrhoUIPingPongPan::imageKnobValueChanged(ImageKnob* knob, float value) | |||
{ | |||
if (knob == fKnobFreq) | |||
d_setParameterValue(DistrhoPluginPingPongPan::paramFreq, value); | |||
else if (knob == fKnobWidth) | |||
d_setParameterValue(DistrhoPluginPingPongPan::paramWidth, value); | |||
} | |||
void DistrhoUIPingPongPan::onDisplay() | |||
{ | |||
fImgBackground.draw(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
UI* createUI() | |||
{ | |||
return new DistrhoUIPingPongPan(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,88 @@ | |||
/* | |||
* DISTRHO PingPongPan Plugin, based on PingPongPan 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_PINGPONGPAN_HPP_INCLUDED | |||
#define DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED | |||
#include "DistrhoUI.hpp" | |||
#include "ImageAboutWindow.hpp" | |||
#include "ImageButton.hpp" | |||
#include "ImageKnob.hpp" | |||
#include "DistrhoArtworkPingPongPan.hpp" | |||
using DGL::Image; | |||
using DGL::ImageAboutWindow; | |||
using DGL::ImageButton; | |||
using DGL::ImageKnob; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class DistrhoUIPingPongPan : public UI, | |||
public ImageButton::Callback, | |||
public ImageKnob::Callback | |||
{ | |||
public: | |||
DistrhoUIPingPongPan(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
uint d_getWidth() const noexcept override | |||
{ | |||
return DistrhoArtworkPingPongPan::backgroundWidth; | |||
} | |||
uint d_getHeight() const noexcept override | |||
{ | |||
return DistrhoArtworkPingPongPan::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 onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
ImageAboutWindow fAboutWindow; | |||
ScopedPointer<ImageButton> fButtonAbout; | |||
ScopedPointer<ImageKnob> fKnobFreq, fKnobWidth; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIPingPongPan) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED |
@@ -0,0 +1,27 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
# -------------------------------------------------------------- | |||
# Project name, used for binaries | |||
NAME = PingPongPan | |||
# -------------------------------------------------------------- | |||
# Files to build | |||
OBJS_DSP = \ | |||
DistrhoPluginPingPongPan.cpp.o | |||
OBJS_UI = \ | |||
DistrhoArtworkPingPongPan.cpp.o \ | |||
DistrhoUIPingPongPan.cpp.o | |||
# -------------------------------------------------------------- | |||
# Do some magic | |||
include ../Makefile.mk | |||
# -------------------------------------------------------------- |