| @@ -31,7 +31,7 @@ BUILD_CXX_FLAGS += -I. -I../carla-engine -I../carla-includes -I../carla-native | |||||
| BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC | BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC | ||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore) | BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore) | ||||
| LINK_FLAGS += -fPIC -shared -ldl -lm | |||||
| LINK_FLAGS += -fPIC -shared -ldl -lm -lGL | |||||
| LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui) | LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui) | ||||
| ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ||||
| @@ -0,0 +1,79 @@ | |||||
| /* | |||||
| * Carla Native Plugins | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the GNU General Public License as published by | |||||
| * the Free Software Foundation; either version 2 of the License, or | |||||
| * any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the COPYING file | |||||
| */ | |||||
| #include "carla_native.hpp" | |||||
| // Set plugin data | |||||
| #include "3bandeq/DistrhoPluginInfo.h" | |||||
| /// Set namespace for this plugin | |||||
| #define DISTRHO_NAMESPACE DISTRHO_3BEQ | |||||
| // Include DISTRHO code | |||||
| #include "DistrhoPluginCarla.cpp" | |||||
| // Include Plugin code | |||||
| #include "3bandeq/DistrhoArtwork3BandEQ.cpp" | |||||
| #include "3bandeq/DistrhoPlugin3BandEQ.cpp" | |||||
| #include "3bandeq/DistrhoUI3BandEQ.cpp" | |||||
| // ----------------------------------------------------------------------- | |||||
| class CarlaDistrhoPlugin3BandEQ : public CarlaDistrhoPlugin | |||||
| { | |||||
| public: | |||||
| CarlaDistrhoPlugin3BandEQ(const HostDescriptor* host) | |||||
| : CarlaDistrhoPlugin(host) | |||||
| { | |||||
| } | |||||
| ~CarlaDistrhoPlugin3BandEQ() | |||||
| { | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| private: | |||||
| PluginDescriptorClassEND(CarlaDistrhoPlugin3BandEQ) | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginDescriptor tBandEqDesc = { | |||||
| /* category */ PLUGIN_CATEGORY_EQ, | |||||
| /* hints */ 0x0, | |||||
| /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, | |||||
| /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, | |||||
| /* midiIns */ 0, | |||||
| /* midiOuts */ 0, | |||||
| /* paramIns */ DISTRHO_NAMESPACE::DistrhoPlugin3BandEQ::paramCount, | |||||
| /* paramOuts */ 0, | |||||
| /* name */ DISTRHO_PLUGIN_NAME, | |||||
| /* label */ "3BandEQ", | |||||
| /* maker */ "falkTX", | |||||
| /* copyright */ "LGPL", | |||||
| PluginDescriptorFILL(CarlaDistrhoPlugin3BandEQ) | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| void carla_register_native_plugin_3BandEQ() | |||||
| { | |||||
| carla_register_native_plugin(&tBandEqDesc); | |||||
| } | |||||
| // ----------------------------------------------------------------------- | |||||
| @@ -0,0 +1,40 @@ | |||||
| /* (Auto-generated binary data file). */ | |||||
| #ifndef BINARY_DISTRHOARTWORK3BANDEQ_H | |||||
| #define BINARY_DISTRHOARTWORK3BANDEQ_H | |||||
| namespace DistrhoArtwork3BandEQ | |||||
| { | |||||
| extern const char* aboutData; | |||||
| const unsigned int aboutDataSize = 230280; | |||||
| const unsigned int aboutWidth = 303; | |||||
| const unsigned int aboutHeight = 190; | |||||
| extern const char* aboutButtonHoverData; | |||||
| const unsigned int aboutButtonHoverDataSize = 11600; | |||||
| const unsigned int aboutButtonHoverWidth = 100; | |||||
| const unsigned int aboutButtonHoverHeight = 29; | |||||
| extern const char* aboutButtonNormalData; | |||||
| const unsigned int aboutButtonNormalDataSize = 11600; | |||||
| const unsigned int aboutButtonNormalWidth = 100; | |||||
| const unsigned int aboutButtonNormalHeight = 29; | |||||
| 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 = 615040; | |||||
| const unsigned int knobWidth = 62; | |||||
| const unsigned int knobHeight = 2480; | |||||
| extern const char* sliderData; | |||||
| const unsigned int sliderDataSize = 6000; | |||||
| const unsigned int sliderWidth = 50; | |||||
| const unsigned int sliderHeight = 30; | |||||
| } | |||||
| #endif // BINARY_DISTRHOARTWORK3BANDEQ_H | |||||
| @@ -0,0 +1,260 @@ | |||||
| /* | |||||
| * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
| * Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #include "DistrhoPlugin3BandEQ.h" | |||||
| #include <cmath> | |||||
| const float cfAMP_DB = 8.656170245f; | |||||
| const float cfDC_ADD = 1e-30f; | |||||
| const float cfPI = 3.141592654f; | |||||
| START_NAMESPACE_DISTRHO | |||||
| // ------------------------------------------------- | |||||
| DistrhoPlugin3BandEQ::DistrhoPlugin3BandEQ() | |||||
| : Plugin(paramCount, 1, 0) // 1 program, 0 states | |||||
| { | |||||
| // set default values | |||||
| d_setProgram(0); | |||||
| // reset | |||||
| d_deactivate(); | |||||
| } | |||||
| DistrhoPlugin3BandEQ::~DistrhoPlugin3BandEQ() | |||||
| { | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| // 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_parameterValue(uint32_t index) | |||||
| { | |||||
| 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_sampleRate() <= 0.0) | |||||
| return; | |||||
| switch (index) | |||||
| { | |||||
| case paramLow: | |||||
| fLow = value; | |||||
| lowVol = exp( (fLow/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramMid: | |||||
| fMid = value; | |||||
| midVol = exp( (fMid/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramHigh: | |||||
| fHigh = value; | |||||
| highVol = exp( (fHigh/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramMaster: | |||||
| fMaster = value; | |||||
| outVol = exp( (fMaster/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramLowMidFreq: | |||||
| fLowMidFreq = d_minf(value, fMidHighFreq); | |||||
| freqLP = fLowMidFreq; //fLowMidFreq * (fLowMidFreq / 24000.0f) * (fLowMidFreq / 24000.0f); | |||||
| xLP = exp(-2.0 * cfPI * freqLP / d_sampleRate()); | |||||
| a0LP = 1.0 - xLP; | |||||
| b1LP = -xLP; | |||||
| break; | |||||
| case paramMidHighFreq: | |||||
| fMidHighFreq = d_maxf(value, fLowMidFreq); | |||||
| freqHP = fMidHighFreq; //fMidHighFreq * (fMidHighFreq / 24000.0f) * (fMidHighFreq / 24000.0f); | |||||
| xHP = exp(-2.0 * cfPI * freqHP / d_sampleRate()); | |||||
| a0HP = 1.0 - 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() | |||||
| { | |||||
| xLP = exp(-2.0 * cfPI * freqLP / d_sampleRate()); | |||||
| a0LP = 1.0f - xLP; | |||||
| b1LP = -xLP; | |||||
| xHP = exp(-2.0 * cfPI * freqHP / d_sampleRate()); | |||||
| 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, uint32_t, const MidiEvent*) | |||||
| { | |||||
| 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 + cfDC_ADD; | |||||
| tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + cfDC_ADD; | |||||
| out1LP = tmp1LP - cfDC_ADD; | |||||
| out2LP = tmp2LP - cfDC_ADD; | |||||
| tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + cfDC_ADD; | |||||
| tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + cfDC_ADD; | |||||
| out1HP = in1[i] - tmp1HP - cfDC_ADD; | |||||
| out2HP = in2[i] - tmp2HP - cfDC_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; | |||||
| } | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| #ifndef DISTRHO_NAMESPACE | |||||
| Plugin* createPlugin() | |||||
| { | |||||
| return new DistrhoPlugin3BandEQ(); | |||||
| } | |||||
| #endif | |||||
| END_NAMESPACE_DISTRHO | |||||
| @@ -0,0 +1,102 @@ | |||||
| /* | |||||
| * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
| * Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #ifndef __DISTRHO_PLUGIN_3BANDEQ_H__ | |||||
| #define __DISTRHO_PLUGIN_3BANDEQ_H__ | |||||
| #include "DistrhoPlugin.h" | |||||
| START_NAMESPACE_DISTRHO | |||||
| class DistrhoPlugin3BandEQ : public Plugin | |||||
| { | |||||
| public: | |||||
| enum Parameters | |||||
| { | |||||
| paramLow = 0, | |||||
| paramMid, | |||||
| paramHigh, | |||||
| paramMaster, | |||||
| paramLowMidFreq, | |||||
| paramMidHighFreq, | |||||
| paramCount | |||||
| }; | |||||
| DistrhoPlugin3BandEQ(); | |||||
| ~DistrhoPlugin3BandEQ(); | |||||
| // --------------------------------------------- | |||||
| protected: | |||||
| // Information | |||||
| const char* d_label() | |||||
| { | |||||
| return "3BandEQ"; | |||||
| } | |||||
| const char* d_maker() | |||||
| { | |||||
| return "DISTRHO"; | |||||
| } | |||||
| const char* d_license() | |||||
| { | |||||
| return "LGPL"; | |||||
| } | |||||
| uint32_t d_version() | |||||
| { | |||||
| return 0x1000; | |||||
| } | |||||
| long d_uniqueId() | |||||
| { | |||||
| return d_cconst('D', '3', 'E', 'Q'); | |||||
| } | |||||
| // 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(const float** inputs, float** outputs, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents); | |||||
| // --------------------------------------------- | |||||
| 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; | |||||
| }; | |||||
| END_NAMESPACE_DISTRHO | |||||
| #endif // __DISTRHO_PLUGIN_3BANDEQ_H__ | |||||
| @@ -0,0 +1,34 @@ | |||||
| /* | |||||
| * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
| * Copyright (C) 2012 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 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 "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_URI "http://distrho.sf.net/plugins/3BandEQ" | |||||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||||
| @@ -0,0 +1,231 @@ | |||||
| /* | |||||
| * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #include "DistrhoUI3BandEQ.h" | |||||
| START_NAMESPACE_DISTRHO | |||||
| // ------------------------------------------------- | |||||
| DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||||
| : OpenGLExtUI() | |||||
| { | |||||
| // background | |||||
| Image bgImage(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR); | |||||
| setBackgroundImage(bgImage); | |||||
| // sliders | |||||
| Image sliderImage(DistrhoArtwork3BandEQ::sliderData, DistrhoArtwork3BandEQ::sliderWidth, DistrhoArtwork3BandEQ::sliderHeight); | |||||
| Point sliderPosStart(57, 43); | |||||
| Point sliderPosEnd(57, 43 + 160); | |||||
| // slider Low | |||||
| sliderLow = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderLow->setRange(-24.0f, 24.0f); | |||||
| sliderLow->setValue(0.0f); | |||||
| addImageSlider(sliderLow); | |||||
| // slider Mid | |||||
| sliderPosStart.setX(120); | |||||
| sliderPosEnd.setX(120); | |||||
| sliderMid = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderMid->setRange(-24.0f, 24.0f); | |||||
| sliderMid->setValue(0.0f); | |||||
| addImageSlider(sliderMid); | |||||
| // slider High | |||||
| sliderPosStart.setX(183); | |||||
| sliderPosEnd.setX(183); | |||||
| sliderHigh = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderHigh->setRange(-24.0f, 24.0f); | |||||
| sliderHigh->setValue(0.0f); | |||||
| addImageSlider(sliderHigh); | |||||
| // slider Master | |||||
| sliderPosStart.setX(287); | |||||
| sliderPosEnd.setX(287); | |||||
| sliderMaster = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderMaster->setRange(-24.0f, 24.0f); | |||||
| sliderMaster->setValue(0.0f); | |||||
| addImageSlider(sliderMaster); | |||||
| // knobs | |||||
| Image knobImage(DistrhoArtwork3BandEQ::knobData, DistrhoArtwork3BandEQ::knobWidth, DistrhoArtwork3BandEQ::knobHeight); | |||||
| Point knobPos(66, 270); | |||||
| // knob Low-Mid | |||||
| knobLowMid = new ImageKnob(knobImage, knobPos); | |||||
| knobLowMid->setRange(0.0f, 1000.0f); | |||||
| knobLowMid->setValue(220.0f); | |||||
| addImageKnob(knobLowMid); | |||||
| // knob Mid-High | |||||
| knobPos.setX(160); | |||||
| knobMidHigh = new ImageKnob(knobImage, knobPos); | |||||
| knobMidHigh->setRange(1000.0f, 20000.0f); | |||||
| knobMidHigh->setValue(2000.0f); | |||||
| addImageKnob(knobMidHigh); | |||||
| // about button | |||||
| Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight); | |||||
| Image aboutImageHover(DistrhoArtwork3BandEQ::aboutButtonHoverData, DistrhoArtwork3BandEQ::aboutButtonHoverWidth, DistrhoArtwork3BandEQ::aboutButtonHoverHeight); | |||||
| Point aboutPos(264, 300); | |||||
| buttonAbout = new ImageButton(aboutImageNormal, aboutImageHover, aboutImageHover, aboutPos); | |||||
| addImageButton(buttonAbout); | |||||
| } | |||||
| DistrhoUI3BandEQ::~DistrhoUI3BandEQ() | |||||
| { | |||||
| delete sliderLow; | |||||
| delete sliderMid; | |||||
| delete sliderHigh; | |||||
| delete sliderMaster; | |||||
| delete knobLowMid; | |||||
| delete knobMidHigh; | |||||
| delete buttonAbout; | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| // DSP Callbacks | |||||
| void DistrhoUI3BandEQ::d_parameterChanged(uint32_t index, float value) | |||||
| { | |||||
| switch (index) | |||||
| { | |||||
| case DistrhoPlugin3BandEQ::paramLow: | |||||
| sliderLow->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandEQ::paramMid: | |||||
| sliderMid->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandEQ::paramHigh: | |||||
| sliderHigh->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandEQ::paramMaster: | |||||
| sliderMaster->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandEQ::paramLowMidFreq: | |||||
| knobLowMid->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandEQ::paramMidHighFreq: | |||||
| knobMidHigh->setValue(value); | |||||
| break; | |||||
| } | |||||
| d_uiRepaint(); | |||||
| } | |||||
| void DistrhoUI3BandEQ::d_programChanged(uint32_t index) | |||||
| { | |||||
| if (index != 0) | |||||
| return; | |||||
| // Default values | |||||
| sliderLow->setValue(0.0f); | |||||
| sliderMid->setValue(0.0f); | |||||
| sliderHigh->setValue(0.0f); | |||||
| sliderMaster->setValue(0.0f); | |||||
| knobLowMid->setValue(220.0f); | |||||
| knobMidHigh->setValue(2000.0f); | |||||
| d_uiRepaint(); | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| // Extended Callbacks | |||||
| void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button) | |||||
| { | |||||
| if (button != buttonAbout) | |||||
| return; | |||||
| Image imageAbout(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGRA); | |||||
| showImageModalDialog(imageAbout, "About"); | |||||
| } | |||||
| void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob) | |||||
| { | |||||
| if (knob == knobLowMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, true); | |||||
| else if (knob == knobMidHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, true); | |||||
| } | |||||
| void DistrhoUI3BandEQ::imageKnobDragFinished(ImageKnob* knob) | |||||
| { | |||||
| if (knob == knobLowMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, false); | |||||
| else if (knob == knobMidHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, false); | |||||
| } | |||||
| void DistrhoUI3BandEQ::imageKnobValueChanged(ImageKnob* knob, float value) | |||||
| { | |||||
| if (knob == knobLowMid) | |||||
| d_setParameterValue(DistrhoPlugin3BandEQ::paramLowMidFreq, value); | |||||
| else if (knob == knobMidHigh) | |||||
| d_setParameterValue(DistrhoPlugin3BandEQ::paramMidHighFreq, value); | |||||
| } | |||||
| void DistrhoUI3BandEQ::imageSliderDragStarted(ImageSlider* slider) | |||||
| { | |||||
| if (slider == sliderLow) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramLow, true); | |||||
| else if (slider == sliderMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramMid, true); | |||||
| else if (slider == sliderHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramHigh, true); | |||||
| else if (slider == sliderMaster) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramMaster, true); | |||||
| } | |||||
| void DistrhoUI3BandEQ::imageSliderDragFinished(ImageSlider* slider) | |||||
| { | |||||
| if (slider == sliderLow) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramLow, false); | |||||
| else if (slider == sliderMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramMid, false); | |||||
| else if (slider == sliderHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramHigh, false); | |||||
| else if (slider == sliderMaster) | |||||
| d_uiEditParameter(DistrhoPlugin3BandEQ::paramMaster, false); | |||||
| } | |||||
| void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
| { | |||||
| if (slider == sliderLow) | |||||
| d_setParameterValue(DistrhoPlugin3BandEQ::paramLow, value); | |||||
| else if (slider == sliderMid) | |||||
| d_setParameterValue(DistrhoPlugin3BandEQ::paramMid, value); | |||||
| else if (slider == sliderHigh) | |||||
| d_setParameterValue(DistrhoPlugin3BandEQ::paramHigh, value); | |||||
| else if (slider == sliderMaster) | |||||
| d_setParameterValue(DistrhoPlugin3BandEQ::paramMaster, value); | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| #ifndef DISTRHO_NAMESPACE | |||||
| UI* createUI() | |||||
| { | |||||
| return new DistrhoUI3BandEQ; | |||||
| } | |||||
| #endif | |||||
| // ------------------------------------------------- | |||||
| END_NAMESPACE_DISTRHO | |||||
| @@ -0,0 +1,76 @@ | |||||
| /* | |||||
| * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #ifndef __DISTRHO_UI_3BANDEQ_H__ | |||||
| #define __DISTRHO_UI_3BANDEQ_H__ | |||||
| #include "DistrhoUIOpenGLExt.h" | |||||
| #include "DistrhoArtwork3BandEQ.h" | |||||
| #include "DistrhoPlugin3BandEQ.h" | |||||
| START_NAMESPACE_DISTRHO | |||||
| // ------------------------------------------------- | |||||
| class DistrhoUI3BandEQ : public OpenGLExtUI | |||||
| { | |||||
| public: | |||||
| DistrhoUI3BandEQ(); | |||||
| ~DistrhoUI3BandEQ(); | |||||
| // --------------------------------------------- | |||||
| protected: | |||||
| // Information | |||||
| unsigned int d_width() | |||||
| { | |||||
| return DistrhoArtwork3BandEQ::backgroundWidth; | |||||
| } | |||||
| unsigned int d_height() | |||||
| { | |||||
| return DistrhoArtwork3BandEQ::backgroundHeight; | |||||
| } | |||||
| // DSP Callbacks | |||||
| void d_parameterChanged(uint32_t index, float value); | |||||
| void d_programChanged(uint32_t index); | |||||
| // Extended Callbacks | |||||
| void imageButtonClicked(ImageButton* button); | |||||
| void imageKnobDragStarted(ImageKnob* knob); | |||||
| void imageKnobDragFinished(ImageKnob* knob); | |||||
| void imageKnobValueChanged(ImageKnob* knob, float value); | |||||
| void imageSliderDragStarted(ImageSlider* slider); | |||||
| void imageSliderDragFinished(ImageSlider* slider); | |||||
| void imageSliderValueChanged(ImageSlider* slider, float value); | |||||
| private: | |||||
| ImageSlider* sliderLow; | |||||
| ImageSlider* sliderMid; | |||||
| ImageSlider* sliderHigh; | |||||
| ImageSlider* sliderMaster; | |||||
| ImageKnob* knobLowMid; | |||||
| ImageKnob* knobMidHigh; | |||||
| ImageButton* buttonAbout; | |||||
| }; | |||||
| // ------------------------------------------------- | |||||
| END_NAMESPACE_DISTRHO | |||||
| #endif // __DISTRHO_UI_3BANDEQ_H__ | |||||
| @@ -0,0 +1,79 @@ | |||||
| /* | |||||
| * Carla Native Plugins | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the GNU General Public License as published by | |||||
| * the Free Software Foundation; either version 2 of the License, or | |||||
| * any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the COPYING file | |||||
| */ | |||||
| #include "carla_native.hpp" | |||||
| // Set plugin data | |||||
| #include "3bandsplitter/DistrhoPluginInfo.h" | |||||
| /// Set namespace for this plugin | |||||
| #define DISTRHO_NAMESPACE DISTRHO_3BSP | |||||
| // Include DISTRHO code | |||||
| #include "DistrhoPluginCarla.cpp" | |||||
| // Include Plugin code | |||||
| #include "3bandsplitter/DistrhoArtwork3BandSplitter.cpp" | |||||
| #include "3bandsplitter/DistrhoPlugin3BandSplitter.cpp" | |||||
| #include "3bandsplitter/DistrhoUI3BandSplitter.cpp" | |||||
| // ----------------------------------------------------------------------- | |||||
| class CarlaDistrhoPlugin3BandSplitter : public CarlaDistrhoPlugin | |||||
| { | |||||
| public: | |||||
| CarlaDistrhoPlugin3BandSplitter(const HostDescriptor* host) | |||||
| : CarlaDistrhoPlugin(host) | |||||
| { | |||||
| } | |||||
| ~CarlaDistrhoPlugin3BandSplitter() | |||||
| { | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| private: | |||||
| PluginDescriptorClassEND(CarlaDistrhoPlugin3BandSplitter) | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginDescriptor tBandSplitterDesc = { | |||||
| /* category */ PLUGIN_CATEGORY_EQ, | |||||
| /* hints */ 0x0, | |||||
| /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, | |||||
| /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, | |||||
| /* midiIns */ 0, | |||||
| /* midiOuts */ 0, | |||||
| /* paramIns */ DISTRHO_NAMESPACE::DistrhoPlugin3BandSplitter::paramCount, | |||||
| /* paramOuts */ 0, | |||||
| /* name */ DISTRHO_PLUGIN_NAME, | |||||
| /* label */ "3BandSplitter", | |||||
| /* maker */ "falkTX", | |||||
| /* copyright */ "LGPL", | |||||
| PluginDescriptorFILL(CarlaDistrhoPlugin3BandSplitter) | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| void carla_register_native_plugin_3BandSplitter() | |||||
| { | |||||
| carla_register_native_plugin(&tBandSplitterDesc); | |||||
| } | |||||
| // ----------------------------------------------------------------------- | |||||
| @@ -0,0 +1,40 @@ | |||||
| /* (Auto-generated binary data file). */ | |||||
| #ifndef BINARY_DISTRHOARTWORK3BANDSPLITTER_H | |||||
| #define BINARY_DISTRHOARTWORK3BANDSPLITTER_H | |||||
| namespace DistrhoArtwork3BandSplitter | |||||
| { | |||||
| extern const char* aboutData; | |||||
| const unsigned int aboutDataSize = 230280; | |||||
| const unsigned int aboutWidth = 303; | |||||
| const unsigned int aboutHeight = 190; | |||||
| extern const char* aboutButtonHoverData; | |||||
| const unsigned int aboutButtonHoverDataSize = 11600; | |||||
| const unsigned int aboutButtonHoverWidth = 100; | |||||
| const unsigned int aboutButtonHoverHeight = 29; | |||||
| extern const char* aboutButtonNormalData; | |||||
| const unsigned int aboutButtonNormalDataSize = 11600; | |||||
| const unsigned int aboutButtonNormalWidth = 100; | |||||
| const unsigned int aboutButtonNormalHeight = 29; | |||||
| 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 = 615040; | |||||
| const unsigned int knobWidth = 62; | |||||
| const unsigned int knobHeight = 2480; | |||||
| extern const char* sliderData; | |||||
| const unsigned int sliderDataSize = 6000; | |||||
| const unsigned int sliderWidth = 50; | |||||
| const unsigned int sliderHeight = 30; | |||||
| } | |||||
| #endif // BINARY_DISTRHOARTWORK3BANDSPLITTER_H | |||||
| @@ -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 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #include "DistrhoPlugin3BandSplitter.h" | |||||
| #include <cmath> | |||||
| const float cfAMP_DB = 8.656170245f; | |||||
| const float cfDC_ADD = 1e-30f; | |||||
| const float cfPI = 3.141592654f; | |||||
| START_NAMESPACE_DISTRHO | |||||
| // ------------------------------------------------- | |||||
| DistrhoPlugin3BandSplitter::DistrhoPlugin3BandSplitter() | |||||
| : Plugin(paramCount, 1, 0) // 1 program, 0 states | |||||
| { | |||||
| // set default values | |||||
| d_setProgram(0); | |||||
| // reset | |||||
| d_deactivate(); | |||||
| } | |||||
| DistrhoPlugin3BandSplitter::~DistrhoPlugin3BandSplitter() | |||||
| { | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| // 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_parameterValue(uint32_t index) | |||||
| { | |||||
| 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_sampleRate() <= 0.0) | |||||
| return; | |||||
| switch (index) | |||||
| { | |||||
| case paramLow: | |||||
| fLow = value; | |||||
| lowVol = exp( (fLow/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramMid: | |||||
| fMid = value; | |||||
| midVol = exp( (fMid/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramHigh: | |||||
| fHigh = value; | |||||
| highVol = exp( (fHigh/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramMaster: | |||||
| fMaster = value; | |||||
| outVol = exp( (fMaster/48.0f) * 48 / cfAMP_DB); | |||||
| break; | |||||
| case paramLowMidFreq: | |||||
| fLowMidFreq = d_minf(value, fMidHighFreq); | |||||
| freqLP = fLowMidFreq; //fLowMidFreq * (fLowMidFreq / 24000.0f) * (fLowMidFreq / 24000.0f); | |||||
| xLP = exp(-2.0 * cfPI * freqLP / d_sampleRate()); | |||||
| a0LP = 1.0 - xLP; | |||||
| b1LP = -xLP; | |||||
| break; | |||||
| case paramMidHighFreq: | |||||
| fMidHighFreq = d_maxf(value, fLowMidFreq); | |||||
| freqHP = fMidHighFreq; //fMidHighFreq * (fMidHighFreq / 24000.0f) * (fMidHighFreq / 24000.0f); | |||||
| xHP = exp(-2.0 * cfPI * freqHP / d_sampleRate()); | |||||
| a0HP = 1.0 - 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() | |||||
| { | |||||
| xLP = exp(-2.0 * cfPI * freqLP / d_sampleRate()); | |||||
| a0LP = 1.0f - xLP; | |||||
| b1LP = -xLP; | |||||
| xHP = exp(-2.0 * cfPI * freqHP / d_sampleRate()); | |||||
| 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, uint32_t, const MidiEvent*) | |||||
| { | |||||
| 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 + cfDC_ADD; | |||||
| tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + cfDC_ADD; | |||||
| out1LP = tmp1LP - cfDC_ADD; | |||||
| out2LP = tmp2LP - cfDC_ADD; | |||||
| tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + cfDC_ADD; | |||||
| tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + cfDC_ADD; | |||||
| out1HP = in1[i] - tmp1HP - cfDC_ADD; | |||||
| out2HP = in2[i] - tmp2HP - cfDC_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,102 @@ | |||||
| /* | |||||
| * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
| * Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #ifndef __DISTRHO_PLUGIN_3BANDSPLITTER_H__ | |||||
| #define __DISTRHO_PLUGIN_3BANDSPLITTER_H__ | |||||
| #include "DistrhoPlugin.h" | |||||
| START_NAMESPACE_DISTRHO | |||||
| class DistrhoPlugin3BandSplitter : public Plugin | |||||
| { | |||||
| public: | |||||
| enum Parameters | |||||
| { | |||||
| paramLow = 0, | |||||
| paramMid, | |||||
| paramHigh, | |||||
| paramMaster, | |||||
| paramLowMidFreq, | |||||
| paramMidHighFreq, | |||||
| paramCount | |||||
| }; | |||||
| DistrhoPlugin3BandSplitter(); | |||||
| ~DistrhoPlugin3BandSplitter(); | |||||
| // --------------------------------------------- | |||||
| protected: | |||||
| // Information | |||||
| const char* d_label() | |||||
| { | |||||
| return "3BandSplitter"; | |||||
| } | |||||
| const char* d_maker() | |||||
| { | |||||
| return "DISTRHO"; | |||||
| } | |||||
| const char* d_license() | |||||
| { | |||||
| return "LGPL"; | |||||
| } | |||||
| uint32_t d_version() | |||||
| { | |||||
| return 0x1000; | |||||
| } | |||||
| long d_uniqueId() | |||||
| { | |||||
| return d_cconst('D', '3', 'E', 'S'); | |||||
| } | |||||
| // 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(const float** inputs, float** outputs, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents); | |||||
| // --------------------------------------------- | |||||
| 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; | |||||
| }; | |||||
| END_NAMESPACE_DISTRHO | |||||
| #endif // __DISTRHO_PLUGIN_3BANDSPLITTER_H__ | |||||
| @@ -0,0 +1,34 @@ | |||||
| /* | |||||
| * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
| * Copyright (C) 2012 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 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 "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_URI "http://distrho.sf.net/plugins/3BandSplitter" | |||||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||||
| @@ -0,0 +1,227 @@ | |||||
| /* | |||||
| * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #include "DistrhoUI3BandSplitter.h" | |||||
| START_NAMESPACE_DISTRHO | |||||
| // ------------------------------------------------- | |||||
| DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() | |||||
| : OpenGLExtUI() | |||||
| { | |||||
| // background | |||||
| Image bgImage(DistrhoArtwork3BandSplitter::backgroundData, DistrhoArtwork3BandSplitter::backgroundWidth, DistrhoArtwork3BandSplitter::backgroundHeight, GL_BGR); | |||||
| setBackgroundImage(bgImage); | |||||
| // sliders | |||||
| Image sliderImage(DistrhoArtwork3BandSplitter::sliderData, DistrhoArtwork3BandSplitter::sliderWidth, DistrhoArtwork3BandSplitter::sliderHeight); | |||||
| Point sliderPosStart(57, 43); | |||||
| Point sliderPosEnd(57, 43 + 160); | |||||
| // slider Low | |||||
| sliderLow = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderLow->setRange(-24.0f, 24.0f); | |||||
| sliderLow->setValue(0.0f); | |||||
| addImageSlider(sliderLow); | |||||
| // slider Mid | |||||
| sliderPosStart.setX(120); | |||||
| sliderPosEnd.setX(120); | |||||
| sliderMid = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderMid->setRange(-24.0f, 24.0f); | |||||
| sliderMid->setValue(0.0f); | |||||
| addImageSlider(sliderMid); | |||||
| // slider High | |||||
| sliderPosStart.setX(183); | |||||
| sliderPosEnd.setX(183); | |||||
| sliderHigh = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderHigh->setRange(-24.0f, 24.0f); | |||||
| sliderHigh->setValue(0.0f); | |||||
| addImageSlider(sliderHigh); | |||||
| // slider Master | |||||
| sliderPosStart.setX(287); | |||||
| sliderPosEnd.setX(287); | |||||
| sliderMaster = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd); | |||||
| sliderMaster->setRange(-24.0f, 24.0f); | |||||
| sliderMaster->setValue(0.0f); | |||||
| addImageSlider(sliderMaster); | |||||
| // knobs | |||||
| Image knobImage(DistrhoArtwork3BandSplitter::knobData, DistrhoArtwork3BandSplitter::knobWidth, DistrhoArtwork3BandSplitter::knobHeight); | |||||
| Point knobPos(66, 270); | |||||
| // knob Low-Mid | |||||
| knobLowMid = new ImageKnob(knobImage, knobPos); | |||||
| knobLowMid->setRange(0.0f, 1000.0f); | |||||
| knobLowMid->setValue(220.0f); | |||||
| addImageKnob(knobLowMid); | |||||
| // knob Mid-High | |||||
| knobPos.setX(160); | |||||
| knobMidHigh = new ImageKnob(knobImage, knobPos); | |||||
| knobMidHigh->setRange(1000.0f, 20000.0f); | |||||
| knobMidHigh->setValue(2000.0f); | |||||
| addImageKnob(knobMidHigh); | |||||
| // about button | |||||
| Image aboutImageNormal(DistrhoArtwork3BandSplitter::aboutButtonNormalData, DistrhoArtwork3BandSplitter::aboutButtonNormalWidth, DistrhoArtwork3BandSplitter::aboutButtonNormalHeight); | |||||
| Image aboutImageHover(DistrhoArtwork3BandSplitter::aboutButtonHoverData, DistrhoArtwork3BandSplitter::aboutButtonHoverWidth, DistrhoArtwork3BandSplitter::aboutButtonHoverHeight); | |||||
| Point aboutPos(264, 300); | |||||
| buttonAbout = new ImageButton(aboutImageNormal, aboutImageHover, aboutImageHover, aboutPos); | |||||
| addImageButton(buttonAbout); | |||||
| } | |||||
| DistrhoUI3BandSplitter::~DistrhoUI3BandSplitter() | |||||
| { | |||||
| delete sliderLow; | |||||
| delete sliderMid; | |||||
| delete sliderHigh; | |||||
| delete sliderMaster; | |||||
| delete knobLowMid; | |||||
| delete knobMidHigh; | |||||
| delete buttonAbout; | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| // DSP Callbacks | |||||
| void DistrhoUI3BandSplitter::d_parameterChanged(uint32_t index, float value) | |||||
| { | |||||
| switch (index) | |||||
| { | |||||
| case DistrhoPlugin3BandSplitter::paramLow: | |||||
| sliderLow->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandSplitter::paramMid: | |||||
| sliderMid->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandSplitter::paramHigh: | |||||
| sliderHigh->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandSplitter::paramMaster: | |||||
| sliderMaster->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandSplitter::paramLowMidFreq: | |||||
| knobLowMid->setValue(value); | |||||
| break; | |||||
| case DistrhoPlugin3BandSplitter::paramMidHighFreq: | |||||
| knobMidHigh->setValue(value); | |||||
| break; | |||||
| } | |||||
| d_uiRepaint(); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::d_programChanged(uint32_t index) | |||||
| { | |||||
| if (index != 0) | |||||
| return; | |||||
| // Default values | |||||
| sliderLow->setValue(0.0f); | |||||
| sliderMid->setValue(0.0f); | |||||
| sliderHigh->setValue(0.0f); | |||||
| sliderMaster->setValue(0.0f); | |||||
| knobLowMid->setValue(220.0f); | |||||
| knobMidHigh->setValue(2000.0f); | |||||
| d_uiRepaint(); | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| // Extended Callbacks | |||||
| void DistrhoUI3BandSplitter::imageButtonClicked(ImageButton* button) | |||||
| { | |||||
| if (button != buttonAbout) | |||||
| return; | |||||
| Image imageAbout(DistrhoArtwork3BandSplitter::aboutData, DistrhoArtwork3BandSplitter::aboutWidth, DistrhoArtwork3BandSplitter::aboutHeight, GL_BGRA); | |||||
| showImageModalDialog(imageAbout, "About"); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::imageKnobDragStarted(ImageKnob* knob) | |||||
| { | |||||
| if (knob == knobLowMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramLowMidFreq, true); | |||||
| else if (knob == knobMidHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramMidHighFreq, true); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::imageKnobDragFinished(ImageKnob* knob) | |||||
| { | |||||
| if (knob == knobLowMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramLowMidFreq, false); | |||||
| else if (knob == knobMidHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramMidHighFreq, false); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::imageKnobValueChanged(ImageKnob* knob, float value) | |||||
| { | |||||
| if (knob == knobLowMid) | |||||
| d_setParameterValue(DistrhoPlugin3BandSplitter::paramLowMidFreq, value); | |||||
| else if (knob == knobMidHigh) | |||||
| d_setParameterValue(DistrhoPlugin3BandSplitter::paramMidHighFreq, value); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::imageSliderDragStarted(ImageSlider* slider) | |||||
| { | |||||
| if (slider == sliderLow) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramLow, true); | |||||
| else if (slider == sliderMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramMid, true); | |||||
| else if (slider == sliderHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramHigh, true); | |||||
| else if (slider == sliderMaster) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramMaster, true); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::imageSliderDragFinished(ImageSlider* slider) | |||||
| { | |||||
| if (slider == sliderLow) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramLow, false); | |||||
| else if (slider == sliderMid) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramMid, false); | |||||
| else if (slider == sliderHigh) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramHigh, false); | |||||
| else if (slider == sliderMaster) | |||||
| d_uiEditParameter(DistrhoPlugin3BandSplitter::paramMaster, false); | |||||
| } | |||||
| void DistrhoUI3BandSplitter::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
| { | |||||
| if (slider == sliderLow) | |||||
| d_setParameterValue(DistrhoPlugin3BandSplitter::paramLow, value); | |||||
| else if (slider == sliderMid) | |||||
| d_setParameterValue(DistrhoPlugin3BandSplitter::paramMid, value); | |||||
| else if (slider == sliderHigh) | |||||
| d_setParameterValue(DistrhoPlugin3BandSplitter::paramHigh, value); | |||||
| else if (slider == sliderMaster) | |||||
| d_setParameterValue(DistrhoPlugin3BandSplitter::paramMaster, value); | |||||
| } | |||||
| // ------------------------------------------------- | |||||
| UI* createUI() | |||||
| { | |||||
| return new DistrhoUI3BandSplitter; | |||||
| } | |||||
| END_NAMESPACE_DISTRHO | |||||
| @@ -0,0 +1,76 @@ | |||||
| /* | |||||
| * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
| * Copyright (C) 2012 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the LGPL.txt file | |||||
| */ | |||||
| #ifndef __DISTRHO_UI_3BANDSPLITTER_H__ | |||||
| #define __DISTRHO_UI_3BANDSPLITTER_H__ | |||||
| #include "DistrhoUIOpenGLExt.h" | |||||
| #include "DistrhoArtwork3BandSplitter.h" | |||||
| #include "DistrhoPlugin3BandSplitter.h" | |||||
| START_NAMESPACE_DISTRHO | |||||
| // ------------------------------------------------- | |||||
| class DistrhoUI3BandSplitter : public OpenGLExtUI | |||||
| { | |||||
| public: | |||||
| DistrhoUI3BandSplitter(); | |||||
| ~DistrhoUI3BandSplitter(); | |||||
| // --------------------------------------------- | |||||
| protected: | |||||
| // Information | |||||
| unsigned int d_width() | |||||
| { | |||||
| return DistrhoArtwork3BandSplitter::backgroundWidth; | |||||
| } | |||||
| unsigned int d_height() | |||||
| { | |||||
| return DistrhoArtwork3BandSplitter::backgroundHeight; | |||||
| } | |||||
| // DSP Callbacks | |||||
| void d_parameterChanged(uint32_t index, float value); | |||||
| void d_programChanged(uint32_t index); | |||||
| // Extended Callbacks | |||||
| void imageButtonClicked(ImageButton* button); | |||||
| void imageKnobDragStarted(ImageKnob* knob); | |||||
| void imageKnobDragFinished(ImageKnob* knob); | |||||
| void imageKnobValueChanged(ImageKnob* knob, float value); | |||||
| void imageSliderDragStarted(ImageSlider* slider); | |||||
| void imageSliderDragFinished(ImageSlider* slider); | |||||
| void imageSliderValueChanged(ImageSlider* slider, float value); | |||||
| private: | |||||
| ImageSlider* sliderLow; | |||||
| ImageSlider* sliderMid; | |||||
| ImageSlider* sliderHigh; | |||||
| ImageSlider* sliderMaster; | |||||
| ImageKnob* knobLowMid; | |||||
| ImageKnob* knobMidHigh; | |||||
| ImageButton* buttonAbout; | |||||
| }; | |||||
| // ------------------------------------------------- | |||||
| END_NAMESPACE_DISTRHO | |||||
| #endif // __DISTRHO_UI_3BANDSPLITTER_H__ | |||||
| @@ -12,7 +12,7 @@ HAVE_ZYN_GUI_DEPS = $(shell which ntk-config) | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| BUILD_C_FLAGS += -fvisibility=hidden -fPIC -I. | BUILD_C_FLAGS += -fvisibility=hidden -fPIC -I. | ||||
| BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I. -I../carla-includes -I../carla-utils | |||||
| BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I. -Idistrho -I../carla-includes -I../carla-utils -I../distrho-plugin-toolkit | |||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore) | BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore) | ||||
| ifeq ($(HAVE_ZYN_DEPS),true) | ifeq ($(HAVE_ZYN_DEPS),true) | ||||
| @@ -23,10 +23,15 @@ BUILD_CXX_FLAGS += $(shell ntk-config --cxxflags) -DWANT_ZYNADDSUBFX_GUI | |||||
| endif | endif | ||||
| endif | endif | ||||
| OBJS = \ | |||||
| OBJS = \ | |||||
| bypass.o \ | bypass.o \ | ||||
| midi-split.o | midi-split.o | ||||
| OBJS += \ | |||||
| 3bandeq.o \ | |||||
| 3bandsplitter.o \ | |||||
| distrho/pugl.o | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| ifeq ($(HAVE_ZYN_DEPS),true) | ifeq ($(HAVE_ZYN_DEPS),true) | ||||
| @@ -61,10 +61,10 @@ static PluginDescriptor bypassDesc = { | |||||
| .instantiate = bypass_instantiate, | .instantiate = bypass_instantiate, | ||||
| .get_parameter_count = NULL, | |||||
| .get_parameter_info = NULL, | |||||
| .get_parameter_value = NULL, | |||||
| .get_parameter_text = NULL, | |||||
| .get_parameter_count = NULL, | |||||
| .get_parameter_info = NULL, | |||||
| .get_parameter_value = NULL, | |||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -181,6 +181,10 @@ void carla_register_native_plugin_midiSplit(); | |||||
| void carla_register_native_plugin_zynaddsubfx(); | void carla_register_native_plugin_zynaddsubfx(); | ||||
| #endif | #endif | ||||
| // DISTRHO based plugins | |||||
| void carla_register_native_plugin_3BandEQ(); | |||||
| void carla_register_native_plugin_3BandSplitter(); | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| /**@}*/ | /**@}*/ | ||||
| @@ -0,0 +1,73 @@ | |||||
| /* | |||||
| * DISTHRO Plugin Toolkit (DPT) | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@gmail.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the GPL.txt file | |||||
| */ | |||||
| #include "src/DistrhoDefines.h" | |||||
| #undef START_NAMESPACE_DISTRHO | |||||
| //#undef END_NAMESPACE_DISTRHO | |||||
| #undef USE_NAMESPACE_DISTRHO | |||||
| #define START_NAMESPACE_DISTRHO namespace DISTRHO_NAMESPACE { | |||||
| //#define END_NAMESPACE_DISTRHO } | |||||
| #define USE_NAMESPACE_DISTRHO using namespace DISTRHO_NAMESPACE; | |||||
| #include "DistrhoPluginMain.cpp" | |||||
| #include "DistrhoUIMain.cpp" | |||||
| //#include "src/DistrhoPluginInternal.h" | |||||
| //#if DISTRHO_PLUGIN_HAS_UI | |||||
| //# include "src/DistrhoUIInternal.h" | |||||
| //#endif | |||||
| // ------------------------------------------------- | |||||
| // START_NAMESPACE_DISTRHO | |||||
| class CarlaDistrhoPlugin : public PluginDescriptorClass | |||||
| { | |||||
| public: | |||||
| CarlaDistrhoPlugin(const HostDescriptor* host) | |||||
| : PluginDescriptorClass(host) | |||||
| { | |||||
| } | |||||
| ~CarlaDistrhoPlugin() | |||||
| { | |||||
| } | |||||
| protected: | |||||
| // ------------------------------------------------------------------- | |||||
| // Plugin process calls | |||||
| void activate() | |||||
| { | |||||
| } | |||||
| void process(float**, float**, uint32_t, uint32_t, MidiEvent*) | |||||
| { | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| private: | |||||
| PluginDescriptorClassEND(CarlaDistrhoPlugin) | |||||
| }; | |||||
| // END_NAMESPACE_DISTRHO | |||||
| // ----------------------------------------------------------------------- | |||||
| @@ -0,0 +1,10 @@ | |||||
| /* | |||||
| * Dummy file | |||||
| */ | |||||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||||
| #error This is a dummy file that should never get included! | |||||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||||
| @@ -0,0 +1,24 @@ | |||||
| /* | |||||
| * DISTHRO Plugin Toolkit (DPT) | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@gmail.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or | |||||
| * modify it under the terms of the GNU General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the license see the GPL.txt file | |||||
| */ | |||||
| #if defined(__WIN32__) || defined(__WIN64__) | |||||
| # include "src/pugl/pugl_win.cpp" | |||||
| #elif defined(__APPLE__) | |||||
| # include "src/pugl/pugl_osx.m" | |||||
| #elif defined(__linux__) | |||||
| # include "src/pugl/pugl_x11.c" | |||||
| #endif | |||||
| @@ -35,7 +35,7 @@ protected: | |||||
| void activate() | void activate() | ||||
| { | { | ||||
| memset(events, 0, sizeof(MidiEvent) * MAX_MIDI_EVENTS); | |||||
| //memset(events, 0, sizeof(MidiEvent) * MAX_MIDI_EVENTS); | |||||
| } | } | ||||
| void process(float**, float**, uint32_t, uint32_t midiEventCount, MidiEvent* midiEvents) | void process(float**, float**, uint32_t, uint32_t midiEventCount, MidiEvent* midiEvents) | ||||
| @@ -66,8 +66,8 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| private: | private: | ||||
| static const unsigned short MAX_MIDI_EVENTS = 512; | |||||
| MidiEvent events[MAX_MIDI_EVENTS]; | |||||
| //static const unsigned short MAX_MIDI_EVENTS = 512; | |||||
| //MidiEvent events[MAX_MIDI_EVENTS]; | |||||
| PluginDescriptorClassEND(MidiSplitPlugin) | PluginDescriptorClassEND(MidiSplitPlugin) | ||||
| }; | }; | ||||
| @@ -49,13 +49,15 @@ public: | |||||
| return; | return; | ||||
| firstInit = false; | firstInit = false; | ||||
| #if 1 // FIXME! | |||||
| carla_register_native_plugin_bypass(); | carla_register_native_plugin_bypass(); | ||||
| carla_register_native_plugin_midiSplit(); | carla_register_native_plugin_midiSplit(); | ||||
| #ifdef WANT_ZYNADDSUBFX | #ifdef WANT_ZYNADDSUBFX | ||||
| carla_register_native_plugin_zynaddsubfx(); | carla_register_native_plugin_zynaddsubfx(); | ||||
| #endif | #endif | ||||
| #endif | |||||
| carla_register_native_plugin_3BandEQ(); | |||||
| carla_register_native_plugin_3BandSplitter(); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -69,12 +69,14 @@ void OpenGLUI::d_uiIdle() | |||||
| END_NAMESPACE_DISTRHO | END_NAMESPACE_DISTRHO | ||||
| #if DISTRHO_OS_WINDOWS | |||||
| # include "pugl/pugl_win.cpp" | |||||
| #elif DISTRHO_OS_MAC | |||||
| # include "pugl/pugl_osx.m" | |||||
| #else | |||||
| # include "pugl/pugl_x11.c" | |||||
| #ifndef DISTRHO_NAMESPACE | |||||
| # if DISTRHO_OS_WINDOWS | |||||
| # include "pugl/pugl_win.cpp" | |||||
| # elif DISTRHO_OS_MAC | |||||
| # include "pugl/pugl_osx.m" | |||||
| # else | |||||
| # include "pugl/pugl_x11.c" | |||||
| # endif | |||||
| #endif | #endif | ||||
| #endif // DISTRHO_UI_OPENGL | #endif // DISTRHO_UI_OPENGL | ||||
| @@ -19,7 +19,7 @@ | |||||
| #ifdef DISTRHO_UI_OPENGL | #ifdef DISTRHO_UI_OPENGL | ||||
| # include "DistrhoUIOpenGLExt.h" | |||||
| #include "DistrhoUIOpenGLExt.h" | |||||
| #include <cassert> | #include <cassert> | ||||
| #include <cmath> | #include <cmath> | ||||
| @@ -660,7 +660,7 @@ public: | |||||
| OpenGLDialog(PuglView* parentView, const Size& parentSize, const Image& image_, const char* title) | OpenGLDialog(PuglView* parentView, const Size& parentSize, const Image& image_, const char* title) | ||||
| : image(image_) | : image(image_) | ||||
| { | { | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| bool addToDesktop = false; | bool addToDesktop = false; | ||||
| #else | #else | ||||
| bool addToDesktop = true; | bool addToDesktop = true; | ||||
| @@ -682,7 +682,7 @@ public: | |||||
| puglSetReshapeFunc(view, onReshapeCallback); | puglSetReshapeFunc(view, onReshapeCallback); | ||||
| puglSetCloseFunc(view, onCloseCallback); | puglSetCloseFunc(view, onCloseCallback); | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| Display* display = view->impl->display; | Display* display = view->impl->display; | ||||
| Window thisWindow = view->impl->win; | Window thisWindow = view->impl->win; | ||||
| Window parentWindow = parentView->impl->win; | Window parentWindow = parentView->impl->win; | ||||
| @@ -722,7 +722,7 @@ public: | |||||
| { | { | ||||
| if (view) | if (view) | ||||
| { | { | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| Display* display = view->impl->display; | Display* display = view->impl->display; | ||||
| Window window = view->impl->win; | Window window = view->impl->win; | ||||
| XRaiseWindow(display, window); | XRaiseWindow(display, window); | ||||
| @@ -841,7 +841,7 @@ enum ObjectType { | |||||
| OBJECT_SLIDER = 3 | OBJECT_SLIDER = 3 | ||||
| }; | }; | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| struct LinuxData { | struct LinuxData { | ||||
| Display* display; | Display* display; | ||||
| Window window; | Window window; | ||||
| @@ -879,7 +879,7 @@ struct OpenGLExtUIPrivateData { | |||||
| std::vector<ImageSlider*> sliders; | std::vector<ImageSlider*> sliders; | ||||
| OpenGLDialog* dialog; | OpenGLDialog* dialog; | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| LinuxData linuxData; | LinuxData linuxData; | ||||
| #endif | #endif | ||||
| @@ -896,7 +896,7 @@ struct OpenGLExtUIPrivateData { | |||||
| void showCursor() | void showCursor() | ||||
| { | { | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| if (lastCursorPos != Point(-1, -2)) | if (lastCursorPos != Point(-1, -2)) | ||||
| XWarpPointer(linuxData.display, None, DefaultRootWindow(linuxData.display), 0, 0, 0, 0, lastCursorPos.getX(), lastCursorPos.getY()); | XWarpPointer(linuxData.display, None, DefaultRootWindow(linuxData.display), 0, 0, 0, 0, lastCursorPos.getX(), lastCursorPos.getY()); | ||||
| @@ -906,7 +906,7 @@ struct OpenGLExtUIPrivateData { | |||||
| void hideCursor() | void hideCursor() | ||||
| { | { | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| Window root, child; | Window root, child; | ||||
| int rootX, rootY, winX, winY; | int rootX, rootY, winX, winY; | ||||
| unsigned int mask; | unsigned int mask; | ||||
| @@ -1022,7 +1022,7 @@ void OpenGLExtUI::d_onInit() | |||||
| glMatrixMode(GL_MODELVIEW); | glMatrixMode(GL_MODELVIEW); | ||||
| glLoadIdentity(); | glLoadIdentity(); | ||||
| #if DISTRHO_OS_LINUX | |||||
| #if 0 //DISTRHO_OS_LINUX | |||||
| data->linuxData.display = OpenGLUI::data->widget->impl->display; | data->linuxData.display = OpenGLUI::data->widget->impl->display; | ||||
| data->linuxData.window = OpenGLUI::data->widget->impl->win; | data->linuxData.window = OpenGLUI::data->widget->impl->win; | ||||
| data->linuxData.pixmapBlack = XCreateBitmapFromData(data->linuxData.display, data->linuxData.window, data->linuxData.colorData, 8, 8); | data->linuxData.pixmapBlack = XCreateBitmapFromData(data->linuxData.display, data->linuxData.window, data->linuxData.colorData, 8, 8); | ||||
| @@ -1,7 +1,7 @@ | |||||
| # Carla TODO | # Carla TODO | ||||
| GENERAL: | GENERAL: | ||||
| - add direct program access on ui-dialogs (needed for standalone bridges), maybe add extra buttons too | |||||
| - add direct program access on ui-dialogs (needed for standalone bridges), maybe add extra buttons too (reset plugin, fix ui size) | |||||
| - implement osc-based uis in bridge mode | - implement osc-based uis in bridge mode | ||||
| - implement midi-learn (new dialog) | - implement midi-learn (new dialog) | ||||
| - implement midi-cc automation special rules (invert, half, logarithmic, etc) | - implement midi-cc automation special rules (invert, half, logarithmic, etc) | ||||
| @@ -21,6 +21,7 @@ DSSI: | |||||
| LV2: | LV2: | ||||
| - implement lv2-preset support | - implement lv2-preset support | ||||
| - implement lv2-time messages support | |||||
| - complete lv2-atom messages support | - complete lv2-atom messages support | ||||
| - complete lv2-worker support | - complete lv2-worker support | ||||