@@ -81,8 +81,8 @@ doc/DISTRHO/ | |||
src/dist/ | |||
# QtCreator builds | |||
*-build-*Debug/ | |||
*-build-*Release/ | |||
*build-*Debug/ | |||
*build-*Release/ | |||
# ZynAddSubFX UI | |||
source/backend/native/zynaddsubfx/UI/ADnoteUI.cpp | |||
@@ -0,0 +1,30 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_DISTRHOARTWORKSTEREOENHANCER_HPP | |||
#define BINARY_DISTRHOARTWORKSTEREOENHANCER_HPP | |||
namespace DistrhoArtworkStereoEnhancer | |||
{ | |||
extern const char* aboutButtonHoverData; | |||
const unsigned int aboutButtonHoverDataSize = 9152; | |||
const unsigned int aboutButtonHoverWidth = 104; | |||
const unsigned int aboutButtonHoverHeight = 22; | |||
extern const char* aboutButtonNormalData; | |||
const unsigned int aboutButtonNormalDataSize = 9152; | |||
const unsigned int aboutButtonNormalWidth = 104; | |||
const unsigned int aboutButtonNormalHeight = 22; | |||
extern const char* backgroundData; | |||
const unsigned int backgroundDataSize = 195024; | |||
const unsigned int backgroundWidth = 478; | |||
const unsigned int backgroundHeight = 136; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 543036; | |||
const unsigned int knobWidth = 59; | |||
const unsigned int knobHeight = 2301; | |||
} | |||
#endif // BINARY_DISTRHOARTWORKSTEREOENHANCER_HPP | |||
@@ -0,0 +1,36 @@ | |||
/* | |||
* DISTRHO 3BandEQ Plugin, based on StereoEnhancer by Michael Gruhn | |||
* Copyright (C) 2012-2013 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 LGPL.txt file | |||
*/ | |||
#ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
#define __DISTRHO_PLUGIN_INFO_H__ | |||
#define DISTRHO_PLUGIN_NAME "Stereo Enhancer" | |||
#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_URI "http://distrho.sf.net/plugins/StereoEnhancer" | |||
#define DISTRHO_UI_OPENGL | |||
#endif // __DISTRHO_PLUGIN_INFO_H__ |
@@ -0,0 +1,210 @@ | |||
/* | |||
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn | |||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||
* Copyright (C) 2012-2013 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 LGPL.txt file | |||
*/ | |||
#include "DistrhoPluginStereoEnhancer.hpp" | |||
#include <cmath> | |||
static const float cfDC_ADD = 1e-30f; | |||
static const float cfPI = 3.141592654f; | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
DistrhoPluginStereoEnhancer::DistrhoPluginStereoEnhancer() | |||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||
{ | |||
// set default values | |||
d_setProgram(0); | |||
// reset | |||
d_deactivate(); | |||
} | |||
DistrhoPluginStereoEnhancer::~DistrhoPluginStereoEnhancer() | |||
{ | |||
} | |||
// ------------------------------------------------- | |||
// Init | |||
void DistrhoPluginStereoEnhancer::d_initParameter(uint32_t index, Parameter& parameter) | |||
{ | |||
switch (index) | |||
{ | |||
case paramWidthLows: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Width Lows"; | |||
parameter.symbol = "width_lows"; | |||
parameter.unit = "%"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = 100.0f; | |||
parameter.ranges.max = 200.0f; | |||
break; | |||
case paramWidthHighs: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "WidthHighs"; | |||
parameter.symbol = "width_highs"; | |||
parameter.unit = "%"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = 100.0f; | |||
parameter.ranges.max = 200.0f; | |||
break; | |||
case paramCrossover: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Crossover"; | |||
parameter.symbol = "crossover"; | |||
parameter.unit = "%"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = 27.51604f; | |||
parameter.ranges.max = 100.0f; | |||
break; | |||
} | |||
} | |||
void DistrhoPluginStereoEnhancer::d_initProgramName(uint32_t index, d_string& programName) | |||
{ | |||
if (index != 0) | |||
return; | |||
programName = "Default"; | |||
} | |||
// ------------------------------------------------- | |||
// Internal data | |||
float DistrhoPluginStereoEnhancer::d_parameterValue(uint32_t index) | |||
{ | |||
switch (index) | |||
{ | |||
case paramWidthLows: | |||
return widthLP; | |||
case paramWidthHighs: | |||
return widthHP; | |||
case paramCrossover: | |||
return freqHP; | |||
default: | |||
return 0.0f; | |||
} | |||
} | |||
void DistrhoPluginStereoEnhancer::d_setParameterValue(uint32_t index, float value) | |||
{ | |||
if (d_sampleRate() <= 0.0) | |||
return; | |||
switch (index) | |||
{ | |||
case paramWidthLows: | |||
widthLP = value; | |||
widthCoeffLP = std::fmax(widthLP, 1.0f); | |||
break; | |||
case paramWidthHighs: | |||
widthHP = value; | |||
widthCoeffHP = std::fmax(widthHP, 1.0f); | |||
break; | |||
case paramCrossover: | |||
freqHPFader = value; | |||
freqHP = freqHPFader*freqHPFader*freqHPFader*24000.0f; | |||
xHP = std::exp(-2.0f * cfPI * freqHP / (float)d_sampleRate()); | |||
a0HP = 1.0f-xHP; | |||
b1HP = -xHP; | |||
break; | |||
} | |||
} | |||
void DistrhoPluginStereoEnhancer::d_setProgram(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
widthLP = 100.0f; | |||
widthHP = 100.0f; | |||
freqHPFader = 27.51604f; | |||
// Internal stuff | |||
widthCoeffLP = 1.0f; | |||
widthCoeffHP = 1.0f; | |||
freqHP = 500.0f; | |||
// reset filter values | |||
d_activate(); | |||
} | |||
// ------------------------------------------------- | |||
// Process | |||
void DistrhoPluginStereoEnhancer::d_activate() | |||
{ | |||
xHP = std::exp(-2.0f * cfPI * freqHP/ (float)d_sampleRate()); | |||
a0HP = 1.0f-xHP; | |||
b1HP = -xHP; | |||
} | |||
void DistrhoPluginStereoEnhancer::d_deactivate() | |||
{ | |||
out1HP = out2HP = 0.0f; | |||
tmp1HP = tmp2HP = 0.0f; | |||
} | |||
void DistrhoPluginStereoEnhancer::d_run(float** inputs, float** outputs, uint32_t frames, uint32_t, const MidiEvent*) | |||
{ | |||
float* in1 = inputs[0]; | |||
float* in2 = inputs[1]; | |||
float* out1 = outputs[0]; | |||
float* out2 = outputs[1]; | |||
for (uint32_t i=0; i < frames; ++i) | |||
{ | |||
out1HP = in1[i]; | |||
out2HP = in2[i]; | |||
in1[i] = (tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + cfDC_ADD); | |||
in2[i] = (tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + cfDC_ADD); | |||
out1HP -= in1[i]; | |||
out2HP -= in2[i]; | |||
monoLP = (in1[i] + in2[i]) / 2.0f; | |||
stereoLP = in1[i] - in2[i]; | |||
(*in1) = (monoLP + stereoLP * widthLP) / widthCoeffLP; | |||
(*in2) = (monoLP - stereoLP * widthLP) / widthCoeffLP; | |||
monoHP = (out1HP + out2HP) / 2.0f; | |||
stereoHP = out1HP - out2HP; | |||
out1HP = (monoHP + stereoHP * widthHP) / widthCoeffHP; | |||
out2HP = (monoHP - stereoHP * widthHP) / widthCoeffHP; | |||
out1[i] = in1[i] + out1HP; | |||
out2[i] = in2[i] + out2HP; | |||
} | |||
} | |||
// ------------------------------------------------- | |||
Plugin* createPlugin() | |||
{ | |||
return new DistrhoPluginStereoEnhancer(); | |||
} | |||
// ------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,106 @@ | |||
/* | |||
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn | |||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||
* Copyright (C) 2012-2013 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 LGPL.txt file | |||
*/ | |||
#ifndef __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
#define __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
#include "DistrhoPlugin.hpp" | |||
START_NAMESPACE_DISTRHO | |||
class DistrhoPluginStereoEnhancer : public Plugin | |||
{ | |||
public: | |||
enum Parameters | |||
{ | |||
paramWidthLows = 0, | |||
paramWidthHighs, | |||
paramCrossover, | |||
paramCount | |||
}; | |||
DistrhoPluginStereoEnhancer(); | |||
~DistrhoPluginStereoEnhancer(); | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
const char* d_label() const | |||
{ | |||
return "StereoEnhancer"; | |||
} | |||
const char* d_maker() const | |||
{ | |||
return "DISTRHO"; | |||
} | |||
const char* d_license() const | |||
{ | |||
return "LGPL"; | |||
} | |||
uint32_t d_version() const | |||
{ | |||
return 0x1000; | |||
} | |||
long d_uniqueId() const | |||
{ | |||
return d_cconst('D', 'S', 't', 'E'); | |||
} | |||
// --------------------------------------------- | |||
// Init | |||
void d_initParameter(uint32_t index, Parameter& parameter); | |||
void d_initProgramName(uint32_t index, d_string& programName); | |||
// --------------------------------------------- | |||
// Internal data | |||
float d_parameterValue(uint32_t index); | |||
void d_setParameterValue(uint32_t index, float value); | |||
void d_setProgram(uint32_t index); | |||
// --------------------------------------------- | |||
// Process | |||
void d_activate(); | |||
void d_deactivate(); | |||
void d_run(float** inputs, float** outputs, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents); | |||
// --------------------------------------------- | |||
private: | |||
float widthLP, widthCoeffLP; | |||
float freqHP, freqHPFader; | |||
float widthHP, widthCoeffHP; | |||
float xHP, a0HP, b1HP; | |||
float out1HP, out2HP; | |||
float tmp1HP, tmp2HP; | |||
float monoHP, stereoHP; | |||
float monoLP, stereoLP; | |||
}; | |||
END_NAMESPACE_DISTRHO | |||
#endif // __DISTRHO_PLUGIN_3BANDEQ_HPP__ |
@@ -0,0 +1,158 @@ | |||
/* | |||
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn | |||
* Copyright (C) 2012-2013 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 LGPL.txt file | |||
*/ | |||
#include "DistrhoUIStereoEnhancer.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
DistrhoUIStereoEnhancer::DistrhoUIStereoEnhancer() | |||
: OpenGLUI() | |||
{ | |||
Window* win = getParent(); | |||
// background | |||
fImgBackground = Image(DistrhoArtworkStereoEnhancer::backgroundData, DistrhoArtworkStereoEnhancer::backgroundWidth, DistrhoArtworkStereoEnhancer::backgroundHeight, GL_BGR); | |||
// knobs | |||
Image knobImage(DistrhoArtworkStereoEnhancer::knobData, DistrhoArtworkStereoEnhancer::knobWidth, DistrhoArtworkStereoEnhancer::knobHeight); | |||
fKnobWidthLows = new ImageKnob(win, knobImage); | |||
fKnobWidthLows->setPos(140, 35); | |||
fKnobWidthLows->setRange(0.0f, 200.0f); | |||
fKnobWidthLows->setValue(100.0f); | |||
fKnobWidthLows->setCallback(this); | |||
fKnobWidthHighs = new ImageKnob(win, knobImage); | |||
fKnobWidthHighs->setPos(362, 35); | |||
fKnobWidthHighs->setRange(0.0f, 200.0f); | |||
fKnobWidthHighs->setValue(100.0f); | |||
fKnobWidthHighs->setCallback(this); | |||
fKnobCrossover = new ImageKnob(win, knobImage); | |||
fKnobCrossover->setPos(253, 35); | |||
fKnobCrossover->setRange(0.0f, 100.0f); | |||
fKnobCrossover->setValue(27.51604f); | |||
fKnobCrossover->setCallback(this); | |||
// about button | |||
Image aboutImageNormal(DistrhoArtworkStereoEnhancer::aboutButtonNormalData, DistrhoArtworkStereoEnhancer::aboutButtonNormalWidth, DistrhoArtworkStereoEnhancer::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtworkStereoEnhancer::aboutButtonHoverData, DistrhoArtworkStereoEnhancer::aboutButtonHoverWidth, DistrhoArtworkStereoEnhancer::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(win, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(346, 3); | |||
fButtonAbout->setCallback(this); | |||
} | |||
DistrhoUIStereoEnhancer::~DistrhoUIStereoEnhancer() | |||
{ | |||
delete fKnobWidthLows; | |||
delete fKnobWidthHighs; | |||
delete fKnobCrossover; | |||
delete fButtonAbout; | |||
} | |||
// ------------------------------------------------- | |||
// DSP Callbacks | |||
void DistrhoUIStereoEnhancer::d_parameterChanged(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case DistrhoPluginStereoEnhancer::paramWidthLows: | |||
fKnobWidthLows->setValue(value); | |||
break; | |||
case DistrhoPluginStereoEnhancer::paramWidthHighs: | |||
fKnobWidthHighs->setValue(value); | |||
break; | |||
case DistrhoPluginStereoEnhancer::paramCrossover: | |||
fKnobCrossover->setValue(value); | |||
break; | |||
} | |||
} | |||
void DistrhoUIStereoEnhancer::d_programChanged(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
fKnobWidthLows->setValue(100.0f); | |||
fKnobWidthHighs->setValue(100.0f); | |||
fKnobCrossover->setValue(27.51604f); | |||
} | |||
// ------------------------------------------------- | |||
// Widget Callbacks | |||
void DistrhoUIStereoEnhancer::imageButtonClicked(ImageButton* button, int) | |||
{ | |||
if (button != fButtonAbout) | |||
return; | |||
// TODO | |||
//Image imageAbout(DistrhoArtworkStereoEnhancer::aboutData, DistrhoArtworkStereoEnhancer::aboutWidth, DistrhoArtworkStereoEnhancer::aboutHeight, GL_BGR); | |||
//ImageAboutWindow aboutWindow(getApp(), getParent(), imageAbout); | |||
//aboutWindow.exec(); | |||
} | |||
void DistrhoUIStereoEnhancer::imageKnobDragStarted(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobWidthLows) | |||
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthLows, true); | |||
else if (knob == fKnobWidthHighs) | |||
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthHighs, true); | |||
else if (knob == fKnobCrossover) | |||
d_editParameter(DistrhoPluginStereoEnhancer::paramCrossover, true); | |||
} | |||
void DistrhoUIStereoEnhancer::imageKnobDragFinished(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobWidthLows) | |||
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthLows, false); | |||
else if (knob == fKnobWidthHighs) | |||
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthHighs, false); | |||
else if (knob == fKnobCrossover) | |||
d_editParameter(DistrhoPluginStereoEnhancer::paramCrossover, false); | |||
} | |||
void DistrhoUIStereoEnhancer::imageKnobValueChanged(ImageKnob* knob, float value) | |||
{ | |||
if (knob == fKnobWidthLows) | |||
d_setParameterValue(DistrhoPluginStereoEnhancer::paramWidthLows, value); | |||
else if (knob == fKnobWidthHighs) | |||
d_setParameterValue(DistrhoPluginStereoEnhancer::paramWidthHighs, value); | |||
else if (knob == fKnobCrossover) | |||
d_setParameterValue(DistrhoPluginStereoEnhancer::paramCrossover, value); | |||
} | |||
void DistrhoUIStereoEnhancer::onDisplay() | |||
{ | |||
fImgBackground.draw(); | |||
} | |||
// ------------------------------------------------- | |||
UI* createUI() | |||
{ | |||
return new DistrhoUIStereoEnhancer(); | |||
} | |||
// ------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,82 @@ | |||
/* | |||
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn | |||
* Copyright (C) 2012-2013 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 LGPL.txt file | |||
*/ | |||
#ifndef __DISTRHO_UI_3BANDEQ_HPP__ | |||
#define __DISTRHO_UI_3BANDEQ_HPP__ | |||
#include "DistrhoUIOpenGL.hpp" | |||
#include "dgl/ImageButton.hpp" | |||
#include "dgl/ImageKnob.hpp" | |||
#include "DistrhoArtworkStereoEnhancer.hpp" | |||
#include "DistrhoPluginStereoEnhancer.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
class DistrhoUIStereoEnhancer : public OpenGLUI, | |||
public ImageButton::Callback, | |||
public ImageKnob::Callback | |||
{ | |||
public: | |||
DistrhoUIStereoEnhancer(); | |||
~DistrhoUIStereoEnhancer(); | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
unsigned int d_width() const | |||
{ | |||
return DistrhoArtworkStereoEnhancer::backgroundWidth; | |||
} | |||
unsigned int d_height() const | |||
{ | |||
return DistrhoArtworkStereoEnhancer::backgroundHeight; | |||
} | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value); | |||
void d_programChanged(uint32_t index); | |||
// --------------------------------------------- | |||
// Widget Callbacks | |||
void imageButtonClicked(ImageButton* button, int); | |||
void imageKnobDragStarted(ImageKnob* knob); | |||
void imageKnobDragFinished(ImageKnob* knob); | |||
void imageKnobValueChanged(ImageKnob* knob, float value); | |||
void onDisplay(); | |||
private: | |||
Image fImgBackground; | |||
ImageKnob* fKnobWidthLows; | |||
ImageKnob* fKnobWidthHighs; | |||
ImageKnob* fKnobCrossover; | |||
ImageButton* fButtonAbout; | |||
}; | |||
// ------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // __DISTRHO_UI_3BANDEQ_HPP__ |