Browse Source

Carla: Add 2 DISTRHO Plugins as native (incomplete)

tags/v0.9.0
falkTX 13 years ago
parent
commit
e4a8ed8c5b
41 changed files with 36557 additions and 28 deletions
  1. +1
    -1
      c++/carla-backend/Makefile
  2. +0
    -0
      c++/carla-backend/carla_backend.pro
  3. +79
    -0
      c++/carla-native/3bandeq.cpp
  4. +17381
    -0
      c++/carla-native/3bandeq/DistrhoArtwork3BandEQ.cpp
  5. +40
    -0
      c++/carla-native/3bandeq/DistrhoArtwork3BandEQ.h
  6. +260
    -0
      c++/carla-native/3bandeq/DistrhoPlugin3BandEQ.cpp
  7. +102
    -0
      c++/carla-native/3bandeq/DistrhoPlugin3BandEQ.h
  8. +34
    -0
      c++/carla-native/3bandeq/DistrhoPluginInfo.h
  9. +231
    -0
      c++/carla-native/3bandeq/DistrhoUI3BandEQ.cpp
  10. +76
    -0
      c++/carla-native/3bandeq/DistrhoUI3BandEQ.h
  11. BIN
      c++/carla-native/3bandeq/artwork/about.png
  12. BIN
      c++/carla-native/3bandeq/artwork/aboutButtonHover.png
  13. BIN
      c++/carla-native/3bandeq/artwork/aboutButtonNormal.png
  14. BIN
      c++/carla-native/3bandeq/artwork/background.png
  15. BIN
      c++/carla-native/3bandeq/artwork/knob.png
  16. BIN
      c++/carla-native/3bandeq/artwork/slider.png
  17. +79
    -0
      c++/carla-native/3bandsplitter.cpp
  18. +17381
    -0
      c++/carla-native/3bandsplitter/DistrhoArtwork3BandSplitter.cpp
  19. +40
    -0
      c++/carla-native/3bandsplitter/DistrhoArtwork3BandSplitter.h
  20. +266
    -0
      c++/carla-native/3bandsplitter/DistrhoPlugin3BandSplitter.cpp
  21. +102
    -0
      c++/carla-native/3bandsplitter/DistrhoPlugin3BandSplitter.h
  22. +34
    -0
      c++/carla-native/3bandsplitter/DistrhoPluginInfo.h
  23. +227
    -0
      c++/carla-native/3bandsplitter/DistrhoUI3BandSplitter.cpp
  24. +76
    -0
      c++/carla-native/3bandsplitter/DistrhoUI3BandSplitter.h
  25. BIN
      c++/carla-native/3bandsplitter/artwork/about.png
  26. BIN
      c++/carla-native/3bandsplitter/artwork/aboutButtonHover.png
  27. BIN
      c++/carla-native/3bandsplitter/artwork/aboutButtonNormal.png
  28. BIN
      c++/carla-native/3bandsplitter/artwork/background.png
  29. BIN
      c++/carla-native/3bandsplitter/artwork/knob.png
  30. BIN
      c++/carla-native/3bandsplitter/artwork/slider.png
  31. +7
    -2
      c++/carla-native/Makefile
  32. +4
    -4
      c++/carla-native/bypass.c
  33. +4
    -0
      c++/carla-native/carla_native.h
  34. +73
    -0
      c++/carla-native/distrho/DistrhoPluginCarla.cpp
  35. +10
    -0
      c++/carla-native/distrho/DistrhoPluginInfo.h
  36. +24
    -0
      c++/carla-native/distrho/pugl.cpp
  37. +3
    -3
      c++/carla-native/midi-split.cpp
  38. +4
    -2
      c++/carla-plugin/native.cpp
  39. +8
    -6
      c++/distrho-plugin-toolkit/src/DistrhoUIOpenGL.cpp
  40. +9
    -9
      c++/distrho-plugin-toolkit/src/DistrhoUIOpenGLExt.cpp
  41. +2
    -1
      doc/Carla-TODO

+ 1
- 1
c++/carla-backend/Makefile View File

@@ -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 += $(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)

ifeq ($(CARLA_PLUGIN_SUPPORT),true)


c++/carla-backend/carla-backend.pro → c++/carla-backend/carla_backend.pro View File


+ 79
- 0
c++/carla-native/3bandeq.cpp View File

@@ -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);
}

// -----------------------------------------------------------------------

+ 17381
- 0
c++/carla-native/3bandeq/DistrhoArtwork3BandEQ.cpp
File diff suppressed because it is too large
View File


+ 40
- 0
c++/carla-native/3bandeq/DistrhoArtwork3BandEQ.h View File

@@ -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


+ 260
- 0
c++/carla-native/3bandeq/DistrhoPlugin3BandEQ.cpp View File

@@ -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

+ 102
- 0
c++/carla-native/3bandeq/DistrhoPlugin3BandEQ.h View File

@@ -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__

+ 34
- 0
c++/carla-native/3bandeq/DistrhoPluginInfo.h View File

@@ -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__

+ 231
- 0
c++/carla-native/3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -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

+ 76
- 0
c++/carla-native/3bandeq/DistrhoUI3BandEQ.h View File

@@ -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__

BIN
c++/carla-native/3bandeq/artwork/about.png View File

Before After
Width: 303  |  Height: 190  |  Size: 269KB

BIN
c++/carla-native/3bandeq/artwork/aboutButtonHover.png View File

Before After
Width: 100  |  Height: 29  |  Size: 4.4KB

BIN
c++/carla-native/3bandeq/artwork/aboutButtonNormal.png View File

Before After
Width: 100  |  Height: 29  |  Size: 4.8KB

BIN
c++/carla-native/3bandeq/artwork/background.png View File

Before After
Width: 392  |  Height: 372  |  Size: 143KB

BIN
c++/carla-native/3bandeq/artwork/knob.png View File

Before After
Width: 62  |  Height: 2480  |  Size: 30KB

BIN
c++/carla-native/3bandeq/artwork/slider.png View File

Before After
Width: 50  |  Height: 30  |  Size: 3.4KB

+ 79
- 0
c++/carla-native/3bandsplitter.cpp View File

@@ -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);
}

// -----------------------------------------------------------------------

+ 17381
- 0
c++/carla-native/3bandsplitter/DistrhoArtwork3BandSplitter.cpp
File diff suppressed because it is too large
View File


+ 40
- 0
c++/carla-native/3bandsplitter/DistrhoArtwork3BandSplitter.h View File

@@ -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


+ 266
- 0
c++/carla-native/3bandsplitter/DistrhoPlugin3BandSplitter.cpp View File

@@ -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

+ 102
- 0
c++/carla-native/3bandsplitter/DistrhoPlugin3BandSplitter.h View File

@@ -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__

+ 34
- 0
c++/carla-native/3bandsplitter/DistrhoPluginInfo.h View File

@@ -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__

+ 227
- 0
c++/carla-native/3bandsplitter/DistrhoUI3BandSplitter.cpp View File

@@ -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

+ 76
- 0
c++/carla-native/3bandsplitter/DistrhoUI3BandSplitter.h View File

@@ -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__

BIN
c++/carla-native/3bandsplitter/artwork/about.png View File

Before After
Width: 303  |  Height: 190  |  Size: 63KB

BIN
c++/carla-native/3bandsplitter/artwork/aboutButtonHover.png View File

Before After
Width: 100  |  Height: 29  |  Size: 4.4KB

BIN
c++/carla-native/3bandsplitter/artwork/aboutButtonNormal.png View File

Before After
Width: 100  |  Height: 29  |  Size: 4.8KB

BIN
c++/carla-native/3bandsplitter/artwork/background.png View File

Before After
Width: 392  |  Height: 372  |  Size: 149KB

BIN
c++/carla-native/3bandsplitter/artwork/knob.png View File

Before After
Width: 62  |  Height: 2480  |  Size: 30KB

BIN
c++/carla-native/3bandsplitter/artwork/slider.png View File

Before After
Width: 50  |  Height: 30  |  Size: 3.4KB

+ 7
- 2
c++/carla-native/Makefile View File

@@ -12,7 +12,7 @@ HAVE_ZYN_GUI_DEPS = $(shell which ntk-config)
# --------------------------------------------------------------

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)

ifeq ($(HAVE_ZYN_DEPS),true)
@@ -23,10 +23,15 @@ BUILD_CXX_FLAGS += $(shell ntk-config --cxxflags) -DWANT_ZYNADDSUBFX_GUI
endif
endif

OBJS = \
OBJS = \
bypass.o \
midi-split.o

OBJS += \
3bandeq.o \
3bandsplitter.o \
distrho/pugl.o

# --------------------------------------------------------------

ifeq ($(HAVE_ZYN_DEPS),true)


+ 4
- 4
c++/carla-native/bypass.c View File

@@ -61,10 +61,10 @@ static PluginDescriptor bypassDesc = {

.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_info = NULL,


+ 4
- 0
c++/carla-native/carla_native.h View File

@@ -181,6 +181,10 @@ void carla_register_native_plugin_midiSplit();
void carla_register_native_plugin_zynaddsubfx();
#endif

// DISTRHO based plugins
void carla_register_native_plugin_3BandEQ();
void carla_register_native_plugin_3BandSplitter();

// -----------------------------------------------------------------------

/**@}*/


+ 73
- 0
c++/carla-native/distrho/DistrhoPluginCarla.cpp View File

@@ -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

// -----------------------------------------------------------------------

+ 10
- 0
c++/carla-native/distrho/DistrhoPluginInfo.h View File

@@ -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__

+ 24
- 0
c++/carla-native/distrho/pugl.cpp View File

@@ -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

+ 3
- 3
c++/carla-native/midi-split.cpp View File

@@ -35,7 +35,7 @@ protected:

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)
@@ -66,8 +66,8 @@ protected:
// -------------------------------------------------------------------

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)
};


+ 4
- 2
c++/carla-plugin/native.cpp View File

@@ -49,13 +49,15 @@ public:
return;

firstInit = false;
#if 1 // FIXME!
carla_register_native_plugin_bypass();
carla_register_native_plugin_midiSplit();
#ifdef WANT_ZYNADDSUBFX
carla_register_native_plugin_zynaddsubfx();
#endif
#endif

carla_register_native_plugin_3BandEQ();
carla_register_native_plugin_3BandSplitter();
}

private:


+ 8
- 6
c++/distrho-plugin-toolkit/src/DistrhoUIOpenGL.cpp View File

@@ -69,12 +69,14 @@ void OpenGLUI::d_uiIdle()

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 // DISTRHO_UI_OPENGL

+ 9
- 9
c++/distrho-plugin-toolkit/src/DistrhoUIOpenGLExt.cpp View File

@@ -19,7 +19,7 @@

#ifdef DISTRHO_UI_OPENGL

# include "DistrhoUIOpenGLExt.h"
#include "DistrhoUIOpenGLExt.h"

#include <cassert>
#include <cmath>
@@ -660,7 +660,7 @@ public:
OpenGLDialog(PuglView* parentView, const Size& parentSize, const Image& image_, const char* title)
: image(image_)
{
#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
bool addToDesktop = false;
#else
bool addToDesktop = true;
@@ -682,7 +682,7 @@ public:
puglSetReshapeFunc(view, onReshapeCallback);
puglSetCloseFunc(view, onCloseCallback);

#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
Display* display = view->impl->display;
Window thisWindow = view->impl->win;
Window parentWindow = parentView->impl->win;
@@ -722,7 +722,7 @@ public:
{
if (view)
{
#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
Display* display = view->impl->display;
Window window = view->impl->win;
XRaiseWindow(display, window);
@@ -841,7 +841,7 @@ enum ObjectType {
OBJECT_SLIDER = 3
};

#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
struct LinuxData {
Display* display;
Window window;
@@ -879,7 +879,7 @@ struct OpenGLExtUIPrivateData {
std::vector<ImageSlider*> sliders;
OpenGLDialog* dialog;

#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
LinuxData linuxData;
#endif

@@ -896,7 +896,7 @@ struct OpenGLExtUIPrivateData {

void showCursor()
{
#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
if (lastCursorPos != Point(-1, -2))
XWarpPointer(linuxData.display, None, DefaultRootWindow(linuxData.display), 0, 0, 0, 0, lastCursorPos.getX(), lastCursorPos.getY());

@@ -906,7 +906,7 @@ struct OpenGLExtUIPrivateData {

void hideCursor()
{
#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
Window root, child;
int rootX, rootY, winX, winY;
unsigned int mask;
@@ -1022,7 +1022,7 @@ void OpenGLExtUI::d_onInit()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

#if DISTRHO_OS_LINUX
#if 0 //DISTRHO_OS_LINUX
data->linuxData.display = OpenGLUI::data->widget->impl->display;
data->linuxData.window = OpenGLUI::data->widget->impl->win;
data->linuxData.pixmapBlack = XCreateBitmapFromData(data->linuxData.display, data->linuxData.window, data->linuxData.colorData, 8, 8);


+ 2
- 1
doc/Carla-TODO View File

@@ -1,7 +1,7 @@
# Carla TODO

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 midi-learn (new dialog)
- implement midi-cc automation special rules (invert, half, logarithmic, etc)
@@ -21,6 +21,7 @@ DSSI:

LV2:
- implement lv2-preset support
- implement lv2-time messages support
- complete lv2-atom messages support
- complete lv2-worker support



Loading…
Cancel
Save