Browse Source

Remove dpf-based internal plugins

tags/1.9.4
falkTX 10 years ago
parent
commit
e1e3f9fe2d
100 changed files with 1 additions and 114726 deletions
  1. +0
    -10107
      source/modules/native-plugins/3bandeq/DistrhoArtwork3BandEQ.cpp
  2. +0
    -40
      source/modules/native-plugins/3bandeq/DistrhoArtwork3BandEQ.hpp
  3. +0
    -258
      source/modules/native-plugins/3bandeq/DistrhoPlugin3BandEQ.cpp
  4. +0
    -113
      source/modules/native-plugins/3bandeq/DistrhoPlugin3BandEQ.hpp
  5. +0
    -35
      source/modules/native-plugins/3bandeq/DistrhoPluginInfo.h
  6. +0
    -201
      source/modules/native-plugins/3bandeq/DistrhoUI3BandEQ.cpp
  7. +0
    -95
      source/modules/native-plugins/3bandeq/DistrhoUI3BandEQ.hpp
  8. +0
    -10107
      source/modules/native-plugins/3bandsplitter/DistrhoArtwork3BandSplitter.cpp
  9. +0
    -40
      source/modules/native-plugins/3bandsplitter/DistrhoArtwork3BandSplitter.hpp
  10. +0
    -266
      source/modules/native-plugins/3bandsplitter/DistrhoPlugin3BandSplitter.cpp
  11. +0
    -113
      source/modules/native-plugins/3bandsplitter/DistrhoPlugin3BandSplitter.hpp
  12. +0
    -35
      source/modules/native-plugins/3bandsplitter/DistrhoPluginInfo.h
  13. +0
    -201
      source/modules/native-plugins/3bandsplitter/DistrhoUI3BandSplitter.cpp
  14. +0
    -95
      source/modules/native-plugins/3bandsplitter/DistrhoUI3BandSplitter.hpp
  15. +0
    -148
      source/modules/native-plugins/ImageToggle.hpp
  16. +1
    -74
      source/modules/native-plugins/Makefile
  17. +0
    -60
      source/modules/native-plugins/distrho-3bandeq.cpp
  18. +0
    -60
      source/modules/native-plugins/distrho-3bandsplitter.cpp
  19. +0
    -60
      source/modules/native-plugins/distrho-groovejuice.cpp
  20. +0
    -60
      source/modules/native-plugins/distrho-nekobi.cpp
  21. +0
    -60
      source/modules/native-plugins/distrho-pingpongpan.cpp
  22. +0
    -60
      source/modules/native-plugins/distrho-powerjuice.cpp
  23. +0
    -59
      source/modules/native-plugins/distrho-prom.cpp
  24. +0
    -60
      source/modules/native-plugins/distrho-segmentjuice.cpp
  25. +0
    -60
      source/modules/native-plugins/distrho-stereoenhancer.cpp
  26. +0
    -60
      source/modules/native-plugins/distrho-vectorjuice.cpp
  27. +0
    -60
      source/modules/native-plugins/distrho-wobblejuice.cpp
  28. +0
    -60
      source/modules/native-plugins/distrho-zamcomp.cpp
  29. +0
    -60
      source/modules/native-plugins/distrho-zamcompx2.cpp
  30. +0
    -60
      source/modules/native-plugins/distrho-zameq2.cpp
  31. +0
    -60
      source/modules/native-plugins/distrho-zamsynth.cpp
  32. +0
    -61
      source/modules/native-plugins/distrho-zamtube.cpp
  33. +0
    -60
      source/modules/native-plugins/distrho-zamulticomp.cpp
  34. +0
    -60
      source/modules/native-plugins/distrho-zamulticompx2.cpp
  35. +0
    -36
      source/modules/native-plugins/groovejuice/DistrhoPluginInfo.h
  36. +0
    -24888
      source/modules/native-plugins/groovejuice/GrooveJuiceArtwork.cpp
  37. +0
    -80
      source/modules/native-plugins/groovejuice/GrooveJuiceArtwork.hpp
  38. +0
    -621
      source/modules/native-plugins/groovejuice/GrooveJuicePlugin.cpp
  39. +0
    -280
      source/modules/native-plugins/groovejuice/GrooveJuicePlugin.hpp
  40. +0
    -763
      source/modules/native-plugins/groovejuice/GrooveJuiceUI.cpp
  41. +0
    -155
      source/modules/native-plugins/groovejuice/GrooveJuiceUI.hpp
  42. +0
    -243
      source/modules/native-plugins/groovejuice/Synth.hxx
  43. +0
    -76
      source/modules/native-plugins/groovejuice/moogVCF.hxx
  44. +0
    -6890
      source/modules/native-plugins/nekobi/DistrhoArtworkNekobi.cpp
  45. +0
    -90
      source/modules/native-plugins/nekobi/DistrhoArtworkNekobi.hpp
  46. +0
    -36
      source/modules/native-plugins/nekobi/DistrhoPluginInfo.h
  47. +0
    -401
      source/modules/native-plugins/nekobi/DistrhoPluginNekobi.cpp
  48. +0
    -121
      source/modules/native-plugins/nekobi/DistrhoPluginNekobi.hpp
  49. +0
    -222
      source/modules/native-plugins/nekobi/DistrhoUINekobi.cpp
  50. +0
    -102
      source/modules/native-plugins/nekobi/DistrhoUINekobi.hpp
  51. +0
    -202
      source/modules/native-plugins/nekobi/NekoWidget.hpp
  52. +0
    -1779
      source/modules/native-plugins/nekobi/nekobee-src/minblep_tables.c
  53. +0
    -77
      source/modules/native-plugins/nekobi/nekobee-src/nekobee.h
  54. +0
    -237
      source/modules/native-plugins/nekobi/nekobee-src/nekobee_synth.c
  55. +0
    -132
      source/modules/native-plugins/nekobi/nekobee-src/nekobee_synth.h
  56. +0
    -30
      source/modules/native-plugins/nekobi/nekobee-src/nekobee_types.h
  57. +0
    -256
      source/modules/native-plugins/nekobi/nekobee-src/nekobee_voice.c
  58. +0
    -183
      source/modules/native-plugins/nekobi/nekobee-src/nekobee_voice.h
  59. +0
    -414
      source/modules/native-plugins/nekobi/nekobee-src/nekobee_voice_render.c
  60. +0
    -5651
      source/modules/native-plugins/pingpongpan/DistrhoArtworkPingPongPan.cpp
  61. +0
    -35
      source/modules/native-plugins/pingpongpan/DistrhoArtworkPingPongPan.hpp
  62. +0
    -35
      source/modules/native-plugins/pingpongpan/DistrhoPluginInfo.h
  63. +0
    -161
      source/modules/native-plugins/pingpongpan/DistrhoPluginPingPongPan.cpp
  64. +0
    -104
      source/modules/native-plugins/pingpongpan/DistrhoPluginPingPongPan.hpp
  65. +0
    -130
      source/modules/native-plugins/pingpongpan/DistrhoUIPingPongPan.cpp
  66. +0
    -88
      source/modules/native-plugins/pingpongpan/DistrhoUIPingPongPan.hpp
  67. BIN
      source/modules/native-plugins/pingpongpan/artwork/about.png
  68. BIN
      source/modules/native-plugins/pingpongpan/artwork/aboutButtonHover.png
  69. BIN
      source/modules/native-plugins/pingpongpan/artwork/aboutButtonNormal.png
  70. BIN
      source/modules/native-plugins/pingpongpan/artwork/background.png
  71. BIN
      source/modules/native-plugins/pingpongpan/artwork/knob.png
  72. +0
    -39
      source/modules/native-plugins/powerjuice/DistrhoPluginInfo.h
  73. +0
    -12222
      source/modules/native-plugins/powerjuice/PowerJuiceArtwork.cpp
  74. +0
    -35
      source/modules/native-plugins/powerjuice/PowerJuiceArtwork.hpp
  75. +0
    -379
      source/modules/native-plugins/powerjuice/PowerJuicePlugin.cpp
  76. +0
    -212
      source/modules/native-plugins/powerjuice/PowerJuicePlugin.hpp
  77. +0
    -307
      source/modules/native-plugins/powerjuice/PowerJuiceUI.cpp
  78. +0
    -130
      source/modules/native-plugins/powerjuice/PowerJuiceUI.hpp
  79. +0
    -38
      source/modules/native-plugins/prom/DistrhoPluginInfo.h
  80. +0
    -84
      source/modules/native-plugins/prom/DistrhoPluginProM.cpp
  81. +0
    -96
      source/modules/native-plugins/prom/DistrhoPluginProM.hpp
  82. +0
    -276
      source/modules/native-plugins/prom/DistrhoUIProM.cpp
  83. +0
    -76
      source/modules/native-plugins/prom/DistrhoUIProM.hpp
  84. +0
    -36
      source/modules/native-plugins/segmentjuice/DistrhoPluginInfo.h
  85. +0
    -18008
      source/modules/native-plugins/segmentjuice/SegmentJuiceArtwork.cpp
  86. +0
    -40
      source/modules/native-plugins/segmentjuice/SegmentJuiceArtwork.hpp
  87. +0
    -688
      source/modules/native-plugins/segmentjuice/SegmentJuicePlugin.cpp
  88. +0
    -136
      source/modules/native-plugins/segmentjuice/SegmentJuicePlugin.hpp
  89. +0
    -821
      source/modules/native-plugins/segmentjuice/SegmentJuiceUI.cpp
  90. +0
    -100
      source/modules/native-plugins/segmentjuice/SegmentJuiceUI.hpp
  91. +0
    -299
      source/modules/native-plugins/segmentjuice/Synth.hxx
  92. +0
    -12540
      source/modules/native-plugins/stereoenhancer/DistrhoArtworkStereoEnhancer.cpp
  93. +0
    -35
      source/modules/native-plugins/stereoenhancer/DistrhoArtworkStereoEnhancer.hpp
  94. +0
    -35
      source/modules/native-plugins/stereoenhancer/DistrhoPluginInfo.h
  95. +0
    -211
      source/modules/native-plugins/stereoenhancer/DistrhoPluginStereoEnhancer.cpp
  96. +0
    -110
      source/modules/native-plugins/stereoenhancer/DistrhoPluginStereoEnhancer.hpp
  97. +0
    -157
      source/modules/native-plugins/stereoenhancer/DistrhoUIStereoEnhancer.cpp
  98. +0
    -90
      source/modules/native-plugins/stereoenhancer/DistrhoUIStereoEnhancer.hpp
  99. BIN
      source/modules/native-plugins/stereoenhancer/artwork/about.png
  100. BIN
      source/modules/native-plugins/stereoenhancer/artwork/aboutButtonHover.png

+ 0
- 10107
source/modules/native-plugins/3bandeq/DistrhoArtwork3BandEQ.cpp
File diff suppressed because it is too large
View File


+ 0
- 40
source/modules/native-plugins/3bandeq/DistrhoArtwork3BandEQ.hpp View File

@@ -1,40 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORK3BANDEQ_HPP
#define BINARY_DISTRHOARTWORK3BANDEQ_HPP

namespace DistrhoArtwork3BandEQ
{
extern const char* aboutData;
const unsigned int aboutDataSize = 172710;
const unsigned int aboutWidth = 303;
const unsigned int aboutHeight = 190;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 5888;
const unsigned int aboutButtonHoverWidth = 92;
const unsigned int aboutButtonHoverHeight = 16;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 5888;
const unsigned int aboutButtonNormalWidth = 92;
const unsigned int aboutButtonNormalHeight = 16;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 437472;
const unsigned int backgroundWidth = 392;
const unsigned int backgroundHeight = 372;

extern const char* knobData;
const unsigned int knobDataSize = 15376;
const unsigned int knobWidth = 62;
const unsigned int knobHeight = 62;

extern const char* sliderData;
const unsigned int sliderDataSize = 6000;
const unsigned int sliderWidth = 50;
const unsigned int sliderHeight = 30;
}

#endif // BINARY_DISTRHOARTWORK3BANDEQ_HPP


+ 0
- 258
source/modules/native-plugins/3bandeq/DistrhoPlugin3BandEQ.cpp View File

@@ -1,258 +0,0 @@
/*
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#include "DistrhoPlugin3BandEQ.hpp"
#include <cmath>
static const float kAMP_DB = 8.656170245f;
static const float kDC_ADD = 1e-30f;
static const float kPI = 3.141592654f;
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPlugin3BandEQ::DistrhoPlugin3BandEQ()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
// -----------------------------------------------------------------------
// Init
void DistrhoPlugin3BandEQ::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramLow:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Low";
parameter.symbol = "low";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramMid:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Mid";
parameter.symbol = "mid";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramHigh:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "High";
parameter.symbol = "high";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramMaster:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Master";
parameter.symbol = "master";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramLowMidFreq:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Low-Mid Freq";
parameter.symbol = "low_mid";
parameter.unit = "Hz";
parameter.ranges.def = 440.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1000.0f;
break;
case paramMidHighFreq:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Mid-High Freq";
parameter.symbol = "mid_high";
parameter.unit = "Hz";
parameter.ranges.def = 1000.0f;
parameter.ranges.min = 1000.0f;
parameter.ranges.max = 20000.0f;
break;
}
}
void DistrhoPlugin3BandEQ::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPlugin3BandEQ::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramLow:
return fLow;
case paramMid:
return fMid;
case paramHigh:
return fHigh;
case paramMaster:
return fMaster;
case paramLowMidFreq:
return fLowMidFreq;
case paramMidHighFreq:
return fMidHighFreq;
default:
return 0.0f;
}
}
void DistrhoPlugin3BandEQ::d_setParameterValue(uint32_t index, float value)
{
if (d_getSampleRate() <= 0.0)
return;
switch (index)
{
case paramLow:
fLow = value;
lowVol = std::exp( (fLow/48.0f) * 48.0f / kAMP_DB);
break;
case paramMid:
fMid = value;
midVol = std::exp( (fMid/48.0f) * 48.0f / kAMP_DB);
break;
case paramHigh:
fHigh = value;
highVol = std::exp( (fHigh/48.0f) * 48.0f / kAMP_DB);
break;
case paramMaster:
fMaster = value;
outVol = std::exp( (fMaster/48.0f) * 48.0f / kAMP_DB);
break;
case paramLowMidFreq:
fLowMidFreq = std::fmin(value, fMidHighFreq);
freqLP = fLowMidFreq;
xLP = std::exp(-2.0f * kPI * freqLP / (float)d_getSampleRate());
a0LP = 1.0f - xLP;
b1LP = -xLP;
break;
case paramMidHighFreq:
fMidHighFreq = std::fmax(value, fLowMidFreq);
freqHP = fMidHighFreq;
xHP = std::exp(-2.0f * kPI * freqHP / (float)d_getSampleRate());
a0HP = 1.0f - xHP;
b1HP = -xHP;
break;
}
}
void DistrhoPlugin3BandEQ::d_setProgram(uint32_t index)
{
if (index != 0)
return;
// Default values
fLow = 0.0f;
fMid = 0.0f;
fHigh = 0.0f;
fMaster = 0.0f;
fLowMidFreq = 220.0f;
fMidHighFreq = 2000.0f;
// Internal stuff
lowVol = midVol = highVol = outVol = 1.0f;
freqLP = 200.0f;
freqHP = 2000.0f;
// reset filter values
d_activate();
}
// -----------------------------------------------------------------------
// Process
void DistrhoPlugin3BandEQ::d_activate()
{
const float sr = (float)d_getSampleRate();
xLP = std::exp(-2.0f * kPI * freqLP / sr);
a0LP = 1.0f - xLP;
b1LP = -xLP;
xHP = std::exp(-2.0f * kPI * freqHP / sr);
a0HP = 1.0f - xHP;
b1HP = -xHP;
}
void DistrhoPlugin3BandEQ::d_deactivate()
{
out1LP = out2LP = out1HP = out2HP = 0.0f;
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f;
}
void DistrhoPlugin3BandEQ::d_run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in1 = inputs[0];
const float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
for (uint32_t i=0; i < frames; ++i)
{
tmp1LP = a0LP * in1[i] - b1LP * tmp1LP + kDC_ADD;
tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + kDC_ADD;
out1LP = tmp1LP - kDC_ADD;
out2LP = tmp2LP - kDC_ADD;
tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + kDC_ADD;
tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + kDC_ADD;
out1HP = in1[i] - tmp1HP - kDC_ADD;
out2HP = in2[i] - tmp2HP - kDC_ADD;
out1[i] = (out1LP*lowVol + (in1[i] - out1LP - out1HP)*midVol + out1HP*highVol) * outVol;
out2[i] = (out2LP*lowVol + (in2[i] - out2LP - out2HP)*midVol + out2HP*highVol) * outVol;
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPlugin3BandEQ();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 113
source/modules/native-plugins/3bandeq/DistrhoPlugin3BandEQ.hpp View File

@@ -1,113 +0,0 @@
/*
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED
#define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPlugin3BandEQ : public Plugin
{
public:
enum Parameters
{
paramLow = 0,
paramMid,
paramHigh,
paramMaster,
paramLowMidFreq,
paramMidHighFreq,
paramCount
};
DistrhoPlugin3BandEQ();
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "3BandEQ";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
const char* d_getLicense() const noexcept override
{
return "LGPL";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('D', '3', 'E', 'Q');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
float fLow, fMid, fHigh, fMaster, fLowMidFreq, fMidHighFreq;
float lowVol, midVol, highVol, outVol;
float freqLP, freqHP;
float xLP, a0LP, b1LP;
float xHP, a0HP, b1HP;
float out1LP, out2LP, out1HP, out2HP;
float tmp1LP, tmp2LP, tmp1HP, tmp2HP;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPlugin3BandEQ)
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED

+ 0
- 35
source/modules/native-plugins/3bandeq/DistrhoPluginInfo.h View File

@@ -1,35 +0,0 @@
/*
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "3 Band EQ"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandEQ"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 201
source/modules/native-plugins/3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -1,201 +0,0 @@
/*
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#include "DistrhoPlugin3BandEQ.hpp"
#include "DistrhoUI3BandEQ.hpp"

using DGL::Point;

START_NAMESPACE_DISTRHO

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

DistrhoUI3BandEQ::DistrhoUI3BandEQ()
: UI(),
fAboutWindow(this)
{
// background
fImgBackground = Image(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR);

// about
Image aboutImage(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGR);
fAboutWindow.setImage(aboutImage);

// sliders
Image sliderImage(DistrhoArtwork3BandEQ::sliderData, DistrhoArtwork3BandEQ::sliderWidth, DistrhoArtwork3BandEQ::sliderHeight);
Point<int> sliderPosStart(57, 43);
Point<int> sliderPosEnd(57, 43 + 160);

// slider Low
fSliderLow = new ImageSlider(this, sliderImage);
fSliderLow->setId(DistrhoPlugin3BandEQ::paramLow);
fSliderLow->setStartPos(sliderPosStart);
fSliderLow->setEndPos(sliderPosEnd);
fSliderLow->setRange(-24.0f, 24.0f);
fSliderLow->setCallback(this);

// slider Mid
sliderPosStart.setX(120);
sliderPosEnd.setX(120);
fSliderMid = new ImageSlider(*fSliderLow);
fSliderMid->setId(DistrhoPlugin3BandEQ::paramMid);
fSliderMid->setStartPos(sliderPosStart);
fSliderMid->setEndPos(sliderPosEnd);

// slider High
sliderPosStart.setX(183);
sliderPosEnd.setX(183);
fSliderHigh = new ImageSlider(*fSliderLow);
fSliderHigh->setId(DistrhoPlugin3BandEQ::paramHigh);
fSliderHigh->setStartPos(sliderPosStart);
fSliderHigh->setEndPos(sliderPosEnd);

// slider Master
sliderPosStart.setX(287);
sliderPosEnd.setX(287);
fSliderMaster = new ImageSlider(*fSliderLow);
fSliderMaster->setId(DistrhoPlugin3BandEQ::paramMaster);
fSliderMaster->setStartPos(sliderPosStart);
fSliderMaster->setEndPos(sliderPosEnd);

// knobs
Image knobImage(DistrhoArtwork3BandEQ::knobData, DistrhoArtwork3BandEQ::knobWidth, DistrhoArtwork3BandEQ::knobHeight);

// knob Low-Mid
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandEQ::paramLowMidFreq);
fKnobLowMid->setAbsolutePos(65, 269);
fKnobLowMid->setRange(0.0f, 1000.0f);
fKnobLowMid->setDefault(440.0f);
fKnobLowMid->setRotationAngle(270);
fKnobLowMid->setCallback(this);

// knob Mid-High
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandEQ::paramMidHighFreq);
fKnobMidHigh->setAbsolutePos(159, 269);
fKnobMidHigh->setRange(1000.0f, 20000.0f);
fKnobMidHigh->setDefault(1000.0f);
fKnobMidHigh->setRotationAngle(270);
fKnobMidHigh->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtwork3BandEQ::aboutButtonHoverData, DistrhoArtwork3BandEQ::aboutButtonHoverWidth, DistrhoArtwork3BandEQ::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(264, 300);
fButtonAbout->setCallback(this);

// set default values
d_programChanged(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUI3BandEQ::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case DistrhoPlugin3BandEQ::paramLow:
fSliderLow->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramMid:
fSliderMid->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramHigh:
fSliderHigh->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramMaster:
fSliderMaster->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramLowMidFreq:
fKnobLowMid->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramMidHighFreq:
fKnobMidHigh->setValue(value);
break;
}
}

void DistrhoUI3BandEQ::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
fSliderLow->setValue(0.0f);
fSliderMid->setValue(0.0f);
fSliderHigh->setValue(0.0f);
fSliderMaster->setValue(0.0f);
fKnobLowMid->setValue(220.0f);
fKnobMidHigh->setValue(2000.0f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob)
{
d_editParameter(knob->getId(), true);
}

void DistrhoUI3BandEQ::imageKnobDragFinished(ImageKnob* knob)
{
d_editParameter(knob->getId(), false);
}

void DistrhoUI3BandEQ::imageKnobValueChanged(ImageKnob* knob, float value)
{
d_setParameterValue(knob->getId(), value);
}

void DistrhoUI3BandEQ::imageSliderDragStarted(ImageSlider* slider)
{
d_editParameter(slider->getId(), true);
}

void DistrhoUI3BandEQ::imageSliderDragFinished(ImageSlider* slider)
{
d_editParameter(slider->getId(), false);
}

void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value)
{
d_setParameterValue(slider->getId(), value);
}

void DistrhoUI3BandEQ::onDisplay()
{
fImgBackground.draw();
}

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

UI* createUI()
{
return new DistrhoUI3BandEQ();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 95
source/modules/native-plugins/3bandeq/DistrhoUI3BandEQ.hpp View File

@@ -1,95 +0,0 @@
/*
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED
#define DISTRHO_UI_3BANDEQ_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"
#include "ImageSlider.hpp"

#include "DistrhoArtwork3BandEQ.hpp"

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;
using DGL::ImageSlider;

START_NAMESPACE_DISTRHO

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

class DistrhoUI3BandEQ : public UI,
public ImageButton::Callback,
public ImageKnob::Callback,
public ImageSlider::Callback
{
public:
DistrhoUI3BandEQ();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return DistrhoArtwork3BandEQ::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return DistrhoArtwork3BandEQ::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;
void imageSliderDragStarted(ImageSlider* slider) override;
void imageSliderDragFinished(ImageSlider* slider) override;
void imageSliderValueChanged(ImageSlider* slider, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ScopedPointer<ImageButton> fButtonAbout;
ScopedPointer<ImageKnob> fKnobLowMid, fKnobMidHigh;
ScopedPointer<ImageSlider> fSliderLow, fSliderMid, fSliderHigh, fSliderMaster;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUI3BandEQ)
};

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

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED

+ 0
- 10107
source/modules/native-plugins/3bandsplitter/DistrhoArtwork3BandSplitter.cpp
File diff suppressed because it is too large
View File


+ 0
- 40
source/modules/native-plugins/3bandsplitter/DistrhoArtwork3BandSplitter.hpp View File

@@ -1,40 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP
#define BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP

namespace DistrhoArtwork3BandSplitter
{
extern const char* aboutData;
const unsigned int aboutDataSize = 172710;
const unsigned int aboutWidth = 303;
const unsigned int aboutHeight = 190;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 5888;
const unsigned int aboutButtonHoverWidth = 92;
const unsigned int aboutButtonHoverHeight = 16;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 5888;
const unsigned int aboutButtonNormalWidth = 92;
const unsigned int aboutButtonNormalHeight = 16;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 437472;
const unsigned int backgroundWidth = 392;
const unsigned int backgroundHeight = 372;

extern const char* knobData;
const unsigned int knobDataSize = 15376;
const unsigned int knobWidth = 62;
const unsigned int knobHeight = 62;

extern const char* sliderData;
const unsigned int sliderDataSize = 6000;
const unsigned int sliderWidth = 50;
const unsigned int sliderHeight = 30;
}

#endif // BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP


+ 0
- 266
source/modules/native-plugins/3bandsplitter/DistrhoPlugin3BandSplitter.cpp View File

@@ -1,266 +0,0 @@
/*
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#include "DistrhoPlugin3BandSplitter.hpp"
#include <cmath>
static const float kAMP_DB = 8.656170245f;
static const float kDC_ADD = 1e-30f;
static const float kPI = 3.141592654f;
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPlugin3BandSplitter::DistrhoPlugin3BandSplitter()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
// -----------------------------------------------------------------------
// Init
void DistrhoPlugin3BandSplitter::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramLow:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Low";
parameter.symbol = "low";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramMid:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Mid";
parameter.symbol = "mid";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramHigh:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "High";
parameter.symbol = "high";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramMaster:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Master";
parameter.symbol = "master";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -24.0f;
parameter.ranges.max = 24.0f;
break;
case paramLowMidFreq:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Low-Mid Freq";
parameter.symbol = "low_mid";
parameter.unit = "Hz";
parameter.ranges.def = 440.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1000.0f;
break;
case paramMidHighFreq:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Mid-High Freq";
parameter.symbol = "mid_high";
parameter.unit = "Hz";
parameter.ranges.def = 1000.0f;
parameter.ranges.min = 1000.0f;
parameter.ranges.max = 20000.0f;
break;
}
}
void DistrhoPlugin3BandSplitter::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPlugin3BandSplitter::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramLow:
return fLow;
case paramMid:
return fMid;
case paramHigh:
return fHigh;
case paramMaster:
return fMaster;
case paramLowMidFreq:
return fLowMidFreq;
case paramMidHighFreq:
return fMidHighFreq;
default:
return 0.0f;
}
}
void DistrhoPlugin3BandSplitter::d_setParameterValue(uint32_t index, float value)
{
if (d_getSampleRate() <= 0.0)
return;
switch (index)
{
case paramLow:
fLow = value;
lowVol = std::exp( (fLow/48.0f) * 48.0f / kAMP_DB);
break;
case paramMid:
fMid = value;
midVol = std::exp( (fMid/48.0f) * 48.0f / kAMP_DB);
break;
case paramHigh:
fHigh = value;
highVol = std::exp( (fHigh/48.0f) * 48.0f / kAMP_DB);
break;
case paramMaster:
fMaster = value;
outVol = std::exp( (fMaster/48.0f) * 48.0f / kAMP_DB);
break;
case paramLowMidFreq:
fLowMidFreq = std::fmin(value, fMidHighFreq);
freqLP = fLowMidFreq;
xLP = std::exp(-2.0f * kPI * freqLP / (float)d_getSampleRate());
a0LP = 1.0f - xLP;
b1LP = -xLP;
break;
case paramMidHighFreq:
fMidHighFreq = std::fmax(value, fLowMidFreq);
freqHP = fMidHighFreq;
xHP = std::exp(-2.0f * kPI * freqHP / (float)d_getSampleRate());
a0HP = 1.0f - xHP;
b1HP = -xHP;
break;
}
}
void DistrhoPlugin3BandSplitter::d_setProgram(uint32_t index)
{
if (index != 0)
return;
// Default values
fLow = 0.0f;
fMid = 0.0f;
fHigh = 0.0f;
fMaster = 0.0f;
fLowMidFreq = 220.0f;
fMidHighFreq = 2000.0f;
// Internal stuff
lowVol = midVol = highVol = outVol = 1.0f;
freqLP = 200.0f;
freqHP = 2000.0f;
// reset filter values
d_activate();
}
// -----------------------------------------------------------------------
// Process
void DistrhoPlugin3BandSplitter::d_activate()
{
const float sr = (float)d_getSampleRate();
xLP = std::exp(-2.0f * kPI * freqLP / sr);
a0LP = 1.0f - xLP;
b1LP = -xLP;
xHP = std::exp(-2.0f * kPI * freqHP / sr);
a0HP = 1.0f - xHP;
b1HP = -xHP;
}
void DistrhoPlugin3BandSplitter::d_deactivate()
{
out1LP = out2LP = out1HP = out2HP = 0.0f;
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f;
}
void DistrhoPlugin3BandSplitter::d_run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in1 = inputs[0];
const float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
float* out3 = outputs[2];
float* out4 = outputs[3];
float* out5 = outputs[4];
float* out6 = outputs[5];
for (uint32_t i=0; i < frames; ++i)
{
tmp1LP = a0LP * in1[i] - b1LP * tmp1LP + kDC_ADD;
tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + kDC_ADD;
out1LP = tmp1LP - kDC_ADD;
out2LP = tmp2LP - kDC_ADD;
tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + kDC_ADD;
tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + kDC_ADD;
out1HP = in1[i] - tmp1HP - kDC_ADD;
out2HP = in2[i] - tmp2HP - kDC_ADD;
out1[i] = out1LP*lowVol * outVol;
out2[i] = out2LP*lowVol * outVol;
out3[i] = (in1[i] - out1LP - out1HP)*midVol * outVol;
out4[i] = (in2[i] - out2LP - out2HP)*midVol * outVol;
out5[i] = out1HP*highVol * outVol;
out6[i] = out2HP*highVol * outVol;
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPlugin3BandSplitter();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 113
source/modules/native-plugins/3bandsplitter/DistrhoPlugin3BandSplitter.hpp View File

@@ -1,113 +0,0 @@
/*
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#ifndef DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED
#define DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPlugin3BandSplitter : public Plugin
{
public:
enum Parameters
{
paramLow = 0,
paramMid,
paramHigh,
paramMaster,
paramLowMidFreq,
paramMidHighFreq,
paramCount
};
DistrhoPlugin3BandSplitter();
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "3BandSplitter";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
const char* d_getLicense() const noexcept override
{
return "LGPL";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('D', '3', 'E', 'S');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
float fLow, fMid, fHigh, fMaster, fLowMidFreq, fMidHighFreq;
float lowVol, midVol, highVol, outVol;
float freqLP, freqHP;
float xLP, a0LP, b1LP;
float xHP, a0HP, b1HP;
float out1LP, out2LP, out1HP, out2HP;
float tmp1LP, tmp2LP, tmp1HP, tmp2HP;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPlugin3BandSplitter)
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED

+ 0
- 35
source/modules/native-plugins/3bandsplitter/DistrhoPluginInfo.h View File

@@ -1,35 +0,0 @@
/*
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "3 Band Splitter"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2
#define DISTRHO_PLUGIN_NUM_OUTPUTS 6

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandSplitter"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 201
source/modules/native-plugins/3bandsplitter/DistrhoUI3BandSplitter.cpp View File

@@ -1,201 +0,0 @@
/*
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#include "DistrhoPlugin3BandSplitter.hpp"
#include "DistrhoUI3BandSplitter.hpp"

using DGL::Point;

START_NAMESPACE_DISTRHO

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

DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
: UI(),
fAboutWindow(this)
{
// background
fImgBackground = Image(DistrhoArtwork3BandSplitter::backgroundData, DistrhoArtwork3BandSplitter::backgroundWidth, DistrhoArtwork3BandSplitter::backgroundHeight, GL_BGR);

// about
Image aboutImage(DistrhoArtwork3BandSplitter::aboutData, DistrhoArtwork3BandSplitter::aboutWidth, DistrhoArtwork3BandSplitter::aboutHeight, GL_BGR);
fAboutWindow.setImage(aboutImage);

// sliders
Image sliderImage(DistrhoArtwork3BandSplitter::sliderData, DistrhoArtwork3BandSplitter::sliderWidth, DistrhoArtwork3BandSplitter::sliderHeight);
Point<int> sliderPosStart(57, 43);
Point<int> sliderPosEnd(57, 43 + 160);

// slider Low
fSliderLow = new ImageSlider(this, sliderImage);
fSliderLow->setId(DistrhoPlugin3BandSplitter::paramLow);
fSliderLow->setStartPos(sliderPosStart);
fSliderLow->setEndPos(sliderPosEnd);
fSliderLow->setRange(-24.0f, 24.0f);
fSliderLow->setCallback(this);

// slider Mid
sliderPosStart.setX(120);
sliderPosEnd.setX(120);
fSliderMid = new ImageSlider(*fSliderLow);
fSliderMid->setId(DistrhoPlugin3BandSplitter::paramMid);
fSliderMid->setStartPos(sliderPosStart);
fSliderMid->setEndPos(sliderPosEnd);

// slider High
sliderPosStart.setX(183);
sliderPosEnd.setX(183);
fSliderHigh = new ImageSlider(*fSliderLow);
fSliderHigh->setId(DistrhoPlugin3BandSplitter::paramHigh);
fSliderHigh->setStartPos(sliderPosStart);
fSliderHigh->setEndPos(sliderPosEnd);

// slider Master
sliderPosStart.setX(287);
sliderPosEnd.setX(287);
fSliderMaster = new ImageSlider(*fSliderLow);
fSliderMaster->setId(DistrhoPlugin3BandSplitter::paramMaster);
fSliderMaster->setStartPos(sliderPosStart);
fSliderMaster->setEndPos(sliderPosEnd);

// knobs
Image knobImage(DistrhoArtwork3BandSplitter::knobData, DistrhoArtwork3BandSplitter::knobWidth, DistrhoArtwork3BandSplitter::knobHeight);

// knob Low-Mid
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandSplitter::paramLowMidFreq);
fKnobLowMid->setAbsolutePos(65, 269);
fKnobLowMid->setRange(0.0f, 1000.0f);
fKnobLowMid->setDefault(440.0f);
fKnobLowMid->setRotationAngle(270);
fKnobLowMid->setCallback(this);

// knob Mid-High
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPlugin3BandSplitter::paramMidHighFreq);
fKnobMidHigh->setAbsolutePos(159, 269);
fKnobMidHigh->setRange(1000.0f, 20000.0f);
fKnobMidHigh->setDefault(1000.0f);
fKnobMidHigh->setRotationAngle(270);
fKnobMidHigh->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtwork3BandSplitter::aboutButtonNormalData, DistrhoArtwork3BandSplitter::aboutButtonNormalWidth, DistrhoArtwork3BandSplitter::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtwork3BandSplitter::aboutButtonHoverData, DistrhoArtwork3BandSplitter::aboutButtonHoverWidth, DistrhoArtwork3BandSplitter::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(264, 300);
fButtonAbout->setCallback(this);

// set default values
d_programChanged(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUI3BandSplitter::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case DistrhoPlugin3BandSplitter::paramLow:
fSliderLow->setValue(value);
break;
case DistrhoPlugin3BandSplitter::paramMid:
fSliderMid->setValue(value);
break;
case DistrhoPlugin3BandSplitter::paramHigh:
fSliderHigh->setValue(value);
break;
case DistrhoPlugin3BandSplitter::paramMaster:
fSliderMaster->setValue(value);
break;
case DistrhoPlugin3BandSplitter::paramLowMidFreq:
fKnobLowMid->setValue(value);
break;
case DistrhoPlugin3BandSplitter::paramMidHighFreq:
fKnobMidHigh->setValue(value);
break;
}
}

void DistrhoUI3BandSplitter::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
fSliderLow->setValue(0.0f);
fSliderMid->setValue(0.0f);
fSliderHigh->setValue(0.0f);
fSliderMaster->setValue(0.0f);
fKnobLowMid->setValue(220.0f);
fKnobMidHigh->setValue(2000.0f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUI3BandSplitter::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void DistrhoUI3BandSplitter::imageKnobDragStarted(ImageKnob* knob)
{
d_editParameter(knob->getId(), true);
}

void DistrhoUI3BandSplitter::imageKnobDragFinished(ImageKnob* knob)
{
d_editParameter(knob->getId(), false);
}

void DistrhoUI3BandSplitter::imageKnobValueChanged(ImageKnob* knob, float value)
{
d_setParameterValue(knob->getId(), value);
}

void DistrhoUI3BandSplitter::imageSliderDragStarted(ImageSlider* slider)
{
d_editParameter(slider->getId(), true);
}

void DistrhoUI3BandSplitter::imageSliderDragFinished(ImageSlider* slider)
{
d_editParameter(slider->getId(), false);
}

void DistrhoUI3BandSplitter::imageSliderValueChanged(ImageSlider* slider, float value)
{
d_setParameterValue(slider->getId(), value);
}

void DistrhoUI3BandSplitter::onDisplay()
{
fImgBackground.draw();
}

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

UI* createUI()
{
return new DistrhoUI3BandSplitter();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 95
source/modules/native-plugins/3bandsplitter/DistrhoUI3BandSplitter.hpp View File

@@ -1,95 +0,0 @@
/*
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED
#define DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"
#include "ImageSlider.hpp"

#include "DistrhoArtwork3BandSplitter.hpp"

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;
using DGL::ImageSlider;

START_NAMESPACE_DISTRHO

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

class DistrhoUI3BandSplitter : public UI,
public ImageButton::Callback,
public ImageKnob::Callback,
public ImageSlider::Callback
{
public:
DistrhoUI3BandSplitter();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return DistrhoArtwork3BandSplitter::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return DistrhoArtwork3BandSplitter::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;
void imageSliderDragStarted(ImageSlider* slider) override;
void imageSliderDragFinished(ImageSlider* slider) override;
void imageSliderValueChanged(ImageSlider* slider, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ScopedPointer<ImageButton> fButtonAbout;
ScopedPointer<ImageKnob> fKnobLowMid, fKnobMidHigh;
ScopedPointer<ImageSlider> fSliderLow, fSliderMid, fSliderHigh, fSliderMaster;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUI3BandSplitter)
};

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

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED

+ 0
- 148
source/modules/native-plugins/ImageToggle.hpp View File

@@ -1,148 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014 Damien Zammit <damien@zamaudio.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef DGL_IMAGE_TOGGLE_HPP_INCLUDED
#define DGL_IMAGE_TOGGLE_HPP_INCLUDED

#include "Image.hpp"
#include "Widget.hpp"

START_NAMESPACE_DGL

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

class ImageToggle : public Widget
{
public:
class Callback
{
public:
virtual ~Callback() {}
virtual void imageToggleClicked(ImageToggle* imageToggle, int button) = 0;
};

ImageToggle(Window& parent, const Image& imageNormal, const Image& imageDown, int id = 0)
: Widget(parent),
fImageNormal(imageNormal),
fImageDown(imageDown),
fCurImage(&fImageNormal),
fId(id),
fCallback(nullptr)
{
DISTRHO_SAFE_ASSERT(fImageNormal.getSize() == fImageDown.getSize());

setSize(fImageNormal.getSize());
}

ImageToggle(Widget* widget, const Image& imageNormal, const Image& imageDown, int id = 0)
: Widget(widget->getParentWindow()),
fImageNormal(imageNormal),
fImageDown(imageDown),
fCurImage(&fImageNormal),
fId(id),
fCallback(nullptr)
{
DISTRHO_SAFE_ASSERT(fImageNormal.getSize() == fImageDown.getSize());

setSize(fImageNormal.getSize());
}

ImageToggle(const ImageToggle& imageToggle)
: Widget(imageToggle.getParentWindow()),
fImageNormal(imageToggle.fImageNormal),
fImageDown(imageToggle.fImageDown),
fCurImage(&fImageNormal),
fId(imageToggle.fId),
fCallback(imageToggle.fCallback)
{
DISTRHO_SAFE_ASSERT(fImageNormal.getSize() == fImageDown.getSize());

setSize(fImageNormal.getSize());
}

int getId() const noexcept
{
return fId;
}

void setId(int id) noexcept
{
fId = id;
}

float getValue() const noexcept
{
return (fCurImage == &fImageNormal) ? 0.0f : 1.0f;
}

void setValue(float value) noexcept
{
if (value == 1.0f)
fCurImage = &fImageDown;
else if (value == 0.0f)
fCurImage = &fImageNormal;

repaint();
}

void setCallback(Callback* callback) noexcept
{
fCallback = callback;
}

protected:
void onDisplay() override
{
fCurImage->draw();
}

bool onMouse(const MouseEvent& ev) override
{
if (! ev.press)
return false;
if (! contains(ev.pos))
return false;

if (fCurImage != &fImageDown)
fCurImage = &fImageDown;
else if (fCurImage != &fImageNormal)
fCurImage = &fImageNormal;

repaint();

if (fCallback != nullptr)
fCallback->imageToggleClicked(this, ev.button);

return true;
}

private:
Image fImageNormal;
Image fImageDown;
Image* fCurImage;
int fId;

Callback* fCallback;

DISTRHO_LEAK_DETECTOR(ImageToggle)
};

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

END_NAMESPACE_DGL

#endif // DGL_IMAGE_TOGGLE_HPP_INCLUDED

+ 1
- 74
source/modules/native-plugins/Makefile View File

@@ -26,11 +26,6 @@ ifeq ($(HAVE_MF_DEPS),true)
ALL_C_FLAGS += -DWANT_MIDIFILE
endif

# ProjectM
ifeq ($(HAVE_PM_DEPS),true)
ALL_C_FLAGS += -DWANT_PROJECTM
endif

# ZynAddSubFX
ifeq ($(HAVE_ZYN_DEPS),true)
ALL_C_FLAGS += -DWANT_ZYNADDSUBFX
@@ -44,14 +39,6 @@ MF_CXX_FLAGS = $(BUILD_CXX_FLAGS)
MF_CXX_FLAGS += $(shell pkg-config --cflags smf)
endif

# --------------------------------------------------------------
# Flags for ProjectM

ifeq ($(HAVE_PM_DEPS),true)
PM_CXX_FLAGS = $(BUILD_CXX_FLAGS)
PM_CXX_FLAGS += $(shell pkg-config --cflags libprojectM)
endif

# --------------------------------------------------------------
# Flags for ZynAddSubFX

@@ -98,10 +85,7 @@ ifeq ($(HAVE_JUCE_UI),true)
# JUCE based plugins

OBJS += \
juce-patchbay.cpp.o \
vex-fx.cpp.o \
vex-synth.cpp.o \
vex-src.cpp.o
juce-patchbay.cpp.o
endif

# --------------------------------------------------------------
@@ -207,60 +191,6 @@ audio-file.cpp.o: audio-file.cpp audio-base.hpp $(CXXDEPS)
bigmeter.cpp.o: bigmeter.cpp $(CXXDEPS) ../CarlaNativeExtUI.hpp
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

distrho-3bandeq.cpp.o: distrho-3bandeq.cpp 3bandeq/*.cpp 3bandeq/*.h 3bandeq/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -I3bandeq -DDISTRHO_NAMESPACE=DISTRHO_3BandEQ -c -o $@

distrho-3bandsplitter.cpp.o: distrho-3bandsplitter.cpp 3bandsplitter/*.cpp 3bandsplitter/*.h 3bandsplitter/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -I3bandsplitter -DDISTRHO_NAMESPACE=DISTRHO_3BandSplitter -c -o $@

distrho-nekobi.cpp.o: distrho-nekobi.cpp nekobi/*.cpp nekobi/*.h nekobi/*.hpp nekobi/nekobee-src/*.c nekobi/nekobee-src/*.h ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Inekobi -DDISTRHO_NAMESPACE=DISTRHO_Nekobi -c -o $@

distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp pingpongpan/*.cpp pingpongpan/*.h pingpongpan/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Ipingpongpan -DDISTRHO_NAMESPACE=DISTRHO_PingPongPan -c -o $@

distrho-prom.cpp.o: distrho-prom.cpp prom/*.cpp prom/*.h prom/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(PM_CXX_FLAGS) -I../dgl -Iprom -DDISTRHO_NAMESPACE=DISTRHO_ProM -c -o $@

distrho-stereoenhancer.cpp.o: distrho-stereoenhancer.cpp stereoenhancer/*.cpp stereoenhancer/*.h stereoenhancer/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Istereoenhancer -DDISTRHO_NAMESPACE=DISTRHO_StereoEnhancer -c -o $@

distrho-groovejuice.cpp.o: distrho-groovejuice.cpp groovejuice/*.cpp groovejuice/*.h groovejuice/*.hpp groovejuice/*.hxx ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Igroovejuice -DDISTRHO_NAMESPACE=DISTRHO_GrooveJuice -c -o $@

distrho-powerjuice.cpp.o: distrho-powerjuice.cpp powerjuice/*.cpp powerjuice/*.h powerjuice/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Ipowerjuice -DDISTRHO_NAMESPACE=DISTRHO_PowerJuice -c -o $@

distrho-segmentjuice.cpp.o: distrho-segmentjuice.cpp segmentjuice/*.cpp segmentjuice/*.h segmentjuice/*.hpp segmentjuice/*.hxx ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Isegmentjuice -DDISTRHO_NAMESPACE=DISTRHO_SegmentJuice -c -o $@

distrho-vectorjuice.cpp.o: distrho-vectorjuice.cpp vectorjuice/*.cpp vectorjuice/*.h vectorjuice/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Ivectorjuice -DDISTRHO_NAMESPACE=DISTRHO_VectorJuice -c -o $@

distrho-wobblejuice.cpp.o: distrho-wobblejuice.cpp wobblejuice/*.cpp wobblejuice/*.h wobblejuice/*.hpp wobblejuice/*.hxx ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Iwobblejuice -DDISTRHO_NAMESPACE=DISTRHO_WobbleJuice -c -o $@

distrho-zamcomp.cpp.o: distrho-zamcomp.cpp zamcomp/*.cpp zamcomp/*.h zamcomp/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izamcomp -DDISTRHO_NAMESPACE=DISTRHO_ZamComp -c -o $@

distrho-zamcompx2.cpp.o: distrho-zamcompx2.cpp zamcompx2/*.cpp zamcompx2/*.h zamcompx2/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izamcompx2 -DDISTRHO_NAMESPACE=DISTRHO_ZamCompX2 -c -o $@

distrho-zameq2.cpp.o: distrho-zameq2.cpp zameq2/*.cpp zameq2/*.h zameq2/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izameq2 -DDISTRHO_NAMESPACE=DISTRHO_ZamEQ2 -c -o $@

distrho-zamsynth.cpp.o: distrho-zamsynth.cpp zamsynth/*.cpp zamsynth/*.h zamsynth/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izamsynth -DDISTRHO_NAMESPACE=DISTRHO_ZamSynth -c -o $@

distrho-zamtube.cpp.o: distrho-zamtube.cpp zamtube/*.cpp zamtube/*.h zamtube/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izamtube -DDISTRHO_NAMESPACE=DISTRHO_ZamTube -c -o $@

distrho-zamulticomp.cpp.o: distrho-zamulticomp.cpp zamulticomp/*.cpp zamulticomp/*.h zamulticomp/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izamulticomp -DDISTRHO_NAMESPACE=DISTRHO_ZaMultiComp -c -o $@

distrho-zamulticompx2.cpp.o: distrho-zamulticompx2.cpp zamulticompx2/*.cpp zamulticompx2/*.h zamulticompx2/*.hpp ../distrho/* $(CXXDEPS)
$(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -Izamulticompx2 -DDISTRHO_NAMESPACE=DISTRHO_ZaMultiCompX2 -c -o $@

juce-patchbay.cpp.o: juce-patchbay.cpp
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

@@ -273,9 +203,6 @@ midi-sequencer.cpp.o: midi-sequencer.cpp midi-base.hpp $(CXXDEPS)
notes.cpp.o: notes.cpp $(CXXDEPS) ../CarlaNativeExtUI.hpp
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

vex-%.cpp.o: vex-%.cpp vex/*
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

zynaddsubfx-%.cpp.o: zynaddsubfx-%.cpp $(CXXDEPS) $(ZYN_UI_FILES_H)
$(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@



+ 0
- 60
source/modules/native-plugins/distrho-3bandeq.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "3bandeq/DistrhoArtwork3BandEQ.cpp"
#include "3bandeq/DistrhoPlugin3BandEQ.cpp"
#include "3bandeq/DistrhoUI3BandEQ.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor _3bandeqDesc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ DistrhoPlugin3BandEQ::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "3bandeq",
/* maker */ "falkTX, Michael Gruhn",
/* copyright */ "LGPL",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_3bandeq()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&_3bandeqDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-3bandsplitter.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "3bandsplitter/DistrhoArtwork3BandSplitter.cpp"
#include "3bandsplitter/DistrhoPlugin3BandSplitter.cpp"
#include "3bandsplitter/DistrhoUI3BandSplitter.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor _3bandsplitterDesc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ DistrhoPlugin3BandSplitter::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "3bandsplitter",
/* maker */ "falkTX, Michael Gruhn",
/* copyright */ "LGPL",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_3bandsplitter()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&_3bandsplitterDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-groovejuice.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "groovejuice/GrooveJuiceArtwork.cpp"
#include "groovejuice/GrooveJuicePlugin.cpp"
#include "groovejuice/GrooveJuiceUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor groovejuiceDesc = {
/* category */ PLUGIN_CATEGORY_SYNTH,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_IS_SYNTH|PLUGIN_HAS_UI|PLUGIN_USES_TIME|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ GrooveJuicePlugin::paramCount-12,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "groovejuice",
/* maker */ "Andre Sklenar",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_groovejuice()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&groovejuiceDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-nekobi.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "nekobi/DistrhoArtworkNekobi.cpp"
#include "nekobi/DistrhoPluginNekobi.cpp"
#include "nekobi/DistrhoUINekobi.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor nekobiDesc = {
/* category */ PLUGIN_CATEGORY_SYNTH,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_IS_SYNTH|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(PLUGIN_SUPPORTS_CONTROL_CHANGES|PLUGIN_SUPPORTS_ALL_SOUND_OFF),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 1,
/* midiOuts */ 0,
/* paramIns */ DistrhoPluginNekobi::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "nekobi",
/* maker */ "falkTX, Sean Bolton and others",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_nekobi()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&nekobiDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-pingpongpan.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "pingpongpan/DistrhoArtworkPingPongPan.cpp"
#include "pingpongpan/DistrhoPluginPingPongPan.cpp"
#include "pingpongpan/DistrhoUIPingPongPan.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor pingpongpanDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ DistrhoPluginPingPongPan::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "pingpongpan",
/* maker */ "falkTX, Michael Gruhn",
/* copyright */ "LGPL",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_pingpongpan()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&pingpongpanDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-powerjuice.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "powerjuice/PowerJuiceArtwork.cpp"
#include "powerjuice/PowerJuicePlugin.cpp"
#include "powerjuice/PowerJuiceUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor powerjuiceDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_TIME|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ PowerJuicePlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "powerjuice",
/* maker */ "Andre Sklenar",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_powerjuice()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&powerjuiceDesc);
}

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

+ 0
- 59
source/modules/native-plugins/distrho-prom.cpp View File

@@ -1,59 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "prom/DistrhoPluginProM.cpp"
#include "prom/DistrhoUIProM.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor promDesc = {
/* category */ PLUGIN_CATEGORY_OTHER,
/* hints */ static_cast<NativePluginHints>(PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ 0,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "prom",
/* maker */ "falkTX",
/* copyright */ "LGPL",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_prom()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&promDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-segmentjuice.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "segmentjuice/SegmentJuiceArtwork.cpp"
#include "segmentjuice/SegmentJuicePlugin.cpp"
#include "segmentjuice/SegmentJuiceUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor segmentjuiceDesc = {
/* category */ PLUGIN_CATEGORY_SYNTH,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_IS_SYNTH|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 1,
/* midiOuts */ 0,
/* paramIns */ SegmentJuicePlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "segmentjuice",
/* maker */ "Andre Sklenar",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_segmentjuice()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&segmentjuiceDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-stereoenhancer.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "stereoenhancer/DistrhoArtworkStereoEnhancer.cpp"
#include "stereoenhancer/DistrhoPluginStereoEnhancer.cpp"
#include "stereoenhancer/DistrhoUIStereoEnhancer.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor stereoenhancerDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ DistrhoPluginStereoEnhancer::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "stereoenhancer",
/* maker */ "falkTX, Michael Gruhn",
/* copyright */ "LGPL",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_stereoenhancer()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&stereoenhancerDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-vectorjuice.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "vectorjuice/VectorJuiceArtwork.cpp"
#include "vectorjuice/VectorJuicePlugin.cpp"
#include "vectorjuice/VectorJuiceUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor vectorjuiceDesc = {
/* category */ PLUGIN_CATEGORY_UTILITY,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_TIME|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ VectorJuicePlugin::paramCount-4,
/* paramOuts */ 4,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "vectorjuice",
/* maker */ "Andre Sklenar",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_vectorjuice()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&vectorjuiceDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-wobblejuice.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "wobblejuice/WobbleJuiceArtwork.cpp"
#include "wobblejuice/WobbleJuicePlugin.cpp"
#include "wobblejuice/WobbleJuiceUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor wobblejuiceDesc = {
/* category */ PLUGIN_CATEGORY_MODULATOR,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_TIME|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ WobbleJuicePlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "wobblejuice",
/* maker */ "Andre Sklenar",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_wobblejuice()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&wobblejuiceDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-zamcomp.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zamcomp/ZamCompArtwork.cpp"
#include "zamcomp/ZamCompPlugin.cpp"
#include "zamcomp/ZamCompUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zamcompDesc = {
/* category */ PLUGIN_CATEGORY_DYNAMICS,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ ZamCompPlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zamcomp",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zamcomp()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zamcompDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-zamcompx2.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zamcompx2/ZamCompX2Artwork.cpp"
#include "zamcompx2/ZamCompX2Plugin.cpp"
#include "zamcompx2/ZamCompX2UI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zamcompx2Desc = {
/* category */ PLUGIN_CATEGORY_DYNAMICS,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ ZamCompX2Plugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zamcompx2",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zamcompx2()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zamcompx2Desc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-zameq2.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zameq2/ZamEQ2Artwork.cpp"
#include "zameq2/ZamEQ2Plugin.cpp"
#include "zameq2/ZamEQ2UI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zameq2Desc = {
/* category */ PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ ZamEQ2Plugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zameq2",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zameq2()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zameq2Desc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-zamsynth.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zamsynth/ZamSynthArtwork.cpp"
#include "zamsynth/ZamSynthPlugin.cpp"
#include "zamsynth/ZamSynthUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zamsynthDesc = {
/* category */ PLUGIN_CATEGORY_SYNTH,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_IS_SYNTH|PLUGIN_HAS_UI|PLUGIN_USES_STATE|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 1,
/* midiOuts */ 0,
/* paramIns */ ZamSynthPlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zamsynth",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zamsynth()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zamsynthDesc);
}

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

+ 0
- 61
source/modules/native-plugins/distrho-zamtube.cpp View File

@@ -1,61 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zamtube/ZamTubeArtwork.cpp"
#include "zamtube/ZamTubePlugin.cpp"
#include "zamtube/ZamTubeUI.cpp"
#include "zamtube/wdf.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zamtubeDesc = {
/* category */ PLUGIN_CATEGORY_DYNAMICS,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ ZamTubePlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zamtube",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zamtube()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zamtubeDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-zamulticomp.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zamulticomp/ZaMultiCompArtwork.cpp"
#include "zamulticomp/ZaMultiCompPlugin.cpp"
#include "zamulticomp/ZaMultiCompUI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zamulticompDesc = {
/* category */ PLUGIN_CATEGORY_DYNAMICS,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ ZaMultiCompPlugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zamulticomp",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zamulticomp()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zamulticompDesc);
}

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

+ 0
- 60
source/modules/native-plugins/distrho-zamulticompx2.cpp View File

@@ -1,60 +0,0 @@
/*
* Carla Native Plugins
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 doc/GPL.txt file.
*/

// Plugin Code
#include "zamulticompx2/ZaMultiCompX2Artwork.cpp"
#include "zamulticompx2/ZaMultiCompX2Plugin.cpp"
#include "zamulticompx2/ZaMultiCompX2UI.cpp"

// DISTRHO Code
#define DISTRHO_PLUGIN_TARGET_CARLA
#include "DistrhoPluginMain.cpp"
#include "DistrhoUIMain.cpp"

START_NAMESPACE_DISTRHO

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

static const NativePluginDescriptor zamulticompx2Desc = {
/* category */ PLUGIN_CATEGORY_DYNAMICS,
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI|PLUGIN_USES_PARENT_ID),
/* supports */ static_cast<NativePluginSupports>(0x0),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,
/* midiOuts */ 0,
/* paramIns */ ZaMultiCompX2Plugin::paramCount,
/* paramOuts */ 0,
/* name */ DISTRHO_PLUGIN_NAME,
/* label */ "zamulticompx2",
/* maker */ "Damien Zammit",
/* copyright */ "GPL v2+",
PluginDescriptorFILL(PluginCarla)
};

END_NAMESPACE_DISTRHO

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

CARLA_EXPORT
void carla_register_native_plugin_zamulticompx2()
{
USE_NAMESPACE_DISTRHO
carla_register_native_plugin(&zamulticompx2Desc);
}

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

+ 0
- 36
source/modules/native-plugins/groovejuice/DistrhoPluginInfo.h View File

@@ -1,36 +0,0 @@
/*
* Vector Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "GrooveJuice"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 1

#define DISTRHO_PLUGIN_NUM_INPUTS 0
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 1

#define DISTRHO_PLUGIN_URI "urn:distrho:GrooveJuice"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 24888
source/modules/native-plugins/groovejuice/GrooveJuiceArtwork.cpp
File diff suppressed because it is too large
View File


+ 0
- 80
source/modules/native-plugins/groovejuice/GrooveJuiceArtwork.hpp View File

@@ -1,80 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_GROOVEJUICEARTWORK_HPP
#define BINARY_GROOVEJUICEARTWORK_HPP

namespace GrooveJuiceArtwork
{
extern const char* aboutData;
const unsigned int aboutDataSize = 180000;
const unsigned int aboutWidth = 300;
const unsigned int aboutHeight = 200;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 5888;
const unsigned int aboutButtonHoverWidth = 92;
const unsigned int aboutButtonHoverHeight = 16;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 5888;
const unsigned int aboutButtonNormalWidth = 92;
const unsigned int aboutButtonNormalHeight = 16;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 1328592;
const unsigned int backgroundWidth = 712;
const unsigned int backgroundHeight = 622;

extern const char* knobData;
const unsigned int knobDataSize = 10404;
const unsigned int knobWidth = 51;
const unsigned int knobHeight = 51;

extern const char* knob2Data;
const unsigned int knob2DataSize = 14400;
const unsigned int knob2Width = 60;
const unsigned int knob2Height = 60;

extern const char* orbitData;
const unsigned int orbitDataSize = 4096;
const unsigned int orbitWidth = 32;
const unsigned int orbitHeight = 32;

extern const char* pageButtonHoverData;
const unsigned int pageButtonHoverDataSize = 5460;
const unsigned int pageButtonHoverWidth = 65;
const unsigned int pageButtonHoverHeight = 21;

extern const char* pageButtonNormalData;
const unsigned int pageButtonNormalDataSize = 5460;
const unsigned int pageButtonNormalWidth = 65;
const unsigned int pageButtonNormalHeight = 21;

extern const char* randomizeButtonHoverData;
const unsigned int randomizeButtonHoverDataSize = 7224;
const unsigned int randomizeButtonHoverWidth = 86;
const unsigned int randomizeButtonHoverHeight = 21;

extern const char* randomizeButtonNormalData;
const unsigned int randomizeButtonNormalDataSize = 7224;
const unsigned int randomizeButtonNormalWidth = 86;
const unsigned int randomizeButtonNormalHeight = 21;

extern const char* roundletData;
const unsigned int roundletDataSize = 2500;
const unsigned int roundletWidth = 25;
const unsigned int roundletHeight = 25;

extern const char* sliderData;
const unsigned int sliderDataSize = 2600;
const unsigned int sliderWidth = 26;
const unsigned int sliderHeight = 25;

extern const char* subOrbitData;
const unsigned int subOrbitDataSize = 3364;
const unsigned int subOrbitWidth = 29;
const unsigned int subOrbitHeight = 29;
}

#endif // BINARY_GROOVEJUICEARTWORK_HPP


+ 0
- 621
source/modules/native-plugins/groovejuice/GrooveJuicePlugin.cpp View File

@@ -1,621 +0,0 @@
/*
* Vector Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/
#include "GrooveJuicePlugin.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
GrooveJuicePlugin::GrooveJuicePlugin()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
// -----------------------------------------------------------------------
// Init
void GrooveJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramX:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "X";
parameter.symbol = "x";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramY:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Y";
parameter.symbol = "y";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramOrbitSpeedX:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Speed X";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 4.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 128.0f;
break;
case paramOrbitSpeedY:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Speed Y";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 4.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 128.0f;
break;
case paramOrbitSizeX:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Size X";
parameter.symbol = "osl";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramOrbitSizeY:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Size Y";
parameter.symbol = "osr";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramSubOrbitSpeed:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "SubOrbit Speed";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 32.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 128.0f;
break;
case paramSubOrbitSize:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "SubOrbit Size";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramSubOrbitSmooth:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "SubOrbit Wave";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramOrbitWaveX:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Wave X";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramOrbitPhaseX:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Phase X";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramOrbitPhaseY:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Phase Y";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramOrbitWaveY:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Orbit Wave Y";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramOrbitOutX:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "Orbit X";
parameter.symbol = "orx";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramOrbitOutY:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "Orbit Y";
parameter.symbol = "ory";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramSubOrbitOutX:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "SubOrbit X";
parameter.symbol = "sorx";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramSubOrbitOutY:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "SubOrbit Y";
parameter.symbol = "sory";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramW1Out:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramW2Out:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramMOut:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramCOut:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramROut:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramSOut:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramReOut:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramShOut:
parameter.hints = PARAMETER_IS_OUTPUT;
parameter.name = "";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
}
if (index>=17 && index<17+64) {
//int x = (index-17)%8;
//int y = (x+1)/(index-17)
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "synth";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
}
}
void GrooveJuicePlugin::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float GrooveJuicePlugin::d_getParameterValue(uint32_t index) const
{
if (index<17 || index>=17+64) {
switch (index)
{
case paramX:
return x;
case paramY:
return y;
case paramOrbitSizeX:
return orbitSizeX;
case paramOrbitSizeY:
return orbitSizeY;
case paramOrbitSpeedX:
return orbitSpeedX;
case paramOrbitSpeedY:
return orbitSpeedY;
case paramSubOrbitSpeed:
return subOrbitSpeed;
case paramSubOrbitSize:
return subOrbitSize;
case paramOrbitOutX:
return orbitX;
case paramOrbitOutY:
return orbitY;
case paramSubOrbitOutX:
return subOrbitX;
case paramSubOrbitOutY:
return subOrbitY;
case paramSubOrbitSmooth:
return subOrbitSmooth;
case paramOrbitWaveX:
return orbitWaveX;
case paramOrbitWaveY:
return orbitWaveY;
case paramOrbitPhaseX:
return orbitPhaseY;
case paramOrbitPhaseY:
return orbitPhaseY;
case paramW1Out:
return synthSound[0];
case paramW2Out:
return synthSound[1];
case paramMOut:
return synthSound[2];
case paramCOut:
return synthSound[3];
case paramROut:
return synthSound[4];
case paramSOut:
return synthSound[5];
case paramReOut:
return synthSound[6];
case paramShOut:
return synthSound[7];
default:
return 0.0f;
}
} else {
int num = (index-17); //synth params begin on #17
int x = num%8; //synth param
//synth page
int y = (num-(num%8))/8;
return synthData[x][y];
}
}
void GrooveJuicePlugin::d_setParameterValue(uint32_t index, float value)
{
if (index<17) {
switch (index)
{
case paramX:
x = value;
break;
case paramY:
y = value;
break;
case paramOrbitSpeedX:
orbitSpeedX = value;
resetPhase();
break;
case paramOrbitSpeedY:
orbitSpeedY = value;
resetPhase();
break;
case paramOrbitSizeX:
orbitSizeX = value;
break;
case paramOrbitSizeY:
orbitSizeY = value;
break;
case paramSubOrbitSpeed:
subOrbitSpeed = value;
resetPhase();
break;
case paramSubOrbitSize:
subOrbitSize = value;
break;
case paramSubOrbitSmooth:
subOrbitSmooth = value;
break;
case paramOrbitWaveX:
orbitWaveX = value;
break;
case paramOrbitWaveY:
orbitWaveY = value;
break;
case paramOrbitPhaseX:
orbitPhaseX = value;
resetPhase();
break;
case paramOrbitPhaseY:
orbitPhaseY = value;
resetPhase();
break;
}
} else {
int num = (index-17); //synth params begin on #17
int x = num%8; //synth param
//synth page
int y = (num-(num%8))/8;
synthData[x][y] = value;
}
}
void GrooveJuicePlugin::d_setProgram(uint32_t index)
{
if (index != 0)
return;
/* Default parameter values */
x = 0.5f;
y = 0.5f;
orbitSpeedX = 4.0f;
orbitSpeedY = 4.0f;
orbitSizeX = 0.5f;
orbitSizeY = 0.5f;
subOrbitSize = 0.5f;
subOrbitSpeed = 32.0f;
orbitWaveX = 3.0f;
orbitWaveY = 3.0f;
subOrbitSmooth = 0.5f;
orbitPhaseX = 0.0f;
orbitPhaseY = 0.0f;
/* Default variable values */
orbitX=orbitY=orbitTX=orbitTY=0.5;
subOrbitX=subOrbitY=subOrbitTX=subOrbitTY=0;
interpolationDivider=200;
bar=tickX=tickY=percentageX=percentageY=tickOffsetX=0;
tickOffsetY=sinePosX=sinePosY=tick=percentage=tickOffset=sinePos=0;
waveBlend=0;
synthL.setSampleRate(d_getSampleRate());
synthR.setSampleRate(d_getSampleRate());
//parameter smoothing
for (int i=0; i<2; i++) {
sA[i] = 0.99f;
sB[i] = 1.f - sA[i];
sZ[i] = 0;
}
for (int x=0; x<8; x++)
for (int y=0; y<8; y++)
synthData[x][y] = 0.5;
/* reset filter values */
d_activate();
}
// -----------------------------------------------------------------------
// Process
void GrooveJuicePlugin::d_activate()
{
//sinePos = 0;
}
void GrooveJuicePlugin::d_deactivate()
{
// all values to zero
}
void GrooveJuicePlugin::d_run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
{
float out1, out2, tX, tY;
/*
out1 = inputs[0][i]*tN(1-std::sqrt((tX*tX)+(tY*tY)));
out2 = inputs[1][i]*tN(1-std::sqrt((tX*tX)+(tY*tY)));
out1 += inputs[2][i]*tN(1-std::sqrt(((1-tX)*(1-tX))+(tY*tY)));
out2 += inputs[3][i]*tN(1-std::sqrt(((1-tX)*(1-tX))+(tY*tY)));
out1 += inputs[4][i]*tN(1-std::sqrt(((1-tX)*(1-tX))+((1-tY)*(1-tY))));
out2 += inputs[5][i]*tN(1-std::sqrt(((1-tX)*(1-tX))+((1-tY)*(1-tY))));
out1 += inputs[6][i]*tN(1-std::sqrt((tX*tX)+((1-tY)*(1-tY))));
out2 += inputs[7][i]*tN(1-std::sqrt((tX*tX)+((1-tY)*(1-tY))));
*/
for (uint32_t i = 0; i<frames; i++) {
animate();
tX = subOrbitX;
tY = subOrbitY;
//sum values
float c = 0.41421f; //mid segment
float d = c/1.41f; //side segments
float distances[8];
distances[0] = distance(d, 0, tX, tY);
distances[1] = distance(c+d, 0, tX, tY);
distances[2] = distance(1, d, tX, tY);
distances[3] = distance(1, c+d, tX, tY);
distances[4] = distance(d, 1, tX, tY);
distances[5] = distance(c+d, 1, tX, tY);
distances[6] = distance(0, d, tX, tY);
distances[7] = distance(0, c+d, tX, tY);
//std::cout << distances[0] << " ";
//std::cout << tX << std::endl;
for (int x=0; x<8; x++) {
float targetValue = 0;
for (int y=0; y<8; y++) {
targetValue += synthData[x][y]*(distances[y]);
}
synthSound[x] = tN(targetValue);
}
//printf("wave1: %f\n", synthSound[0]);
//std::cout << synthSound[0] << std::endl;
synthL.setWave(0, synthSound[0]);
synthR.setWave(0, synthSound[0]);
synthL.setWave(1, synthSound[1]);
synthR.setWave(1, synthSound[1]);
synthL.setMix(synthSound[2]);
synthR.setMix(synthSound[2]);
//synthL.setCut(synthSound[3]);
//synthR.setCut(synthSound[3]);
//synthL.setReso(synthSound[4]);
//synthR.setReso(synthSound[4]);
//synthL.setDecay(synthSound[5]);
//synthR.setDecay(synthSound[5]);
synthL.setSustain(synthSound[5]);
synthR.setSustain(synthSound[5]);
synthL.setRelease(synthSound[6]);
synthR.setRelease(synthSound[6]);
synthL.setStereo(-0.5);
synthR.setStereo(0.5);
synthL.setShape(synthSound[7]);
synthR.setShape(synthSound[7]);
float cutoff = std::exp((std::log(16000)-std::log(500))*synthSound[3]+std::log(500));
filterL.recalc(cutoff, synthSound[4]*0.8, d_getSampleRate(), synthSound[7]);
filterR.recalc(cutoff, synthSound[4]*0.8, d_getSampleRate(), synthSound[7]);
outputs[0][i] = filterL.process(synthL.run());
outputs[1][i] = filterR.process(synthL.run());
}
//outputs = buffer;
for (uint32_t i = 0; i<midiEventCount; i++) {
int mType = midiEvents[i].buf[0] & 0xF0;
//int mChan = midiEvents[i].buf[0] & 0x0F;
int mNum = midiEvents[i].buf[1];
if (mType == 0x90) {
//note on
synthL.play(mNum);
synthR.play(mNum);
} else if (mType == 0x80) {
//note off
synthL.stop(mNum);
synthR.stop(mNum);
}
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new GrooveJuicePlugin();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 280
source/modules/native-plugins/groovejuice/GrooveJuicePlugin.hpp View File

@@ -1,280 +0,0 @@
/*
* Vector Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/
#ifndef GROOVEJUICEPLUGIN_HPP_INCLUDED
#define GROOVEJUICEPLUGIN_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
#include <iostream>
#include "Synth.hxx"
#include "moogVCF.hxx"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class GrooveJuicePlugin : public Plugin
{
public:
enum Parameters
{
paramX = 0,
paramY,
paramOrbitSizeX,
paramOrbitSizeY,
paramOrbitSpeedX,
paramOrbitSpeedY,
paramSubOrbitSpeed,
paramSubOrbitSize,
paramOrbitWaveX,
paramOrbitWaveY,
paramOrbitPhaseX,
paramOrbitPhaseY,
paramSubOrbitSmooth,
paramOrbitOutX,
paramOrbitOutY,
paramSubOrbitOutX,
paramSubOrbitOutY,
w11, w21, m1, c1, r1, s1, re1, sh1,
w12, w22, m2, c2, r2, s2, re2, sh2,
w13, w23, m3, c3, r3, s3, re3, sh3,
w14, w24, m4, c4, r4, s4, re4, sh4,
w15, w25, m5, c5, r5, s5, re5, sh5,
w16, w26, m6, c6, r6, s6, re6, sh6,
w17, w27, m7, c7, r7, s7, re7, sh7,
w18, w28, m8, c8, r8, s8, re8, sh8,
paramW1Out,
paramW2Out,
paramMOut,
paramCOut,
paramROut,
paramSOut,
paramReOut,
paramShOut,
paramCount
};
inline float smoothParameter(float in, int axis) {
sZ[axis] = (in * sB[axis]) + (sZ[axis] * sA[axis]);
return sZ[axis];
}
float getSinePhase(float x) {
return (-std::sin(x));
}
float getSawPhase(float x) {
return (-(2/M_PI *std::atan(1/std::tan(x/2))));
}
float getRevSawPhase(float x) {
return ((2/M_PI *std::atan(1/std::tan(x/2))));
}
float getSquarePhase(float x) {
return (std::round((std::sin(x)+1)/2)-0.5)*2;
}
//saw, sqr, sin, revSaw
float getBlendedPhase(float x, float wave)
{
//wave = 2;
if (wave>=1 && wave<2) {
/* saw vs sqr */
waveBlend = wave-1;
return (getSawPhase(x)*(1-waveBlend) + getSquarePhase(x)*waveBlend);
} else if (wave>=2 && wave<3) {
/* sqr vs sin */
waveBlend = wave-2;
return (getSquarePhase(x)*(1-waveBlend) + getSinePhase(x)*waveBlend);
} else if (wave>=3 && wave<=4) {
/* sin vs revSaw */
waveBlend = wave-3;
return (getSinePhase(x)*(1-waveBlend) + getRevSawPhase(x)*waveBlend);
} else {
return 0.0f;
}
}
void resetPhase()
{
const TimePos& time = d_getTimePos();
if (!time.playing)
{
sinePosX = 0;
sinePosY = 0;
sinePos = 0;
}
}
float tN (float x)
{
if (x>1) x=1;
if (x<0) x=0;
return x;
}
float distance(float x, float y, float tX, float tY) {
float result = pow(tN(1-(sqrt((tX - x)*(tX - x) + (tY - y)*(tY - y)))), 3);
return result;
}
void animate()
{
//sync orbit with frame, bpm
const TimePos& time = d_getTimePos();
bar = ((120.0/(time.bbt.valid ? time.bbt.beatsPerMinute : 120.0))*(d_getSampleRate()));
int multiplier = 16;//2000*4;
tickX = bar/(std::round(orbitSpeedX))*multiplier;
tickY = bar/(std::round(orbitSpeedY))*multiplier;
tick = bar/(std::round(subOrbitSpeed))*multiplier;
if (time.playing)
{
/* if rolling then sync to timepos */
tickOffsetX = time.frame-std::floor(time.frame/tickX)*tickX;
tickOffsetY = time.frame-std::floor(time.frame/tickY)*tickY;
tickOffset = time.frame-std::floor(time.frame/tick)*tick;
percentageX = tickOffsetX/tickX;
percentageY = tickOffsetY/tickY;
percentage = tickOffset/tick;
sinePosX = (M_PI*2)*percentageX;
sinePosY = (M_PI*2)*percentageY;
sinePos = (M_PI*2)*percentage;
} else {
/* else just keep on wobblin' */
sinePosX += (2*M_PI)/(tickX);
sinePosY += (2*M_PI)/(tickY);
sinePos += (M_PI)/(tick);
if (sinePosX>2*M_PI) {
sinePosX = 0;
}
if (sinePosY>2*M_PI) {
sinePosY = 0;
}
if (sinePos>2*M_PI) {
sinePos = 0;
}
}
//0..1
//0..3
//0, 1, 2, 3
//* 0.25
//0, 0.25, 0.5, 0.75
float tempPhaseX = std::round(orbitPhaseX*3)*0.25;
float tempPhaseY = std::round(orbitPhaseY*3)*0.25;
orbitX = x+getBlendedPhase(sinePosX + tempPhaseX*(2*M_PI), std::round(orbitWaveX))*(orbitSizeX/2);
orbitY = y+getBlendedPhase(sinePosY+M_PI/2 + tempPhaseY*(2*M_PI), std::round(orbitWaveY))*(orbitSizeY/2);
subOrbitX = smoothParameter(orbitX+getBlendedPhase(sinePos, 3)*(subOrbitSize/3), 0);
subOrbitY = smoothParameter(orbitY+getBlendedPhase(sinePos+M_PI/2, 3)*(subOrbitSize/3), 1);
if (orbitX<0) orbitX=0;
if (orbitX>1) orbitX=1;
if (orbitY<0) orbitY=0;
if (orbitY>1) orbitY=1;
if (subOrbitX<0) subOrbitX=0;
if (subOrbitX>1) subOrbitX=1;
if (subOrbitY<0) subOrbitY=0;
if (subOrbitY>1) subOrbitY=1;
}
GrooveJuicePlugin();
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "GrooveJuice";
}
const char* d_getMaker() const noexcept override
{
return "Andre Sklenar";
}
const char* d_getLicense() const noexcept override
{
return "GPL v2+";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('G', 'r', 'v', 'J');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
// -------------------------------------------------------------------
private:
CSynth synthL, synthR;
MoogVCF filterL, filterR;
float x, y;
float orbitX, orbitY;
float orbitTX, orbitTY; //targetX and targetY for interpolation
float subOrbitX, subOrbitY;
float subOrbitTX, subOrbitTY;
float subOrbitSpeed, subOrbitSize, orbitSpeedX, orbitSpeedY;
float orbitSizeX, orbitSizeY;
float interpolationDivider;
float bar, tickX, tickY, percentageX, percentageY, tickOffsetX, tickOffsetY;
float sinePosX, sinePosY, tick, percentage, tickOffset, sinePos;
float orbitWaveX, orbitWaveY, subOrbitSmooth, waveBlend;
float orbitPhaseX, orbitPhaseY;
//parameter smoothing, for subOrbitX and subOrbitY
float sA[2], sB[2], sZ[2];
float synthData[8][8]; //as per gui, [param][page]
float synthSound[8];
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // GROOVEJUICE_HPP_INCLUDED

+ 0
- 763
source/modules/native-plugins/groovejuice/GrooveJuiceUI.cpp View File

@@ -1,763 +0,0 @@
/*
* Vector Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#include "GrooveJuiceUI.hpp"

using DGL::Point;

START_NAMESPACE_DISTRHO

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

GrooveJuiceUI::GrooveJuiceUI()
: UI(),
fAboutWindow(this)
{

// xy params
paramX = paramY = 0.5f;

// set the XY canvas area
fDragging = false;
fDragValid = false;
fLastX = fLastY = 0;
fCanvasArea.setPos(22+12, 49+12);
fCanvasArea.setSize(368-24, 368-24);

// background
fImgBackground = Image(GrooveJuiceArtwork::backgroundData, GrooveJuiceArtwork::backgroundWidth, GrooveJuiceArtwork::backgroundHeight, GL_BGR);

//roundlet
fImgRoundlet = Image(GrooveJuiceArtwork::roundletData, GrooveJuiceArtwork::roundletWidth, GrooveJuiceArtwork::roundletHeight);

//orbit
fImgOrbit = Image(GrooveJuiceArtwork::orbitData, GrooveJuiceArtwork::orbitWidth, GrooveJuiceArtwork::orbitHeight);

//subOrbit
fImgSubOrbit = Image(GrooveJuiceArtwork::subOrbitData, GrooveJuiceArtwork::subOrbitWidth, GrooveJuiceArtwork::subOrbitHeight);

// about
Image imageAbout(GrooveJuiceArtwork::aboutData, GrooveJuiceArtwork::aboutWidth, GrooveJuiceArtwork::aboutHeight, GL_BGR);
fAboutWindow.setImage(imageAbout);

// about button
Image aboutImageNormal(GrooveJuiceArtwork::aboutButtonNormalData, GrooveJuiceArtwork::aboutButtonNormalWidth, GrooveJuiceArtwork::aboutButtonNormalHeight);
Image aboutImageHover(GrooveJuiceArtwork::aboutButtonHoverData, GrooveJuiceArtwork::aboutButtonHoverWidth, GrooveJuiceArtwork::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(599, 17);
fButtonAbout->setCallback(this);

Image pageImageNormal(GrooveJuiceArtwork::pageButtonNormalData, GrooveJuiceArtwork::pageButtonNormalWidth, GrooveJuiceArtwork::pageButtonNormalHeight);
Image pageImageHover(GrooveJuiceArtwork::pageButtonHoverData, GrooveJuiceArtwork::pageButtonHoverWidth, GrooveJuiceArtwork::pageButtonHoverHeight);

Image randomizeImageNormal(GrooveJuiceArtwork::randomizeButtonNormalData, GrooveJuiceArtwork::randomizeButtonNormalWidth, GrooveJuiceArtwork::randomizeButtonNormalHeight);
Image randomizeImageHover(GrooveJuiceArtwork::randomizeButtonHoverData, GrooveJuiceArtwork::randomizeButtonHoverWidth, GrooveJuiceArtwork::randomizeButtonHoverHeight);

fButtonRandomize = new ImageButton(this, randomizeImageNormal, randomizeImageHover, randomizeImageHover);
fButtonRandomize->setAbsolutePos(313, 586);
fButtonRandomize->setCallback(this);

int oX = 15;
int oY = 557;
int mX = 103-oX;
int mY = 0;
for (int i=0; i<8; i++) {
fButtonsPage[i] = new ImageButton(this, pageImageNormal, pageImageHover, pageImageHover);
fButtonsPage[i]->setAbsolutePos(oX+mX*i, oY);
fButtonsPage[i]->setCallback(this);
}

// knobs
Image knobImage(GrooveJuiceArtwork::knobData, GrooveJuiceArtwork::knobWidth, GrooveJuiceArtwork::knobHeight);
Image knob2Image(GrooveJuiceArtwork::knob2Data, GrooveJuiceArtwork::knob2Width, GrooveJuiceArtwork::knob2Height);

// knob KnobOrbitSpeedX
fKnobOrbitSpeedX = new ImageKnob(this, knobImage);
fKnobOrbitSpeedX->setAbsolutePos(423, 185);
fKnobOrbitSpeedX->setStep(1.0f);
fKnobOrbitSpeedX->setRange(1.0f, 128.0f);
fKnobOrbitSpeedX->setValue(4.0f);
fKnobOrbitSpeedX->setRotationAngle(270);
fKnobOrbitSpeedX->setCallback(this);

// knob KnobOrbitSpeedY
fKnobOrbitSpeedY = new ImageKnob(this, knobImage);
fKnobOrbitSpeedY->setAbsolutePos(516, 185);
fKnobOrbitSpeedY->setStep(1.0f);
fKnobOrbitSpeedY->setRange(1.0f, 128.0f);
fKnobOrbitSpeedY->setValue(4.0f);
fKnobOrbitSpeedY->setRotationAngle(270);
fKnobOrbitSpeedY->setCallback(this);

// knob KnobOrbitSizeX
fKnobOrbitSizeX = new ImageKnob(this, knobImage);
fKnobOrbitSizeX->setAbsolutePos(423, 73);
fKnobOrbitSizeX->setRange(0.0f, 1.0f);
fKnobOrbitSizeX->setValue(0.5f);
fKnobOrbitSizeX->setRotationAngle(270);
fKnobOrbitSizeX->setCallback(this);

// knob KnobOrbitSizeY
fKnobOrbitSizeY = new ImageKnob(this, knobImage);
fKnobOrbitSizeY->setAbsolutePos(516, 73);
fKnobOrbitSizeY->setRange(0.0f, 1.0f);
fKnobOrbitSizeY->setValue(0.5f);
fKnobOrbitSizeY->setRotationAngle(270);
fKnobOrbitSizeY->setCallback(this);

// knob KnobSubOrbitSpeed
fKnobSubOrbitSpeed = new ImageKnob(this, knobImage);
fKnobSubOrbitSpeed->setAbsolutePos(620, 185);
fKnobSubOrbitSpeed->setStep(1.0f);
fKnobSubOrbitSpeed->setRange(1.0f, 128.0f);
fKnobSubOrbitSpeed->setValue(32.0f);
fKnobSubOrbitSpeed->setRotationAngle(270);
fKnobSubOrbitSpeed->setCallback(this);

// knob KnobSubOrbitSize
fKnobSubOrbitSize = new ImageKnob(this, knobImage);
fKnobSubOrbitSize->setAbsolutePos(620, 73);
fKnobSubOrbitSize->setRange(0.0f, 1.0f);
fKnobSubOrbitSize->setValue(0.5f);
fKnobSubOrbitSize->setRotationAngle(270);
fKnobSubOrbitSize->setCallback(this);

// knob KnobSubOrbitSmooth
fKnobSubOrbitSmooth = new ImageKnob(this, knobImage);
fKnobSubOrbitSmooth->setAbsolutePos(620, 297);
fKnobSubOrbitSmooth->setRange(0.0f, 1.0f);
fKnobSubOrbitSmooth->setValue(0.5f);
fKnobSubOrbitSmooth->setRotationAngle(270);
fKnobSubOrbitSmooth->setCallback(this);

// sliders
Image sliderImage(GrooveJuiceArtwork::sliderData, GrooveJuiceArtwork::sliderWidth, GrooveJuiceArtwork::sliderHeight);
Point<int> sliderPosStart(410, 284);
Point<int> sliderPosEnd(410+48, 284);

// slider OrbitWaveX
fSliderOrbitWaveX = new ImageSlider(this, sliderImage);
fSliderOrbitWaveX->setStartPos(sliderPosStart);
fSliderOrbitWaveX->setEndPos(sliderPosEnd);
fSliderOrbitWaveX->setRange(1.0f, 4.0f);
fSliderOrbitWaveX->setStep(1.0f);
fSliderOrbitWaveX->setValue(3.0f);
fSliderOrbitWaveX->setCallback(this);

// slider OrbitWaveY
sliderPosStart.setX(503);
sliderPosEnd.setX(503+48);
fSliderOrbitWaveY = new ImageSlider(this, sliderImage);
fSliderOrbitWaveY->setStartPos(sliderPosStart);
fSliderOrbitWaveY->setEndPos(sliderPosEnd);
fSliderOrbitWaveY->setRange(1.0f, 4.0f);
fSliderOrbitWaveY->setStep(1.0f);
fSliderOrbitWaveY->setValue(3.0f);
fSliderOrbitWaveY->setCallback(this);

// slider OrbitPhaseX
sliderPosStart.setX(410);
sliderPosStart.setY(345);
sliderPosEnd.setX(410+48);
sliderPosEnd.setY(345);
fSliderOrbitPhaseX = new ImageSlider(this, sliderImage);
fSliderOrbitPhaseX->setStartPos(sliderPosStart);
fSliderOrbitPhaseX->setEndPos(sliderPosEnd);
fSliderOrbitPhaseX->setRange(0.0f, 1.0f);
//fSliderOrbitPhaseX->setStep(1.0f); // FIXME?
fSliderOrbitPhaseX->setValue(0.0f);
fSliderOrbitPhaseX->setCallback(this);

// slider OrbitPhaseY
sliderPosStart.setX(503);
sliderPosEnd.setX(503+48);
fSliderOrbitPhaseY = new ImageSlider(this, sliderImage);
fSliderOrbitPhaseY->setStartPos(sliderPosStart);
fSliderOrbitPhaseY->setEndPos(sliderPosEnd);
fSliderOrbitPhaseY->setRange(0.0f, 1.0f);
//fSliderOrbitPhaseY->setStep(1.0f); // FIXME?
fSliderOrbitPhaseY->setValue(0.0f);
fSliderOrbitPhaseY->setCallback(this);

//knobs graphics
oX = 25; //offset
oY = 480;
mX = 113-oX; //margin
mY = 545-oY;
oX-=9;
oY-=9;

page = 0;



//synth Knobs
for (int x=0; x<8; x++) {
fKnobsSynth[x] = new ImageKnob(this, knob2Image);
fKnobsSynth[x]->setAbsolutePos(oX+mX*x, oY);
//fKnobsSynth[x]->setStep(1.0f);
fKnobsSynth[x]->setRange(0.0f, 1.0f);
fKnobsSynth[x]->setValue(0.5f);
fKnobsSynth[x]->setRotationAngle(270);
fKnobsSynth[x]->setCallback(this);
}


//default synthData
for (int x=0; x<8; x++)
for (int y=0; y<8; y++)
synthData[x][y] = 0.5;



//default squares
oX = 20;
oY = 47;
mX = 372/8;
for (int x=0; x<8; x++) {
for (int y=0; y<8; y++) {
squares[x][y].timer = 0;
squares[x][y].maxTimer = d_getSampleRate()/8000;
squares[x][y].x=oX+mX*x;
squares[x][y].y=oY+mX*y;
squares[x][y].size = mX;
}
}

tabOX = 15;
tabOY = 552;
tabW = 64;
tabH = 5;
tabPosX = tabOX;
tabTargetPosX = tabPosX;
tabMarginX = 103-tabOX;

// set default values
d_programChanged(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void GrooveJuiceUI::d_parameterChanged(uint32_t index, float value)
{


if (index<17 || index>=17+64) {
switch (index)
{
case GrooveJuicePlugin::paramX:
if (paramX != value)
{
paramX = value;
fDragValid = false;
repaint();
}
break;
case GrooveJuicePlugin::paramY:
if (paramY != value)
{
paramY = value;
fDragValid = false;
repaint();
}
break;
case GrooveJuicePlugin::paramOrbitSizeX:
fKnobOrbitSizeX->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitSizeY:
fKnobOrbitSizeY->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitSpeedX:
fKnobOrbitSpeedX->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitSpeedY:
fKnobOrbitSpeedY->setValue(value);
break;
case GrooveJuicePlugin::paramSubOrbitSize:
fKnobSubOrbitSize->setValue(value);
break;
case GrooveJuicePlugin::paramSubOrbitSpeed:
fKnobSubOrbitSpeed->setValue(value);
break;
case GrooveJuicePlugin::paramSubOrbitSmooth:
fKnobSubOrbitSmooth->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitWaveX:
fSliderOrbitWaveX->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitWaveY:
fSliderOrbitWaveY->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitPhaseX:
fSliderOrbitPhaseX->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitPhaseY:
fSliderOrbitPhaseY->setValue(value);
break;
case GrooveJuicePlugin::paramOrbitOutX:
if (orbitX != value)
{
orbitX = value;
repaint();
}
break;
case GrooveJuicePlugin::paramOrbitOutY:
if (orbitY != value)
{
orbitY = value;
repaint();
}
break;
case GrooveJuicePlugin::paramSubOrbitOutX:
if (subOrbitX != value)
{
subOrbitX = value;
repaint();
}
break;
case GrooveJuicePlugin::paramSubOrbitOutY:
if (subOrbitY != value)
{
subOrbitY = value;
repaint();
}
break;
case GrooveJuicePlugin::paramW1Out:
synthSound[0] = value;
repaint();
break;
case GrooveJuicePlugin::paramW2Out:
synthSound[1] = value;
repaint();
break;
case GrooveJuicePlugin::paramMOut:
synthSound[2] = value;
repaint();
break;
case GrooveJuicePlugin::paramCOut:
synthSound[3] = value;
repaint();
break;
case GrooveJuicePlugin::paramROut:
synthSound[4] = value;
repaint();
break;
case GrooveJuicePlugin::paramSOut:
synthSound[5] = value;
repaint();
break;
case GrooveJuicePlugin::paramReOut:
synthSound[6] = value;
repaint();
break;
case GrooveJuicePlugin::paramShOut:
synthSound[7] = value;
repaint();
break;
}
} else {
//synth param changed
int num = (index-17); //synth params begin on #17
int x = num%8; //synth param
//synth page
int y = (num-(num%8))/8;
synthData[x][y] = value;
}
}

void GrooveJuiceUI::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
paramX = paramY = 0.5f;
fKnobOrbitSpeedX->setValue(4.0f);
fKnobOrbitSpeedY->setValue(4.0f);
fKnobOrbitSizeX->setValue(1.0f);
fKnobOrbitSizeY->setValue(1.0f);
fKnobSubOrbitSize->setValue(1.0f);
fKnobSubOrbitSpeed->setValue(32.0f);
fKnobSubOrbitSmooth->setValue(0.5f);
fSliderOrbitWaveX->setValue(3.0f);
fSliderOrbitWaveY->setValue(3.0f);
fSliderOrbitPhaseX->setValue(0.0f);
fSliderOrbitPhaseY->setValue(0.0f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void GrooveJuiceUI::imageButtonClicked(ImageButton* button, int)
{
if (button == fButtonAbout)
fAboutWindow.exec();

if (button == fButtonRandomize) {
for (int y=0; y<8; y++) {
for (int x=0; x<8; x++) {
synthData[x][y] = getRandom();
d_setParameterValue(17+y*8+x, synthData[x][y]);

}
}

for (int x=0; x<8; x++) {
fKnobsSynth[x]->setValue(synthData[x][page]);
}

}

for (int i=0; i<8; i++) {
if (button == fButtonsPage[i]) {
page = i;
tabTargetPosX = tabOX+page*tabMarginX;
for (int x=0; x<8; x++) {
fKnobsSynth[x]->setValue(synthData[x][page]);
}
}
}


}

void GrooveJuiceUI::imageKnobDragStarted(ImageKnob* knob)
{

if (knob == fKnobOrbitSpeedX)
d_editParameter(GrooveJuicePlugin::paramOrbitSpeedX, true);
else if (knob == fKnobOrbitSpeedY)
d_editParameter(GrooveJuicePlugin::paramOrbitSpeedY, true);
else if (knob == fKnobOrbitSizeX)
d_editParameter(GrooveJuicePlugin::paramOrbitSizeX, true);
else if (knob == fKnobOrbitSizeY)
d_editParameter(GrooveJuicePlugin::paramOrbitSizeY, true);
else if (knob == fKnobSubOrbitSize)
d_editParameter(GrooveJuicePlugin::paramSubOrbitSize, true);
else if (knob == fKnobSubOrbitSpeed)
d_editParameter(GrooveJuicePlugin::paramSubOrbitSpeed, true);
else if (knob == fKnobSubOrbitSmooth)
d_editParameter(GrooveJuicePlugin::paramSubOrbitSmooth, true);

for (int i=0; i<8; i++) {
if (knob== fKnobsSynth[i]) {
d_editParameter(i+17+(page*8), true);

}
}
}

void GrooveJuiceUI::imageKnobDragFinished(ImageKnob* knob)
{

if (knob == fKnobOrbitSpeedX)
d_editParameter(GrooveJuicePlugin::paramOrbitSpeedX, false);
else if (knob == fKnobOrbitSpeedY)
d_editParameter(GrooveJuicePlugin::paramOrbitSpeedY, false);
else if (knob == fKnobOrbitSizeX)
d_editParameter(GrooveJuicePlugin::paramOrbitSizeX, false);
else if (knob == fKnobOrbitSizeY)
d_editParameter(GrooveJuicePlugin::paramOrbitSizeY, false);
else if (knob == fKnobSubOrbitSize)
d_editParameter(GrooveJuicePlugin::paramSubOrbitSize, false);
else if (knob == fKnobSubOrbitSpeed)
d_editParameter(GrooveJuicePlugin::paramSubOrbitSpeed, false);
else if (knob == fKnobSubOrbitSmooth)
d_editParameter(GrooveJuicePlugin::paramSubOrbitSmooth, false);

for (int i=0; i<8; i++) {
if (knob== fKnobsSynth[i]) {
d_editParameter(i+17+page*8, false);
}
}
}

void GrooveJuiceUI::imageKnobValueChanged(ImageKnob* knob, float value)
{

if (knob == fKnobOrbitSpeedX)
d_setParameterValue(GrooveJuicePlugin::paramOrbitSpeedX, value);
else if (knob == fKnobOrbitSpeedY)
d_setParameterValue(GrooveJuicePlugin::paramOrbitSpeedY, value);
else if (knob == fKnobOrbitSizeX)
d_setParameterValue(GrooveJuicePlugin::paramOrbitSizeX, value);
else if (knob == fKnobOrbitSizeY)
d_setParameterValue(GrooveJuicePlugin::paramOrbitSizeY, value);
else if (knob == fKnobSubOrbitSize)
d_setParameterValue(GrooveJuicePlugin::paramSubOrbitSize, value);
else if (knob == fKnobSubOrbitSpeed)
d_setParameterValue(GrooveJuicePlugin::paramSubOrbitSpeed, value);
else if (knob == fKnobSubOrbitSmooth)
d_setParameterValue(GrooveJuicePlugin::paramSubOrbitSmooth, value);

for (int i=0; i<8; i++) {
if (knob== fKnobsSynth[i]) {
synthData[i][page] = value;
d_setParameterValue(i+17+page*8, value);
}
}
}

void GrooveJuiceUI::imageSliderDragStarted(ImageSlider* slider)
{
if (slider == fSliderOrbitWaveX)
d_editParameter(GrooveJuicePlugin::paramOrbitWaveX, true);
else if (slider == fSliderOrbitWaveY)
d_editParameter(GrooveJuicePlugin::paramOrbitWaveY, true);
else if (slider == fSliderOrbitPhaseX)
d_editParameter(GrooveJuicePlugin::paramOrbitPhaseX, true);
else if (slider == fSliderOrbitPhaseY)
d_editParameter(GrooveJuicePlugin::paramOrbitPhaseY, true);
}

void GrooveJuiceUI::imageSliderDragFinished(ImageSlider* slider)
{
if (slider == fSliderOrbitWaveX)
d_editParameter(GrooveJuicePlugin::paramOrbitWaveX, false);
else if (slider == fSliderOrbitWaveY)
d_editParameter(GrooveJuicePlugin::paramOrbitWaveY, false);
else if (slider == fSliderOrbitPhaseX)
d_editParameter(GrooveJuicePlugin::paramOrbitPhaseX, false);
else if (slider == fSliderOrbitPhaseY)
d_editParameter(GrooveJuicePlugin::paramOrbitPhaseY, false);
}

void GrooveJuiceUI::imageSliderValueChanged(ImageSlider* slider, float value)
{
if (slider == fSliderOrbitWaveX)
d_setParameterValue(GrooveJuicePlugin::paramOrbitWaveX, value);
else if (slider == fSliderOrbitWaveY)
d_setParameterValue(GrooveJuicePlugin::paramOrbitWaveY, value);
else if (slider == fSliderOrbitPhaseX)
d_setParameterValue(GrooveJuicePlugin::paramOrbitPhaseX, value);
else if (slider == fSliderOrbitPhaseY)
d_setParameterValue(GrooveJuicePlugin::paramOrbitPhaseY, value);
}

void GrooveJuiceUI::onDisplay()
{
fImgBackground.draw();

/*
// TESTING - remove later
// this paints the 'fCanvasArea' so we can clearly see its bounds
{
const int x = fCanvasArea.getX();
const int y = fCanvasArea.getY();
const int w = fCanvasArea.getWidth();
const int h = fCanvasArea.getHeight();

glColor4f(0.0f, 1.0f, 0.0f, 0.1f);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(x, y);

glTexCoord2f(1.0f, 0.0f);
glVertex2i(x+w, y);

glTexCoord2f(1.0f, 1.0f);
glVertex2i(x+w, y+h);

glTexCoord2f(0.0f, 1.0f);
glVertex2i(x, y+h);
glEnd();

// reset color
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
*/

// get x, y mapped to XY area
int x = fCanvasArea.getX() + paramX*fCanvasArea.getWidth() - fImgRoundlet.getWidth()/2;
int y = fCanvasArea.getY() + paramY*fCanvasArea.getHeight() - fImgRoundlet.getHeight()/2;
int nOrbitX = fCanvasArea.getX()+((orbitX)*fCanvasArea.getWidth())-15;
int nOrbitY = fCanvasArea.getY()+((orbitY)*fCanvasArea.getWidth())-15;
int nSubOrbitX = fCanvasArea.getX()+(subOrbitX*fCanvasArea.getWidth())-15;
int nSubOrbitY = fCanvasArea.getY()+(subOrbitY*fCanvasArea.getWidth())-14;

//draw lines, just for fun
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0f, 1.0f, 0.0f, 0.05f);
glLineWidth(4);
glBegin(GL_LINES);
glVertex2i(x+ fImgRoundlet.getWidth()/2, y+ fImgRoundlet.getHeight()/2);
glVertex2i(nOrbitX+15, nOrbitY+15);
glEnd();
glBegin(GL_LINES);
glVertex2i(nOrbitX+15, nOrbitY+15);
glVertex2i(nSubOrbitX+15, nSubOrbitY+14);
glEnd();

//draw tab highlight

tabPosX -= (tabPosX-tabTargetPosX)/3;
glColor4f(0.5f, 0.5f, 1.0f, 1.0f);
glBegin(GL_POLYGON);
glVertex2i(tabPosX, tabOY);
glVertex2i(tabPosX+tabW, tabOY);
glVertex2i(tabPosX+tabW, tabOY+tabH);
glVertex2i(tabPosX, tabOY+tabH);
glEnd();

//draw real knob values
int kPosX = 6;
int kPosY = 550;
int kH = 112;
int kW = 83;
int kM = 94-kPosX;
glColor4f(1.0f, 1.0f, 1.0f, 0.1f);
for (int i=0; i<8; i++) {
glBegin(GL_POLYGON);
glVertex2i(kPosX+kM*i, kPosY);
glVertex2i(kPosX+kM*i+kW, kPosY);
glVertex2i(kPosX+kM*i+kW, kPosY-synthSound[i]*kH);
glVertex2i(kPosX+kM*i, kPosY-synthSound[i]*kH);
glEnd();

}

/*for (int x=0; x<8; x++) {
for (int y=0; y<8; y++) {
if (isWithinSquare(orbitX, orbitY, x/8.0, y/8.0)) {
if (squares[x][y].timer<squares[x][y].maxTimer) {
squares[x][y].timer++;

}
} else {
if (squares[x][y].timer>0) {
squares[x][y].timer--;
}
}
if (squares[x][y].timer>0) {
//draw this square
glColor4f(0.0f, 1.0f, 0.0f, squares[x][y].timer/squares[x][y].maxTimer/8);
//printf("blend: %f\n", squares[x][y].timer/squares[x][y].maxTimer);
glBegin(GL_POLYGON);
glVertex2i(squares[x][y].x, squares[x][y].y);
glVertex2i(squares[x][y].x+squares[x][y].size, squares[x][y].y);
glVertex2i(squares[x][y].x+squares[x][y].size, squares[x][y].y+squares[x][y].size);
glVertex2i(squares[x][y].x, squares[x][y].y+squares[x][y].size);
glEnd();

}
}
}*/


// reset color
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

// draw roundlet and orbits
fImgRoundlet.drawAt(x, y);
fImgOrbit.drawAt(nOrbitX, nOrbitY);
fImgSubOrbit.drawAt(nSubOrbitX, nSubOrbitY);



}

bool GrooveJuiceUI::onMouse(const MouseEvent& ev)
{
if (ev.button != 1)
return false;

if (ev.press)
{
if (! fCanvasArea.contains(ev.pos))
return false;

fDragging = true;
fDragValid = true;
fLastX = ev.pos.getX();
fLastY = ev.pos.getY();
return true;
}
else if (fDragging)
{
fDragging = false;
return true;
}

return false;
}

bool GrooveJuiceUI::onMotion(const MotionEvent& ev)
{
if (! fDragging)
return false;

const int x = ev.pos.getX();
const int y = ev.pos.getY();

if (! fDragValid)
{
fDragValid = true;
fLastX = x;
fLastY = y;
}

const int movedX = fLastX - x;
const int movedY = fLastY - y;
fLastX = x;
fLastY = y;

float newX = paramX;
float newY = paramY;

newX -= float(movedX)/fCanvasArea.getWidth();
newY -= float(movedY)/fCanvasArea.getHeight();

if (newX < 0.0f)
newX = 0.0f;
else if (newX > 1.0f)
newX = 1.0f;

if (newY < 0.0f)
newY = 0.0f;
else if (newY > 1.0f)
newY = 1.0f;

if (newX != paramX)
{
paramX = newX;
d_setParameterValue(GrooveJuicePlugin::paramX, paramX);
repaint();
}

if (newY != paramY)
{
paramY = newY;
d_setParameterValue(GrooveJuicePlugin::paramY, paramY);
repaint();
}

return true;
}

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

UI* createUI()
{
return new GrooveJuiceUI();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 155
source/modules/native-plugins/groovejuice/GrooveJuiceUI.hpp View File

@@ -1,155 +0,0 @@
/*
* Vector Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#ifndef GROOVEJUICEUI_HPP_INCLUDED
#define GROOVEJUICEUI_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "Geometry.hpp"
#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"
#include "ImageSlider.hpp"

#include "GrooveJuiceArtwork.hpp"
#include "GrooveJuicePlugin.hpp"

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;
using DGL::ImageSlider;
using DGL::Rectangle;

START_NAMESPACE_DISTRHO

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

class GrooveJuiceUI : public UI,
public ImageButton::Callback,
public ImageKnob::Callback,
public ImageSlider::Callback
{
public:
GrooveJuiceUI();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return GrooveJuiceArtwork::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return GrooveJuiceArtwork::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;
void imageSliderDragStarted(ImageSlider* slider) override;
void imageSliderDragFinished(ImageSlider* slider) override;
void imageSliderValueChanged(ImageSlider* slider, float value) override;

void onDisplay() override;
bool onMouse(const MouseEvent&) override;
bool onMotion(const MotionEvent&) override;

private:
float paramX, paramY;

Image fImgBackground;
Image fImgRoundlet;
Image fImgOrbit;
Image fImgSubOrbit;
ImageAboutWindow fAboutWindow;

//knobs
ScopedPointer<ImageKnob> fKnobOrbitSpeedX, fKnobOrbitSpeedY;
ScopedPointer<ImageKnob> fKnobOrbitSizeX, fKnobOrbitSizeY;
ScopedPointer<ImageKnob> fKnobSubOrbitSpeed, fKnobSubOrbitSize, fKnobSubOrbitSmooth;
ScopedPointer<ImageKnob> fKnobsSynth[8];
int page;
struct square {
float timer;
float maxTimer;
int x;
int y;
int size;
} squares[8][8];

//sliders
ScopedPointer<ImageSlider> fSliderOrbitWaveX, fSliderOrbitWaveY;
ScopedPointer<ImageSlider> fSliderOrbitPhaseX, fSliderOrbitPhaseY;

ScopedPointer<ImageButton> fButtonAbout;
ScopedPointer<ImageButton> fButtonRandomize;
ScopedPointer<ImageButton> fButtonsPage[8];

int tabOX;
int tabOY;
int tabW;
int tabH;
float tabPosX;
float tabTargetPosX;
int tabMarginX;

float getRandom() {
return static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
}


// needed for XY canvas handling
bool fDragging;
bool fDragValid;
int fLastX;
int fLastY;
Rectangle<int> fCanvasArea;
float orbitX, orbitY, subOrbitX, subOrbitY;
float synthData[8][8]; //as per gui, [param][page]
float synthSound[8];
bool isWithinSquare(float x, float y, float sX, float sY) {
if (x>=sX && x<sX+0.125)
if (y>=sY && y<sY+0.125)
return true;
return false;
};
};

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

END_NAMESPACE_DISTRHO

#endif // GROOVEJUICEUI_HPP_INCLUDED

+ 0
- 243
source/modules/native-plugins/groovejuice/Synth.hxx View File

@@ -1,243 +0,0 @@
/*
* Segment Synthesizer Design
* Implemented by Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz .
*
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*/

#ifndef SYNTH_HXX_INCLUDED
#define SYNTH_HXX_INCLUDED

#include <cmath>
#include <cstdlib>


class CSynth
{
public:
CSynth()
{
waveBlend = 0;
freq = 0;
phaseAccum = 0;
playing = false;
cycleSize = 0;
sampleRate = 0;
notePlaying = 0;
env = 0;
envPhase = 0;
aCoeff=dCoeff=rCoeff=0;
stereo = 0;
shape = 0.5;
sustain=release=0.5f;
attack=0.1f;
sustain=0.0f;
mAmp = 0.5;
freqOffset = 0;
waves[0] = 0;
waves[1] = 0;
srand (static_cast <unsigned> (time(0)));
}

float getSinePhase(float x) {
return -(std::sin(x));
}
float getSawPhase(float x) {
return (-(2/M_PI *std::atan(1/std::tan(x/2))));
}
float getRevSawPhase(float x) {
return ((2/M_PI *std::atan(1/std::tan(x/2))));
}
float getSquarePhase(float x) {
return (std::round((std::sin(x)+1)/2)-0.5)*2;
}

//saw, sqr, sin, revSaw
float getBlendedPhase(float x, float wave)
{
//wave = 2;
if (wave>=1 && wave<2) {
/* saw vs sqr */
waveBlend = wave-1;
return (getSawPhase(x)*(1-waveBlend) + getSquarePhase(x)*waveBlend);
} else if (wave>=2 && wave<3) {
/* sqr vs sin */
waveBlend = wave-2;
return (getSquarePhase(x)*(1-waveBlend) + getSinePhase(x)*waveBlend);
} else if (wave>=3 && wave<=4) {
/* sin vs revSaw */
waveBlend = wave-3;
return (getSinePhase(x)*(1-waveBlend) + getRevSawPhase(x)*waveBlend);
} else {
return 0.0f;
}
}

void setWave(int n, float nWave) {
waves[n] = nWave;
}


void setStereo(float nStereo) {
stereo = nStereo;
if (playing) {
freq = 440.0 * pow(2.0, (notePlaying - 69)/12);
freq += freq*(stereo/12);
}
}
float getRandom() {
return static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
}

void setSustain(float nSustain) {
sustain = nSustain*4;
}
void setDecay(float nDecay) {
decay = nDecay*sampleRate;
}

void setRelease(float nRelease) {
release = nRelease*sampleRate/4;
}
void setShape(float nShape) {
shape = nShape;
}
void setMix(float nMix) {
mix = nMix;
}
void setCut(float nCut) {
cut = nCut;
}
void setReso(float nReso) {
reso = nReso;
}

float getWave(int i) {
return waves[i];
}

void stop(int note) {
if (note==notePlaying) {
envPhase = 2; //release
}
}

void play(float note) {
notePlaying = note;
freq = 440.0 * pow(2.0, (notePlaying - 69)/12);
freq += freq*(freqOffset);
freq += freq*(stereo/12);
cycleSize = sampleRate/(freq/4);
playing = true;
phaseAccum = getRandom()*cycleSize;
//phaseAccum = 0;
env = 0.0f;
envPhase = 0;
//env init
decay = 1*sampleRate;
aCoeff = 1.0f - expf(-1/attack*16);
dCoeff = 1.0f - expf(-1/(decay/8));
rCoeff = 1.0f - expf(-1/(release));
}

float run() {
float out = 0;
if (playing) {

out = getSinePhase((phaseAccum/cycleSize)*(2*M_PI))*0.5;
//out += getSinePhase((phaseAccum/cycleSize)*2*(2*M_PI))*amps[0]*0.5;
//out = getSinePhase((phaseAccum/cycleSize)*2*M_PI);
//printf("out: %f\n", (waves[0]*3));
//printf("out: %f\n", phaseAccum);
out += getBlendedPhase((phaseAccum/cycleSize)*2*M_PI, (waves[0]*3)+1);
out += getBlendedPhase((phaseAccum/cycleSize)*4*M_PI, (waves[0]*3)+1)*(sustain/4);
out += getBlendedPhase((phaseAccum/cycleSize)*8*M_PI, (waves[0]*3)+1)*(sustain/4);
out += getBlendedPhase((phaseAccum/cycleSize)*16*M_PI, (waves[0]*3)+1)*(sustain/4)/2;
out += getBlendedPhase((phaseAccum/cycleSize)*6*M_PI, (waves[0]*3)+1)*shape;
out += getBlendedPhase((phaseAccum/cycleSize)*12*M_PI, (waves[0]*3)+1)*(1-shape)/2;
out += getBlendedPhase((phaseAccum/cycleSize)*3*M_PI, (waves[0]*3)+1)*(1-mix);
out += getBlendedPhase((phaseAccum/cycleSize)*4*M_PI, (waves[1]*3)+1);
out += getBlendedPhase((phaseAccum/cycleSize)*2*M_PI*(getBlendedPhase((phaseAccum/cycleSize)*M_PI, (waves[1]*3)+1)), (waves[1]*3)+1)*mix;
//printf("out: %f\n", waves[0]*4);
//std::cout << (waves[0]*3)+1 << std::endl;
phaseAccum++;
if (phaseAccum>cycleSize) {
phaseAccum = 0;
}

//calculate amplitude envelope
if (envPhase==0) {
//attack phase
env+=aCoeff * ((1.0/0.63) - env);
if (env>1.0) envPhase+=2;
} else if (envPhase==1) {
//decay and sustain phase

env+=dCoeff * (sustain/4 - env);
} else {
//release phase
env += rCoeff * (1.0-(1.0/0.63) - env);
if (env<0.0) { playing = false; env = 0.0; }
}
//apply amplitude envelope
out*=env;

//apply master volume
//out*=mAmp*0.5;
//apply hard clipping
//if (out>1) out=1;
//if (out<-1) out=-1;
if (out!=0) {
//printf("out: %f\n", out);
}
}
return out;
}
void setSampleRate(float sr) {
sampleRate = sr;
attack = sampleRate/2;
decay = sampleRate/2;
release = sampleRate/2;
}


private:
/* vcf filter */
float waves[2];
float waveBlend;
float freq;
float freqOffset;
float stereo;
float mAmp;
float phaseAccum;
float cycleSize;
float sampleRate;
float notePlaying;
bool playing;
float mix;
float reso;
float cut;
float shape;

float attack, decay, sustain, release;
float env;
float envPhase; //0, 1(d+s), 2
float aCoeff, dCoeff, rCoeff, gCoeff;
};

#endif // SYNTH_HXX_INCLUDED

+ 0
- 76
source/modules/native-plugins/groovejuice/moogVCF.hxx View File

@@ -1,76 +0,0 @@
/*
* Moog-like resonant LPF
* Implemented by Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz .
*
* Filter design from http://www.musicdsp.com .
*/

#ifndef MOOG_VCF_HXX_INCLUDED
#define MOOG_VCF_HXX_INCLUDED

#include <cmath>
#include <cstdlib>

class MoogVCF
{
public:
MoogVCF()
{
cutoff = 16000;
res = 0.5;
f=k=p=scale=r=0;
y1=y2=y3=y4=oldIn=oldY1=oldY2=oldY3=0;
in=oldIn=0;
pureInput=drivenInput=processedInput=0;
}

void recalc(float cutoff, float reso, int sr, float nDrive)
{
f = 2*cutoff/sr;
k=2*std::sin(f*M_PI/2)-1;
p = (k+1)*0.5;
scale = std::pow(2.71828, (1-p)*1.386249);
r = reso*scale;
drive = nDrive;
}

float process (float input)
{
//run the shit
//for (long i=0; i<frames; i++)
//{
pureInput = input; //clean signal
drivenInput = std::tanh(pureInput*(drive*15+1)) * (drive); //a touch of waveshaping
processedInput = pureInput*(1-drive) + drivenInput; // combine
processedInput*=1-drive/3; //reduce gain a little

/* filter */
in = processedInput-r*y4;
y1 = in*p + oldIn*p - k*y1;
y2 = y1*p + oldY1*p - k*y2;
y3 = y2*p + oldY2*p - k*y3;
y4 = y3*p + oldY3*p - k*y4;

oldIn = in;
oldY1 = y1;
oldY2 = y2;
oldY3 = y3;

/* output */
return y4;
//}
}

private:
/* vcf filter */
float cutoff; //freq in Hz
float res; //resonance 0..1
float drive; //drive 1...2;
float f, k, p, scale, r;
float y1, y2, y3, y4, oldY1, oldY2, oldY3;
float in, oldIn;
/* waveshaping vars */
float pureInput, drivenInput, processedInput;
};

#endif // MOOG_VCF_HXX_INCLUDED

+ 0
- 6890
source/modules/native-plugins/nekobi/DistrhoArtworkNekobi.cpp
File diff suppressed because it is too large
View File


+ 0
- 90
source/modules/native-plugins/nekobi/DistrhoArtworkNekobi.hpp View File

@@ -1,90 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORKNEKOBI_HPP
#define BINARY_DISTRHOARTWORKNEKOBI_HPP

namespace DistrhoArtworkNekobi
{
extern const char* aboutData;
const unsigned int aboutDataSize = 172710;
const unsigned int aboutWidth = 303;
const unsigned int aboutHeight = 190;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 5888;
const unsigned int aboutButtonHoverWidth = 92;
const unsigned int aboutButtonHoverHeight = 16;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 5888;
const unsigned int aboutButtonNormalWidth = 92;
const unsigned int aboutButtonNormalHeight = 16;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 206064;
const unsigned int backgroundWidth = 636;
const unsigned int backgroundHeight = 108;

extern const char* claw1Data;
const unsigned int claw1DataSize = 4096;
const unsigned int claw1Width = 32;
const unsigned int claw1Height = 32;

extern const char* claw2Data;
const unsigned int claw2DataSize = 4096;
const unsigned int claw2Width = 32;
const unsigned int claw2Height = 32;

extern const char* knobData;
const unsigned int knobDataSize = 10000;
const unsigned int knobWidth = 50;
const unsigned int knobHeight = 50;

extern const char* run1Data;
const unsigned int run1DataSize = 4096;
const unsigned int run1Width = 32;
const unsigned int run1Height = 32;

extern const char* run2Data;
const unsigned int run2DataSize = 4096;
const unsigned int run2Width = 32;
const unsigned int run2Height = 32;

extern const char* run3Data;
const unsigned int run3DataSize = 4096;
const unsigned int run3Width = 32;
const unsigned int run3Height = 32;

extern const char* run4Data;
const unsigned int run4DataSize = 4096;
const unsigned int run4Width = 32;
const unsigned int run4Height = 32;

extern const char* scratch1Data;
const unsigned int scratch1DataSize = 4096;
const unsigned int scratch1Width = 32;
const unsigned int scratch1Height = 32;

extern const char* scratch2Data;
const unsigned int scratch2DataSize = 4096;
const unsigned int scratch2Width = 32;
const unsigned int scratch2Height = 32;

extern const char* sitData;
const unsigned int sitDataSize = 4096;
const unsigned int sitWidth = 32;
const unsigned int sitHeight = 32;

extern const char* sliderData;
const unsigned int sliderDataSize = 6084;
const unsigned int sliderWidth = 39;
const unsigned int sliderHeight = 39;

extern const char* tailData;
const unsigned int tailDataSize = 4096;
const unsigned int tailWidth = 32;
const unsigned int tailHeight = 32;
}

#endif // BINARY_DISTRHOARTWORKNEKOBI_HPP


+ 0
- 36
source/modules/native-plugins/nekobi/DistrhoPluginInfo.h View File

@@ -1,36 +0,0 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 LICENSE file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "Nekobi"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 1

#define DISTRHO_PLUGIN_NUM_INPUTS 0
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/Nekobi"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 401
source/modules/native-plugins/nekobi/DistrhoPluginNekobi.cpp View File

@@ -1,401 +0,0 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2004 Sean Bolton and others
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 LICENSE file.
*/
#include "DistrhoPluginNekobi.hpp"
extern "C" {
#include "nekobee-src/nekobee_synth.c"
#include "nekobee-src/nekobee_voice.c"
#include "nekobee-src/nekobee_voice_render.c"
#include "nekobee-src/minblep_tables.c"
// -----------------------------------------------------------------------
// mutual exclusion
bool dssp_voicelist_mutex_trylock(nekobee_synth_t* const synth)
{
/* Attempt the mutex lock */
if (pthread_mutex_trylock(&synth->voicelist_mutex) != 0)
{
synth->voicelist_mutex_grab_failed = 1;
return false;
}
/* Clean up if a previous mutex grab failed */
if (synth->voicelist_mutex_grab_failed)
{
nekobee_synth_all_voices_off(synth);
synth->voicelist_mutex_grab_failed = 0;
}
return true;
}
bool dssp_voicelist_mutex_lock(nekobee_synth_t* const synth)
{
return (pthread_mutex_lock(&synth->voicelist_mutex) == 0);
}
bool dssp_voicelist_mutex_unlock(nekobee_synth_t* const synth)
{
return (pthread_mutex_unlock(&synth->voicelist_mutex) == 0);
}
// -----------------------------------------------------------------------
// nekobee_handle_raw_event
void nekobee_handle_raw_event(nekobee_synth_t* const synth, const uint8_t size, const uint8_t* const data)
{
if (size != 3)
return;
switch (data[0] & 0xf0)
{
case 0x80:
nekobee_synth_note_off(synth, data[1], data[2]);
break;
case 0x90:
if (data[2] > 0)
nekobee_synth_note_on(synth, data[1], data[2]);
else
nekobee_synth_note_off(synth, data[1], 64); /* shouldn't happen, but... */
break;
case 0xB0:
nekobee_synth_control_change(synth, data[1], data[2]);
break;
default:
break;
}
}
} /* extern "C" */
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPluginNekobi::DistrhoPluginNekobi()
: Plugin(paramCount, 0, 0) // 0 programs, 0 states
{
nekobee_init_tables();
// init synth
fSynth.sample_rate = d_getSampleRate();
fSynth.deltat = 1.0f / (float)d_getSampleRate();
fSynth.nugget_remains = 0;
fSynth.note_id = 0;
fSynth.polyphony = XSYNTH_DEFAULT_POLYPHONY;
fSynth.voices = XSYNTH_DEFAULT_POLYPHONY;
fSynth.monophonic = XSYNTH_MONO_MODE_ONCE;
fSynth.glide = 0;
fSynth.last_noteon_pitch = 0.0f;
fSynth.vcf_accent = 0.0f;
fSynth.vca_accent = 0.0f;
for (int i=0; i<8; ++i)
fSynth.held_keys[i] = -1;
fSynth.voice = nekobee_voice_new();
fSynth.voicelist_mutex_grab_failed = 0;
pthread_mutex_init(&fSynth.voicelist_mutex, nullptr);
fSynth.channel_pressure = 0;
fSynth.pitch_wheel_sensitivity = 0;
fSynth.pitch_wheel = 0;
for (int i=0; i<128; ++i)
{
fSynth.key_pressure[i] = 0;
fSynth.cc[i] = 0;
}
fSynth.cc[7] = 127; // full volume
fSynth.mod_wheel = 1.0f;
fSynth.pitch_bend = 1.0f;
fSynth.cc_volume = 1.0f;
// Default values
fParams.waveform = 0.0f;
fParams.tuning = 0.0f;
fParams.cutoff = 25.0f;
fParams.resonance = 25.0f;
fParams.envMod = 50.0f;
fParams.decay = 75.0f;
fParams.accent = 25.0f;
fParams.volume = 75.0f;
// Internal stuff
fSynth.waveform = 0.0f;
fSynth.tuning = 1.0f;
fSynth.cutoff = 5.0f;
fSynth.resonance = 0.8f;
fSynth.envmod = 0.3f;
fSynth.decay = 0.0002f;
fSynth.accent = 0.3f;
fSynth.volume = 0.75f;
// reset
d_deactivate();
}
DistrhoPluginNekobi::~DistrhoPluginNekobi()
{
std::free(fSynth.voice);
}
// -----------------------------------------------------------------------
// Init
void DistrhoPluginNekobi::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramWaveform:
parameter.hints = PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN;
parameter.name = "Waveform";
parameter.symbol = "waveform";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramTuning:
parameter.hints = PARAMETER_IS_AUTOMABLE; // was 0.5 <-> 2.0, log
parameter.name = "Tuning";
parameter.symbol = "tuning";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -12.0f;
parameter.ranges.max = 12.0f;
break;
case paramCutoff:
parameter.hints = PARAMETER_IS_AUTOMABLE; // modified x2.5
parameter.name = "Cutoff";
parameter.symbol = "cutoff";
parameter.unit = "%";
parameter.ranges.def = 25.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramResonance:
parameter.hints = PARAMETER_IS_AUTOMABLE; // modified x100
parameter.name = "VCF Resonance";
parameter.symbol = "resonance";
parameter.unit = "%";
parameter.ranges.def = 25.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 95.0f;
break;
case paramEnvMod:
parameter.hints = PARAMETER_IS_AUTOMABLE; // modified x100
parameter.name = "Env Mod";
parameter.symbol = "env_mod";
parameter.unit = "%";
parameter.ranges.def = 50.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramDecay:
parameter.hints = PARAMETER_IS_AUTOMABLE; // was 0.000009 <-> 0.0005, log
parameter.name = "Decay";
parameter.symbol = "decay";
parameter.unit = "%";
parameter.ranges.def = 75.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramAccent:
parameter.hints = PARAMETER_IS_AUTOMABLE; // modified x100
parameter.name = "Accent";
parameter.symbol = "accent";
parameter.unit = "%";
parameter.ranges.def = 25.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramVolume:
parameter.hints = PARAMETER_IS_AUTOMABLE; // modified x100
parameter.name = "Volume";
parameter.symbol = "volume";
parameter.unit = "%";
parameter.ranges.def = 75.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
}
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPluginNekobi::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramWaveform:
return fParams.waveform;
case paramTuning:
return fParams.tuning;
case paramCutoff:
return fParams.cutoff;
case paramResonance:
return fParams.resonance;
case paramEnvMod:
return fParams.envMod;
case paramDecay:
return fParams.decay;
case paramAccent:
return fParams.accent;
case paramVolume:
return fParams.volume;
}
return 0.0f;
}
void DistrhoPluginNekobi::d_setParameterValue(uint32_t index, float value)
{
switch (index)
{
case paramWaveform:
fParams.waveform = value;
fSynth.waveform = value;
DISTRHO_SAFE_ASSERT(fSynth.waveform == 0.0f || fSynth.waveform == 1.0f);
break;
case paramTuning:
fParams.tuning = value;
fSynth.tuning = (value+12.0f)/24.0f * 1.5 + 0.5f; // FIXME: log?
DISTRHO_SAFE_ASSERT(fSynth.tuning >= 0.5f && fSynth.tuning <= 2.0f);
break;
case paramCutoff:
fParams.cutoff = value;
fSynth.cutoff = value/2.5f;
DISTRHO_SAFE_ASSERT(fSynth.cutoff >= 0.0f && fSynth.cutoff <= 40.0f);
break;
case paramResonance:
fParams.resonance = value;
fSynth.resonance = value/100.0f;
DISTRHO_SAFE_ASSERT(fSynth.resonance >= 0.0f && fSynth.resonance <= 0.95f);
break;
case paramEnvMod:
fParams.envMod = value;
fSynth.envmod = value/100.0f;
DISTRHO_SAFE_ASSERT(fSynth.envmod >= 0.0f && fSynth.envmod <= 1.0f);
break;
case paramDecay:
fParams.decay = value;
fSynth.decay = value/100.0f * 0.000491f + 0.000009f; // FIXME: log?
DISTRHO_SAFE_ASSERT(fSynth.decay >= 0.000009f && fSynth.decay <= 0.0005f);
break;
case paramAccent:
fParams.accent = value;
fSynth.accent = value/100.0f;
DISTRHO_SAFE_ASSERT(fSynth.accent >= 0.0f && fSynth.accent <= 1.0f);
break;
case paramVolume:
fParams.volume = value;
fSynth.volume = value/100.0f;
DISTRHO_SAFE_ASSERT(fSynth.volume >= 0.0f && fSynth.volume <= 1.0f);
break;
}
}
// -----------------------------------------------------------------------
// Process
void DistrhoPluginNekobi::d_activate()
{
fSynth.nugget_remains = 0;
fSynth.note_id = 0;
if (fSynth.voice != nullptr)
nekobee_synth_all_voices_off(&fSynth);
}
void DistrhoPluginNekobi::d_deactivate()
{
if (fSynth.voice != nullptr)
nekobee_synth_all_voices_off(&fSynth);
}
void DistrhoPluginNekobi::d_run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
{
uint32_t framesDone = 0;
uint32_t curEventIndex = 0;
uint32_t burstSize;
float* out = outputs[0];
if (fSynth.voice == nullptr || ! dssp_voicelist_mutex_trylock(&fSynth))
{
std::memset(out, 0, sizeof(float)*frames);
return;
}
while (framesDone < frames)
{
if (fSynth.nugget_remains == 0)
fSynth.nugget_remains = XSYNTH_NUGGET_SIZE;
/* process any ready events */
while (curEventIndex < midiEventCount && framesDone == midiEvents[curEventIndex].frame)
{
nekobee_handle_raw_event(&fSynth, midiEvents[curEventIndex].size, midiEvents[curEventIndex].buf);
curEventIndex++;
}
/* calculate the sample count (burstSize) for the next nekobee_voice_render() call to be the smallest of:
* - control calculation quantization size (XSYNTH_NUGGET_SIZE, in samples)
* - the number of samples remaining in an already-begun nugget (synth->nugget_remains)
* - the number of samples until the next event is ready
* - the number of samples left in this run
*/
burstSize = XSYNTH_NUGGET_SIZE;
/* we're still in the middle of a nugget, so reduce the burst size
* to end when the nugget ends */
if (fSynth.nugget_remains < burstSize)
burstSize = fSynth.nugget_remains;
/* reduce burst size to end when next event is ready */
if (curEventIndex < midiEventCount && midiEvents[curEventIndex].frame - framesDone < burstSize)
burstSize = midiEvents[curEventIndex].frame - framesDone;
/* reduce burst size to end at end of this run */
if (frames - framesDone < burstSize)
burstSize = frames - framesDone;
/* render the burst */
nekobee_synth_render_voices(&fSynth, out + framesDone, burstSize, (burstSize == fSynth.nugget_remains));
framesDone += burstSize;
fSynth.nugget_remains -= burstSize;
}
dssp_voicelist_mutex_unlock(&fSynth);
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPluginNekobi();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 121
source/modules/native-plugins/nekobi/DistrhoPluginNekobi.hpp View File

@@ -1,121 +0,0 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2004 Sean Bolton and others
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 LICENSE file.
*/
#ifndef DISTRHO_PLUGIN_NEKOBI_HPP_INCLUDED
#define DISTRHO_PLUGIN_NEKOBI_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
extern "C" {
#include "nekobee-src/nekobee_synth.h"
}
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPluginNekobi : public Plugin
{
public:
enum Parameters
{
paramWaveform = 0,
paramTuning,
paramCutoff,
paramResonance,
paramEnvMod,
paramDecay,
paramAccent,
paramVolume,
paramCount
};
DistrhoPluginNekobi();
~DistrhoPluginNekobi() override;
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "Nekobi";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
const char* d_getLicense() const noexcept override
{
return "GPL v2+";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('D', 'N', 'e', 'k');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
// -------------------------------------------------------------------
private:
struct ParamValues {
float waveform;
float tuning;
float cutoff;
float resonance;
float envMod;
float decay;
float accent;
float volume;
} fParams;
nekobee_synth_t fSynth;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginNekobi)
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_NEKOBI_HPP_INCLUDED

+ 0
- 222
source/modules/native-plugins/nekobi/DistrhoUINekobi.cpp View File

@@ -1,222 +0,0 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 LICENSE file.
*/

#include "DistrhoPluginNekobi.hpp"
#include "DistrhoUINekobi.hpp"

START_NAMESPACE_DISTRHO

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

DistrhoUINekobi::DistrhoUINekobi()
: UI(),
fAboutWindow(this)
{
// FIXME
fNeko.setTimerSpeed(5);

// background
fImgBackground = Image(DistrhoArtworkNekobi::backgroundData, DistrhoArtworkNekobi::backgroundWidth, DistrhoArtworkNekobi::backgroundHeight, GL_BGR);

Image aboutImage(DistrhoArtworkNekobi::aboutData, DistrhoArtworkNekobi::aboutWidth, DistrhoArtworkNekobi::aboutHeight, GL_BGR);
fAboutWindow.setImage(aboutImage);

// slider
Image sliderImage(DistrhoArtworkNekobi::sliderData, DistrhoArtworkNekobi::sliderWidth, DistrhoArtworkNekobi::sliderHeight);

fSliderWaveform = new ImageSlider(this, sliderImage, DistrhoPluginNekobi::paramWaveform);
fSliderWaveform->setStartPos(133, 40);
fSliderWaveform->setEndPos(133, 60);
fSliderWaveform->setRange(0.0f, 1.0f);
fSliderWaveform->setStep(1.0f);
fSliderWaveform->setValue(0.0f);
fSliderWaveform->setCallback(this);

// knobs
Image knobImage(DistrhoArtworkNekobi::knobData, DistrhoArtworkNekobi::knobWidth, DistrhoArtworkNekobi::knobHeight);

// knob Tuning
fKnobTuning = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramTuning);
fKnobTuning->setAbsolutePos(41, 43);
fKnobTuning->setRange(-12.0f, 12.0f);
fKnobTuning->setDefault(0.0f);
fKnobTuning->setValue(0.0f);
fKnobTuning->setRotationAngle(305);
fKnobTuning->setCallback(this);

// knob Cutoff
fKnobCutoff = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramCutoff);
fKnobCutoff->setAbsolutePos(185, 43);
fKnobCutoff->setRange(0.0f, 100.0f);
fKnobCutoff->setDefault(25.0f);
fKnobCutoff->setValue(25.0f);
fKnobCutoff->setRotationAngle(305);
fKnobCutoff->setCallback(this);

// knob Resonance
fKnobResonance = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramResonance);
fKnobResonance->setAbsolutePos(257, 43);
fKnobResonance->setRange(0.0f, 95.0f);
fKnobResonance->setDefault(25.0f);
fKnobResonance->setValue(25.0f);
fKnobResonance->setRotationAngle(305);
fKnobResonance->setCallback(this);

// knob Env Mod
fKnobEnvMod = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramEnvMod);
fKnobEnvMod->setAbsolutePos(329, 43);
fKnobEnvMod->setRange(0.0f, 100.0f);
fKnobEnvMod->setDefault(50.0f);
fKnobEnvMod->setValue(50.0f);
fKnobEnvMod->setRotationAngle(305);
fKnobEnvMod->setCallback(this);

// knob Decay
fKnobDecay = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramDecay);
fKnobDecay->setAbsolutePos(400, 43);
fKnobDecay->setRange(0.0f, 100.0f);
fKnobDecay->setDefault(75.0f);
fKnobDecay->setValue(75.0f);
fKnobDecay->setRotationAngle(305);
fKnobDecay->setCallback(this);

// knob Accent
fKnobAccent = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramAccent);
fKnobAccent->setAbsolutePos(473, 43);
fKnobAccent->setRange(0.0f, 100.0f);
fKnobAccent->setDefault(25.0f);
fKnobAccent->setValue(25.0f);
fKnobAccent->setRotationAngle(305);
fKnobAccent->setCallback(this);

// knob Volume
fKnobVolume = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginNekobi::paramVolume);
fKnobVolume->setAbsolutePos(545, 43);
fKnobVolume->setRange(0.0f, 100.0f);
fKnobVolume->setDefault(75.0f);
fKnobVolume->setValue(75.0f);
fKnobVolume->setRotationAngle(305);
fKnobVolume->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtworkNekobi::aboutButtonNormalData, DistrhoArtworkNekobi::aboutButtonNormalWidth, DistrhoArtworkNekobi::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(505, 5);
fButtonAbout->setCallback(this);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUINekobi::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case DistrhoPluginNekobi::paramTuning:
fKnobTuning->setValue(value);
break;
case DistrhoPluginNekobi::paramWaveform:
fSliderWaveform->setValue(value);
break;
case DistrhoPluginNekobi::paramCutoff:
fKnobCutoff->setValue(value);
break;
case DistrhoPluginNekobi::paramResonance:
fKnobResonance->setValue(value);
break;
case DistrhoPluginNekobi::paramEnvMod:
fKnobEnvMod->setValue(value);
break;
case DistrhoPluginNekobi::paramDecay:
fKnobDecay->setValue(value);
break;
case DistrhoPluginNekobi::paramAccent:
fKnobAccent->setValue(value);
break;
case DistrhoPluginNekobi::paramVolume:
fKnobVolume->setValue(value);
break;
}
}

// -----------------------------------------------------------------------
// UI Callbacks

void DistrhoUINekobi::d_uiIdle()
{
if (fNeko.idle())
repaint();
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void DistrhoUINekobi::imageKnobDragStarted(ImageKnob* knob)
{
d_editParameter(knob->getId(), true);
}

void DistrhoUINekobi::imageKnobDragFinished(ImageKnob* knob)
{
d_editParameter(knob->getId(), false);
}

void DistrhoUINekobi::imageKnobValueChanged(ImageKnob* knob, float value)
{
d_setParameterValue(knob->getId(), value);
}

void DistrhoUINekobi::imageSliderDragStarted(ImageSlider* slider)
{
d_editParameter(slider->getId(), true);
}

void DistrhoUINekobi::imageSliderDragFinished(ImageSlider* slider)
{
d_editParameter(slider->getId(), false);
}

void DistrhoUINekobi::imageSliderValueChanged(ImageSlider* slider, float value)
{
d_setParameterValue(slider->getId(), value);
}

void DistrhoUINekobi::onDisplay()
{
fImgBackground.draw();
fNeko.draw();
}

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

UI* createUI()
{
return new DistrhoUINekobi();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 102
source/modules/native-plugins/nekobi/DistrhoUINekobi.hpp View File

@@ -1,102 +0,0 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 LICENSE file.
*/

#ifndef DISTRHO_UI_NEKOBI_HPP_INCLUDED
#define DISTRHO_UI_NEKOBI_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"
#include "ImageSlider.hpp"

#include "DistrhoArtworkNekobi.hpp"
#include "NekoWidget.hpp"

using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;
using DGL::ImageSlider;

START_NAMESPACE_DISTRHO

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

class DistrhoUINekobi : public UI,
public ImageButton::Callback,
public ImageKnob::Callback,
public ImageSlider::Callback
{
public:
DistrhoUINekobi();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return DistrhoArtworkNekobi::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return DistrhoArtworkNekobi::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;

// -------------------------------------------------------------------
// UI Callbacks

void d_uiIdle() override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;
void imageSliderDragStarted(ImageSlider* slider) override;
void imageSliderDragFinished(ImageSlider* slider) override;
void imageSliderValueChanged(ImageSlider* slider, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;
NekoWidget fNeko;

ScopedPointer<ImageButton> fButtonAbout;
ScopedPointer<ImageSlider> fSliderWaveform;
ScopedPointer<ImageKnob> fKnobTuning, fKnobCutoff, fKnobResonance;
ScopedPointer<ImageKnob> fKnobEnvMod, fKnobDecay, fKnobAccent, fKnobVolume;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUINekobi)
};

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

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_NEKOBI_HPP_INCLUDED

+ 0
- 202
source/modules/native-plugins/nekobi/NekoWidget.hpp View File

@@ -1,202 +0,0 @@
/*
* Neko widget animation
* Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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 LICENSE file.
*/

#ifndef NEKO_WIDGET_HPP_INCLUDED
#define NEKO_WIDGET_HPP_INCLUDED

#include "DistrhoArtworkNekobi.hpp"

#include "Image.hpp"
#include "Widget.hpp"

#include <cstdlib> // rand

using DGL::Image;

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

class NekoWidget
{
public:
NekoWidget()
: fPos(0),
fTimer(0),
fTimerSpeed(20),
fCurAction(kActionNone),
fCurImage(&fImages.sit)
{
// load images
{
using namespace DistrhoArtworkNekobi;

#define JOIN(a, b) a ## b
#define LOAD_IMAGE(NAME) fImages.NAME.loadFromMemory(JOIN(NAME, Data), JOIN(NAME, Width), JOIN(NAME, Height));

LOAD_IMAGE(sit)
LOAD_IMAGE(tail)
LOAD_IMAGE(claw1)
LOAD_IMAGE(claw2)
LOAD_IMAGE(scratch1)
LOAD_IMAGE(scratch2)
LOAD_IMAGE(run1)
LOAD_IMAGE(run2)
LOAD_IMAGE(run3)
LOAD_IMAGE(run4)

#undef JOIN
#undef LOAD_IMAGE
}
}

void draw()
{
int x = fPos+108;
int y = -2;

if (fCurImage == &fImages.claw1 || fCurImage == &fImages.claw2)
{
x += 2;
y += 12;
}

fCurImage->drawAt(x, y);
}

// returns true if needs repaint
bool idle()
{
if (++fTimer % fTimerSpeed != 0) // target is 20ms
return false;

if (fTimer == fTimerSpeed*9)
{
if (fCurAction == kActionNone)
fCurAction = static_cast<Action>(std::rand() % kActionCount);
else
fCurAction = kActionNone;

fTimer = 0;
}

switch (fCurAction)
{
case kActionNone:
if (fCurImage == &fImages.sit)
fCurImage = &fImages.tail;
else
fCurImage = &fImages.sit;
break;

case kActionClaw:
if (fCurImage == &fImages.claw1)
fCurImage = &fImages.claw2;
else
fCurImage = &fImages.claw1;
break;

case kActionScratch:
if (fCurImage == &fImages.scratch1)
fCurImage = &fImages.scratch2;
else
fCurImage = &fImages.scratch1;
break;

case kActionRunRight:
if (fTimer == 0 && fPos > 20*9)
{
// run the other way
--fTimer;
fCurAction = kActionRunLeft;
idle();
break;
}

fPos += 20;

if (fCurImage == &fImages.run1)
fCurImage = &fImages.run2;
else
fCurImage = &fImages.run1;
break;

case kActionRunLeft:
if (fTimer == 0 && fPos < 20*9)
{
// run the other way
--fTimer;
fCurAction = kActionRunRight;
idle();
break;
}

fPos -= 20;

if (fCurImage == &fImages.run3)
fCurImage = &fImages.run4;
else
fCurImage = &fImages.run3;
break;

case kActionCount:
break;
}

return true;
}

void setTimerSpeed(int speed)
{
fTimer = 0;
fTimerSpeed = speed;
}

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

private:
enum Action {
kActionNone, // bounce tail
kActionClaw,
kActionScratch,
kActionRunRight,
kActionRunLeft,
kActionCount
};

struct Images {
Image sit;
Image tail;
Image claw1;
Image claw2;
Image scratch1;
Image scratch2;
Image run1;
Image run2;
Image run3;
Image run4;
} fImages;

int fPos;
int fTimer;
int fTimerSpeed;

Action fCurAction;
Image* fCurImage;
};

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

#endif // NEKO_WIDGET_HPP_INCLUDED

+ 0
- 1779
source/modules/native-plugins/nekobi/nekobee-src/minblep_tables.c
File diff suppressed because it is too large
View File


+ 0
- 77
source/modules/native-plugins/nekobi/nekobee-src/nekobee.h View File

@@ -1,77 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Chris Cannam and Steve
* Harris's public domain DSSI example code.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#ifndef _XSYNTH_H
#define _XSYNTH_H

/* ==== debugging ==== */

/* XSYNTH_DEBUG bits */
#define XDB_DSSI 1 /* DSSI interface */
#define XDB_AUDIO 2 /* audio output */
#define XDB_NOTE 4 /* note on/off, voice allocation */
#define XDB_DATA 8 /* plugin patchbank handling */
#define GDB_MAIN 16 /* GUI main program flow */
#define GDB_OSC 32 /* GUI OSC handling */
#define GDB_IO 64 /* GUI patch file input/output */
#define GDB_GUI 128 /* GUI GUI callbacks, updating, etc. */

/* If you want debug information, define XSYNTH_DEBUG to the XDB_* bits you're
* interested in getting debug information about, bitwise-ORed together.
* Otherwise, leave it undefined. */
// #define XSYNTH_DEBUG (1+8+16+32+64)

//#define XSYNTH_DEBUG GDB_GUI + GDB_OSC

// #define XSYNTH_DEBUG XDB_DSSI
#ifdef XSYNTH_DEBUG

#include <stdio.h>
#define XSYNTH_DEBUG_INIT(x)
#define XDB_MESSAGE(type, fmt...) { if (XSYNTH_DEBUG & type) fprintf(stderr, "nekobee-dssi.so" fmt); }
#define GDB_MESSAGE(type, fmt...) { if (XSYNTH_DEBUG & type) fprintf(stderr, "nekobee_gtk" fmt); }
// -FIX-:
// #include "message_buffer.h"
// #define XSYNTH_DEBUG_INIT(x) mb_init(x)
// #define XDB_MESSAGE(type, fmt...) { \-
// if (XSYNTH_DEBUG & type) { \-
// char _m[256]; \-
// snprintf(_m, 255, fmt); \-
// add_message(_m); \-
// } \-
// }

#else /* !XSYNTH_DEBUG */

#define XDB_MESSAGE(type, fmt...)
#define GDB_MESSAGE(type, fmt...)
#define XSYNTH_DEBUG_INIT(x)

#endif /* XSYNTH_DEBUG */

/* ==== end of debugging ==== */

#define XSYNTH_MAX_POLYPHONY 1
#define XSYNTH_DEFAULT_POLYPHONY 1

#endif /* _XSYNTH_H */

+ 0
- 237
source/modules/native-plugins/nekobi/nekobee-src/nekobee_synth.c View File

@@ -1,237 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Steve Brookes'
* nekobee, copyright (C) 1999 S. J. Brookes.
* Portions of this file may have come from Peter Hanappe's
* Fluidsynth, copyright (C) 2003 Peter Hanappe and others.
* Portions of this file may have come from Chris Cannam and Steve
* Harris's public domain DSSI example code.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <pthread.h>

#include "nekobee.h"
#include "nekobee_synth.h"
#include "nekobee_voice.h"

/*
* nekobee_synth_all_voices_off
*
* stop processing all notes immediately
*/
void
nekobee_synth_all_voices_off(nekobee_synth_t *synth)
{
int i;
nekobee_voice_t *voice;

for (i = 0; i < synth->voices; i++) {
//voice = synth->voice[i];
voice = synth->voice;
if (_PLAYING(voice)) {
nekobee_voice_off(voice);
}
}
for (i = 0; i < 8; i++) synth->held_keys[i] = -1;
}

/*
* nekobee_synth_note_off
*
* handle a note off message
*/
void
nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key, unsigned char rvelocity)
{
int i, count = 0;
nekobee_voice_t *voice;

for (i = 0; i < synth->voices; i++) {
voice = synth->voice;
if (_PLAYING(voice)) {
XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_off: key %d rvel %d voice %d note id %d\n", key, rvelocity, i, voice->note_id);
nekobee_voice_note_off(synth, voice, key, 64);
count++;
}
}

if (!count)
nekobee_voice_remove_held_key(synth, key);

return;
(void)rvelocity;
}

/*
* nekobee_synth_all_notes_off
*
* put all notes into the released state
*/
void
nekobee_synth_all_notes_off(nekobee_synth_t* synth)
{
int i;
nekobee_voice_t *voice;

/* reset the sustain controller */
synth->cc[MIDI_CTL_SUSTAIN] = 0;
for (i = 0; i < synth->voices; i++) {
//voice = synth->voice[i];
voice = synth->voice;
if (_ON(voice) || _SUSTAINED(voice)) {
nekobee_voice_release_note(synth, voice);
}
}
}

/*
* nekobee_synth_note_on
*/
void
nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key, unsigned char velocity)
{
nekobee_voice_t* voice;

voice = synth->voice;
if (_PLAYING(synth->voice)) {
XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_on: retriggering mono voice on new key %d\n", key);
}

voice->note_id = synth->note_id++;

nekobee_voice_note_on(synth, voice, key, velocity);
}

/*
* nekobee_synth_update_volume
*/
void
nekobee_synth_update_volume(nekobee_synth_t* synth)
{
synth->cc_volume = (float)(synth->cc[MIDI_CTL_MSB_MAIN_VOLUME] * 128 +
synth->cc[MIDI_CTL_LSB_MAIN_VOLUME]) / 16256.0f;
if (synth->cc_volume > 1.0f)
synth->cc_volume = 1.0f;
/* don't need to check if any playing voices need updating, because it's global */
}

/*
* nekobee_synth_control_change
*/
void
nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param, signed int value)
{
synth->cc[param] = value;

switch (param) {

case MIDI_CTL_MSB_MAIN_VOLUME:
case MIDI_CTL_LSB_MAIN_VOLUME:
nekobee_synth_update_volume(synth);
break;

case MIDI_CTL_ALL_SOUNDS_OFF:
nekobee_synth_all_voices_off(synth);
break;

case MIDI_CTL_RESET_CONTROLLERS:
nekobee_synth_init_controls(synth);
break;

case MIDI_CTL_ALL_NOTES_OFF:
nekobee_synth_all_notes_off(synth);
break;

/* what others should we respond to? */

/* these we ignore (let the host handle):
* BANK_SELECT_MSB
* BANK_SELECT_LSB
* DATA_ENTRY_MSB
* NRPN_MSB
* NRPN_LSB
* RPN_MSB
* RPN_LSB
* -FIX- no! we need RPN (0, 0) Pitch Bend Sensitivity!
*/
}
}

/*
* nekobee_synth_init_controls
*/
void
nekobee_synth_init_controls(nekobee_synth_t *synth)
{
int i;

for (i = 0; i < 128; i++) {
synth->cc[i] = 0;
}

synth->cc[7] = 127; /* full volume */
nekobee_synth_update_volume(synth);
}

/*
* nekobee_synth_render_voices
*/
void
nekobee_synth_render_voices(nekobee_synth_t *synth, float *out, unsigned long sample_count,
int do_control_update)
{
unsigned long i;
float res, wow;

/* clear the buffer */
for (i = 0; i < sample_count; i++)
out[i] = 0.0f;

// we can do anything that must be updated all the time here
// this is called even when a voice isn't playing

// approximate a log scale
res = 1-synth->resonance;
wow = res*res;
wow = wow/10.0f;

// as the resonance is increased, "wow" slows down the accent attack
if ((synth->voice->velocity>90) && (synth->vcf_accent < synth->voice->vcf_eg)) {
synth->vcf_accent=(0.985-wow)*synth->vcf_accent+(0.015+wow)*synth->voice->vcf_eg;
} else {
synth->vcf_accent=(0.985-wow)*synth->vcf_accent; // or just decay
}

if (synth->voice->velocity>90) {
synth->vca_accent=0.95*synth->vca_accent+0.05; // ramp up accent on with a time constant
} else {
synth->vca_accent=0.95*synth->vca_accent; // accent off with time constant
}
#if defined(XSYNTH_DEBUG) && (XSYNTH_DEBUG & XDB_AUDIO)
out[0] += 0.10f; /* add a 'buzz' to output so there's something audible even when quiescent */
#endif /* defined(XSYNTH_DEBUG) && (XSYNTH_DEBUG & XDB_AUDIO) */
if (_PLAYING(synth->voice)) {
nekobee_voice_render(synth, synth->voice, out, sample_count, do_control_update);
}
}

+ 0
- 132
source/modules/native-plugins/nekobi/nekobee-src/nekobee_synth.h View File

@@ -1,132 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Peter Hanappe's
* Fluidsynth, copyright (C) 2003 Peter Hanappe and others.
* Portions of this file may have come from alsa-lib, copyright
* and licensed under the LGPL v2.1.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#ifndef _XSYNTH_SYNTH_H
#define _XSYNTH_SYNTH_H

#include <pthread.h>

#include "nekobee.h"
#include "nekobee_types.h"

#define XSYNTH_MONO_MODE_OFF 0
#define XSYNTH_MONO_MODE_ON 1
#define XSYNTH_MONO_MODE_ONCE 2
#define XSYNTH_MONO_MODE_BOTH 3

#define XSYNTH_GLIDE_MODE_LEGATO 0
#define XSYNTH_GLIDE_MODE_INITIAL 1
#define XSYNTH_GLIDE_MODE_ALWAYS 2
#define XSYNTH_GLIDE_MODE_LEFTOVER 3
#define XSYNTH_GLIDE_MODE_OFF 4

/*
* nekobee_synth_t
*/
struct _nekobee_synth_t {
/* output */
unsigned long sample_rate;
float deltat; /* 1 / sample_rate */
unsigned long nugget_remains;

/* voice tracking and data */
unsigned int note_id; /* incremented for every new note, used for voice-stealing prioritization */
int polyphony; /* requested polyphony, must be <= XSYNTH_MAX_POLYPHONY */
int voices; /* current polyphony, either requested polyphony above or 1 while in monophonic mode */
int monophonic; /* true if operating in monophonic mode */
int glide; /* current glide mode */
float last_noteon_pitch; /* glide start pitch for non-legato modes */
signed char held_keys[8]; /* for monophonic key tracking, an array of note-ons, most recently received first */
float vcf_accent; /* used to emulate the circuit that sweeps the vcf at full resonance */
float vca_accent; /* used to smooth the accent pulse, removing the click */

//nekobee_voice_t *voice[XSYNTH_MAX_POLYPHONY];
nekobee_voice_t *voice;
pthread_mutex_t voicelist_mutex;
int voicelist_mutex_grab_failed;

/* current non-paramter-mapped controller values */
unsigned char key_pressure[128];
unsigned char cc[128]; /* controller values */
unsigned char channel_pressure;
unsigned char pitch_wheel_sensitivity; /* in semitones */
int pitch_wheel; /* range is -8192 - 8191 */

/* translated controller values */
float mod_wheel; /* filter cutoff multiplier, off = 1.0, full on = 0.0 */
float pitch_bend; /* frequency multiplier, product of wheel setting and sensitivity, center = 1.0 */
float cc_volume; /* volume multiplier, 0.0 to 1.0 */

/* patch parameters */
float tuning;
float waveform;
float cutoff;
float resonance;
float envmod;
float decay;
float accent;
float volume;
};

void nekobee_synth_all_voices_off(nekobee_synth_t *synth);
void nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key,
unsigned char rvelocity);
void nekobee_synth_all_notes_off(nekobee_synth_t *synth);
void nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key,
unsigned char velocity);
void nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param,
signed int value);
void nekobee_synth_init_controls(nekobee_synth_t *synth);
void nekobee_synth_render_voices(nekobee_synth_t *synth, float *out,
unsigned long sample_count,
int do_control_update);

/* these come right out of alsa/asoundef.h */
#define MIDI_CTL_MSB_MODWHEEL 0x01 /**< Modulation */
#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05 /**< Portamento time */
#define MIDI_CTL_MSB_MAIN_VOLUME 0x07 /**< Main volume */
#define MIDI_CTL_MSB_BALANCE 0x08 /**< Balance */
#define MIDI_CTL_LSB_MODWHEEL 0x21 /**< Modulation */
#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25 /**< Portamento time */
#define MIDI_CTL_LSB_MAIN_VOLUME 0x27 /**< Main volume */
#define MIDI_CTL_LSB_BALANCE 0x28 /**< Balance */
#define MIDI_CTL_SUSTAIN 0x40 /**< Sustain pedal */

// nekobee defines
#define MIDI_CTL_TUNING 0x4b // impossible
#define MIDI_CTL_WAVEFORM 0x46 // select waveform
#define MIDI_CTL_CUTOFF 0x4a // VCF Cutoff
#define MIDI_CTL_RESONANCE 0x47 // VCF Resonance
#define MIDI_CTL_ENVMOD 0x01 // cheat and use modwheel
#define MIDI_CTL_DECAY 0x48 // Decay time (well release really)
#define MIDI_CTL_ACCENT 0x4c // impossible

#define MIDI_CTL_ALL_SOUNDS_OFF 0x78 /**< All sounds off */
#define MIDI_CTL_RESET_CONTROLLERS 0x79 /**< Reset Controllers */
#define MIDI_CTL_ALL_NOTES_OFF 0x7b /**< All notes off */

#define XSYNTH_SYNTH_SUSTAINED(_s) ((_s)->cc[MIDI_CTL_SUSTAIN] >= 64)

#endif /* _XSYNTH_SYNTH_H */

+ 0
- 30
source/modules/native-plugins/nekobi/nekobee-src/nekobee_types.h View File

@@ -1,30 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#ifndef _XSYNTH_TYPES_H
#define _XSYNTH_TYPES_H

#include <stddef.h>

typedef struct _nekobee_synth_t nekobee_synth_t;
typedef struct _nekobee_voice_t nekobee_voice_t;
typedef struct _nekobee_patch_t nekobee_patch_t;

#endif /* _XSYNTH_TYPES_H */

+ 0
- 256
source/modules/native-plugins/nekobi/nekobee-src/nekobee_voice.c View File

@@ -1,256 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Steve Brookes'
* nekobee, copyright (C) 1999 S. J. Brookes.
* Portions of this file may have come from Peter Hanappe's
* Fluidsynth, copyright (C) 2003 Peter Hanappe and others.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#define _BSD_SOURCE 1
#define _SVID_SOURCE 1
#define _ISOC99_SOURCE 1

#include <stdlib.h>

#include "nekobee_types.h"
#include "nekobee.h"
#include "nekobee_synth.h"
#include "nekobee_voice.h"

/*
* nekobee_voice_new
*/
nekobee_voice_t *
nekobee_voice_new()
{
nekobee_voice_t *voice;

voice = (nekobee_voice_t *)calloc(sizeof(nekobee_voice_t), 1);
if (voice) {
voice->status = XSYNTH_VOICE_OFF;
}
return voice;
}

/*
* nekobee_voice_note_on
*/
void
nekobee_voice_note_on(nekobee_synth_t *synth, nekobee_voice_t *voice,
unsigned char key, unsigned char velocity)
{
int i;

voice->key = key;
voice->velocity = velocity;


if (!synth->monophonic || !(_ON(voice) || _SUSTAINED(voice))) {

// brand-new voice, or monophonic voice in release phase; set everything up
XDB_MESSAGE(XDB_NOTE, " nekobee_voice_note_on in polyphonic/new section: key %d, mono %d, old status %d\n", key, synth->monophonic, voice->status);

voice->target_pitch = nekobee_pitch[key];

if (synth->held_keys[0] >= 0) {
voice->prev_pitch = nekobee_pitch[synth->held_keys[0]];
} else {
voice->prev_pitch = voice->target_pitch;
}
if (!_PLAYING(voice)) {
voice->lfo_pos = 0.0f;
voice->vca_eg = 0.0f;
voice->vcf_eg = 0.0f;
voice->delay1 = 0.0f;
voice->delay2 = 0.0f;
voice->delay3 = 0.0f;
voice->delay4 = 0.0f;
voice->c5 = 0.0f;
voice->osc_index = 0;
voice->osc1.last_waveform = -1;
voice->osc1.pos = 0.0f;
}
voice->vca_eg_phase = 0;
voice->vcf_eg_phase = 0;
// nekobee_voice_update_pressure_mod(synth, voice);

} else {

/* synth is monophonic, and we're modifying a playing voice */
XDB_MESSAGE(XDB_NOTE, " nekobee_voice_note_on in monophonic section: old key %d => new key %d\n", synth->held_keys[0], key);

/* set new pitch */
voice->target_pitch = nekobee_pitch[key];
if (synth->glide == XSYNTH_GLIDE_MODE_INITIAL ||
synth->glide == XSYNTH_GLIDE_MODE_OFF)
voice->prev_pitch = voice->target_pitch;

/* if in 'on' or 'both' modes, and key has changed, then re-trigger EGs */
if ((synth->monophonic == XSYNTH_MONO_MODE_ON ||
synth->monophonic == XSYNTH_MONO_MODE_BOTH) &&
(synth->held_keys[0] < 0 || synth->held_keys[0] != key)) {
voice->vca_eg_phase = 0;
voice->vcf_eg_phase = 0;
}

/* all other variables stay what they are */

}
synth->last_noteon_pitch = voice->target_pitch;

/* add new key to the list of held keys */

/* check if new key is already in the list; if so, move it to the
* top of the list, otherwise shift the other keys down and add it
* to the top of the list. */
for (i = 0; i < 7; i++) {
if (synth->held_keys[i] == key)
break;
}
for (; i > 0; i--) {
synth->held_keys[i] = synth->held_keys[i - 1];
}
synth->held_keys[0] = key;

if (!_PLAYING(voice)) {

nekobee_voice_start_voice(voice);

} else if (!_ON(voice)) { /* must be XSYNTH_VOICE_SUSTAINED or XSYNTH_VOICE_RELEASED */

voice->status = XSYNTH_VOICE_ON;

}
}

/*
* nekobee_voice_set_release_phase
*/
static inline void
nekobee_voice_set_release_phase(nekobee_voice_t *voice)
{
voice->vca_eg_phase = 2;
voice->vcf_eg_phase = 2;
}

/*
* nekobee_voice_remove_held_key
*/
inline void
nekobee_voice_remove_held_key(nekobee_synth_t *synth, unsigned char key)
{
int i;

/* check if this key is in list of held keys; if so, remove it and
* shift the other keys up */
for (i = 7; i >= 0; i--) {
if (synth->held_keys[i] == key)
break;
}
if (i >= 0) {
for (; i < 7; i++) {
synth->held_keys[i] = synth->held_keys[i + 1];
}
synth->held_keys[7] = -1;
}
}

/*
* nekobee_voice_note_off
*/
void
nekobee_voice_note_off(nekobee_synth_t *synth, nekobee_voice_t *voice,
unsigned char key, unsigned char rvelocity)
{
unsigned char previous_top_key;

XDB_MESSAGE(XDB_NOTE, " nekobee_set_note_off: called for voice %p, key %d\n", voice, key);

/* save release velocity */
voice->velocity = rvelocity;

previous_top_key = synth->held_keys[0];

/* remove this key from list of held keys */
nekobee_voice_remove_held_key(synth, key);

if (synth->held_keys[0] >= 0) {

/* still some keys held */

if (synth->held_keys[0] != previous_top_key) {

/* most-recently-played key has changed */
voice->key = synth->held_keys[0];
XDB_MESSAGE(XDB_NOTE, " note-off in monophonic section: changing pitch to %d\n", voice->key);
voice->target_pitch = nekobee_pitch[voice->key];
if (synth->glide == XSYNTH_GLIDE_MODE_INITIAL ||
synth->glide == XSYNTH_GLIDE_MODE_OFF)
voice->prev_pitch = voice->target_pitch;

/* if mono mode is 'both', re-trigger EGs */
if (synth->monophonic == XSYNTH_MONO_MODE_BOTH && !_RELEASED(voice)) {
voice->vca_eg_phase = 0;
voice->vcf_eg_phase = 0;
}

}

} else { /* no keys still held */

if (XSYNTH_SYNTH_SUSTAINED(synth)) {

/* no more keys in list, but we're sustained */
XDB_MESSAGE(XDB_NOTE, " note-off in monophonic section: sustained with no held keys\n");
if (!_RELEASED(voice))
voice->status = XSYNTH_VOICE_SUSTAINED;

} else { /* not sustained */

/* no more keys in list, so turn off note */
XDB_MESSAGE(XDB_NOTE, " note-off in monophonic section: turning off voice %p\n", voice);
nekobee_voice_set_release_phase(voice);
voice->status = XSYNTH_VOICE_RELEASED;

}
}

}

/*
* nekobee_voice_release_note
*/
void
nekobee_voice_release_note(nekobee_synth_t *synth, nekobee_voice_t *voice)
{
XDB_MESSAGE(XDB_NOTE, " nekobee_voice_release_note: turning off voice %p\n", voice);
if (_ON(voice)) {
/* dummy up a release velocity */
voice->rvelocity = 64;
}
nekobee_voice_set_release_phase(voice);
voice->status = XSYNTH_VOICE_RELEASED;

return;
(void)synth;
}

+ 0
- 183
source/modules/native-plugins/nekobi/nekobee-src/nekobee_voice.h View File

@@ -1,183 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Steve Brookes'
* nekobee, copyright (C) 1999 S. J. Brookes.
* Portions of this file may have come from Peter Hanappe's
* Fluidsynth, copyright (C) 2003 Peter Hanappe and others.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#ifndef _XSYNTH_VOICE_H
#define _XSYNTH_VOICE_H

#include <string.h>

#include "nekobee_types.h"

/* maximum size of a rendering burst */
#define XSYNTH_NUGGET_SIZE 64

/* minBLEP constants */
/* minBLEP table oversampling factor (must be a power of two): */
#define MINBLEP_PHASES 64
/* MINBLEP_PHASES minus one: */
#define MINBLEP_PHASE_MASK 63
/* length in samples of (truncated) step discontinuity delta: */
#define STEP_DD_PULSE_LENGTH 72
/* length in samples of (truncated) slope discontinuity delta: */
#define SLOPE_DD_PULSE_LENGTH 71
/* the longer of the two above: */
#define LONGEST_DD_PULSE_LENGTH STEP_DD_PULSE_LENGTH
/* MINBLEP_BUFFER_LENGTH must be at least XSYNTH_NUGGET_SIZE plus
* LONGEST_DD_PULSE_LENGTH, and not less than twice LONGEST_DD_PULSE_LENGTH: */
#define MINBLEP_BUFFER_LENGTH 512
/* delay between start of DD pulse and the discontinuity, in samples: */
#define DD_SAMPLE_DELAY 4

struct _nekobee_patch_t
{
float tuning;
unsigned char waveform;
float cutoff;
float resonance;
float envmod;
float decay;
float accent;
float volume;
};

enum nekobee_voice_status
{
XSYNTH_VOICE_OFF, /* silent: is not processed by render loop */
XSYNTH_VOICE_ON, /* has not received a note off event */
XSYNTH_VOICE_SUSTAINED, /* has received note off, but sustain controller is on */
XSYNTH_VOICE_RELEASED /* had note off, not sustained, in final decay phase of envelopes */
};

struct blosc
{
int last_waveform, /* persistent */
waveform, /* comes from LADSPA port each cycle */
bp_high; /* persistent */
float pos, /* persistent */
pw; /* comes from LADSPA port each cycle */
};

/*
* nekobee_voice_t
*/
struct _nekobee_voice_t
{
unsigned int note_id;

unsigned char status;
unsigned char key;
unsigned char velocity;
unsigned char rvelocity; /* the note-off velocity */

/* translated controller values */
float pressure; /* filter resonance multiplier, off = 1.0, full on = 0.0 */

/* persistent voice state */
float prev_pitch,
target_pitch,
lfo_pos;
struct blosc osc1;
float vca_eg,
vcf_eg,
accent_slug,
delay1,
delay2,
delay3,
delay4,
c5;
unsigned char vca_eg_phase,
vcf_eg_phase;
int osc_index; /* shared index into osc_audio */
float osc_audio[MINBLEP_BUFFER_LENGTH];
float freqcut_buf[XSYNTH_NUGGET_SIZE];
float vca_buf[XSYNTH_NUGGET_SIZE];
};

#define _PLAYING(voice) ((voice)->status != XSYNTH_VOICE_OFF)
#define _ON(voice) ((voice)->status == XSYNTH_VOICE_ON)
#define _SUSTAINED(voice) ((voice)->status == XSYNTH_VOICE_SUSTAINED)
#define _RELEASED(voice) ((voice)->status == XSYNTH_VOICE_RELEASED)
#define _AVAILABLE(voice) ((voice)->status == XSYNTH_VOICE_OFF)

extern float nekobee_pitch[128];

typedef struct { float value, delta; } float_value_delta;
extern float_value_delta step_dd_table[];

extern float slope_dd_table[];

/* nekobee_voice.c */
nekobee_voice_t *nekobee_voice_new();
void nekobee_voice_note_on(nekobee_synth_t *synth,
nekobee_voice_t *voice,
unsigned char key,
unsigned char velocity);
void nekobee_voice_remove_held_key(nekobee_synth_t *synth,
unsigned char key);
void nekobee_voice_note_off(nekobee_synth_t *synth,
nekobee_voice_t *voice,
unsigned char key,
unsigned char rvelocity);
void nekobee_voice_release_note(nekobee_synth_t *synth,
nekobee_voice_t *voice);
void nekobee_voice_set_ports(nekobee_synth_t *synth,
nekobee_patch_t *patch);
void nekobee_voice_update_pressure_mod(nekobee_synth_t *synth,
nekobee_voice_t *voice);

/* nekobee_voice_render.c */
void nekobee_init_tables(void);
void nekobee_voice_render(nekobee_synth_t *synth, nekobee_voice_t *voice,
float *out, unsigned long sample_count,
int do_control_update);

/* inline functions */

/*
* nekobee_voice_off
*
* Purpose: Turns off a voice immediately, meaning that it is not processed
* anymore by the render loop.
*/
static inline void
nekobee_voice_off(nekobee_voice_t* voice)
{
voice->status = XSYNTH_VOICE_OFF;
/* silence the oscillator buffer for the next use */
memset(voice->osc_audio, 0, MINBLEP_BUFFER_LENGTH * sizeof(float));
/* -FIX- decrement active voice count? */
}

/*
* nekobee_voice_start_voice
*/
static inline void
nekobee_voice_start_voice(nekobee_voice_t *voice)
{
voice->status = XSYNTH_VOICE_ON;
/* -FIX- increment active voice count? */
}

#endif /* _XSYNTH_VOICE_H */

+ 0
- 414
source/modules/native-plugins/nekobi/nekobee-src/nekobee_voice_render.c View File

@@ -1,414 +0,0 @@
/* nekobee DSSI software synthesizer plugin
*/

#define _BSD_SOURCE 1
#define _SVID_SOURCE 1
#define _ISOC99_SOURCE 1

#include <math.h>

#include "nekobee.h"
#include "nekobee_synth.h"
#include "nekobee_voice.h"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

#define M_2PI_F (2.0f * (float)M_PI)
#define M_PI_F (float)M_PI

#define VCF_FREQ_MAX (0.825f) /* original filters only stable to this frequency */

static int tables_initialized = 0;

float nekobee_pitch[128];

#define pitch_ref_note 69

#define volume_to_amplitude_scale 128

static float volume_to_amplitude_table[4 + volume_to_amplitude_scale + 2];

static float velocity_to_attenuation[128];

static float qdB_to_amplitude_table[4 + 256 + 0];

void
nekobee_init_tables(void)
{
int i;
float pexp;
float volume, volume_exponent;
float ol, amp;

if (tables_initialized)
return;

/* MIDI note to pitch */
for (i = 0; i < 128; ++i) {
pexp = (float)(i - pitch_ref_note) / 12.0f;
nekobee_pitch[i] = powf(2.0f, pexp);
}

/* volume to amplitude
*
* This generates a curve which is:
* volume_to_amplitude_table[128 + 4] = 0.25 * 3.16... ~= -2dB
* volume_to_amplitude_table[64 + 4] = 0.25 * 1.0 ~= -12dB
* volume_to_amplitude_table[32 + 4] = 0.25 * 0.316... ~= -22dB
* volume_to_amplitude_table[16 + 4] = 0.25 * 0.1 ~= -32dB
* etc.
*/
volume_exponent = 1.0f / (2.0f * log10f(2.0f));
for (i = 0; i <= volume_to_amplitude_scale; i++) {
volume = (float)i / (float)volume_to_amplitude_scale;
volume_to_amplitude_table[i + 4] = powf(2.0f * volume, volume_exponent) / 4.0f;
}
volume_to_amplitude_table[ -1 + 4] = 0.0f;
volume_to_amplitude_table[129 + 4] = volume_to_amplitude_table[128 + 4];

/* velocity to attenuation
*
* Creates the velocity to attenuation lookup table, for converting
* velocities [1, 127] to full-velocity-sensitivity attenuation in
* quarter decibels. Modeled after my TX-7's velocity response.*/
velocity_to_attenuation[0] = 253.9999f;
for (i = 1; i < 127; i++) {
if (i >= 10) {
ol = (powf(((float)i / 127.0f), 0.32f) - 1.0f) * 100.0f;
amp = powf(2.0f, ol / 8.0f);
} else {
ol = (powf(((float)10 / 127.0f), 0.32f) - 1.0f) * 100.0f;
amp = powf(2.0f, ol / 8.0f) * (float)i / 10.0f;
}
velocity_to_attenuation[i] = log10f(amp) * -80.0f;
}
velocity_to_attenuation[127] = 0.0f;

/* quarter-decibel attenuation to amplitude */
qdB_to_amplitude_table[-1 + 4] = 1.0f;
for (i = 0; i <= 255; i++) {
qdB_to_amplitude_table[i + 4] = powf(10.0f, (float)i / -80.0f);
}

tables_initialized = 1;
}

static inline float
volume(float level)
{
unsigned char segment;
float fract;

level *= (float)volume_to_amplitude_scale;
segment = lrintf(level - 0.5f);
fract = level - (float)segment;

return volume_to_amplitude_table[segment + 4] + fract *
(volume_to_amplitude_table[segment + 5] -
volume_to_amplitude_table[segment + 4]);
}

static inline float
qdB_to_amplitude(float qdB)
{
int i = lrintf(qdB - 0.5f);
float f = qdB - (float)i;
return qdB_to_amplitude_table[i + 4] + f *
(qdB_to_amplitude_table[i + 5] -
qdB_to_amplitude_table[i + 4]);
}

void blosc_place_step_dd(float *buffer, int index, float phase, float w, float scale){
float r;
int i;

r = MINBLEP_PHASES * phase / w;
i = lrintf(r - 0.5f);
r -= (float)i;
i &= MINBLEP_PHASE_MASK; /* port changes can cause i to be out-of-range */
/* This would be better than the above, but more expensive:
* while (i < 0) {
* i += MINBLEP_PHASES;
* index++;
* }
*/

while (i < MINBLEP_PHASES * STEP_DD_PULSE_LENGTH) {
buffer[index] += scale * (step_dd_table[i].value + r * step_dd_table[i].delta);
i += MINBLEP_PHASES;
index++;
}
}


void vco(unsigned long sample_count, nekobee_voice_t *voice, struct blosc *osc,
int index, float w)

{
unsigned long sample;
float pos = osc->pos;
float pw, gain, halfgain, out;
pw=0.46f;
gain=1.0f;
halfgain=gain*0.5f;
int bp_high = osc->bp_high;
out=(bp_high ? halfgain : -halfgain);

switch (osc->waveform)
{
default:
case 0: {

for (sample = 0; sample < sample_count; sample++) {
pos += w;
if (bp_high) {
if (pos >= pw) {
blosc_place_step_dd(voice->osc_audio, index, pos - pw, w, -gain);
bp_high = 0;
out = -halfgain;
}
if (pos >= 1.0f) {
pos -= 1.0f;
blosc_place_step_dd(voice->osc_audio, index, pos, w, gain);
bp_high = 1;
out = halfgain;
}
} else {
if (pos >= 1.0f) {
pos -= 1.0f;
blosc_place_step_dd(voice->osc_audio, index, pos, w, gain);
bp_high = 1;
out = halfgain;
}

if (bp_high && pos >= pw) {
blosc_place_step_dd(voice->osc_audio, index, pos - pw, w, -gain);
bp_high = 0;
out = -halfgain;
}
}

voice->osc_audio[index + DD_SAMPLE_DELAY] += out;

index++;
}

osc->pos = pos;
osc->bp_high = bp_high;
break;
}
case 1: // sawtooth wave
{
for (sample=0; sample < sample_count; sample++) {
pos += w;
if (pos >= 1.0f) {
pos -= 1.0f;
blosc_place_step_dd(voice->osc_audio, index, pos, w, gain);
}
voice->osc_audio[index + DD_SAMPLE_DELAY] += gain * (0.5f - pos);

index++;
}

break;
}

}

osc->pos=pos;
}

static inline void
vcf_4pole(nekobee_voice_t *voice, unsigned long sample_count,
float *in, float *out, float *cutoff, float qres, float *amp)
{
unsigned long sample;
float freqcut, freqcut2, highpass,
delay1 = voice->delay1,
delay2 = voice->delay2,
delay3 = voice->delay3,
delay4 = voice->delay4;

qres = 2.0f - qres * 1.995f;

for (sample = 0; sample < sample_count; sample++) {

/* Hal Chamberlin's state variable filter */

freqcut = cutoff[sample] * 2.0f;
freqcut2 = cutoff[sample] * 4.0f;


if (freqcut > VCF_FREQ_MAX) freqcut = VCF_FREQ_MAX;
if (freqcut2 > VCF_FREQ_MAX) freqcut2 = VCF_FREQ_MAX;

delay2 = delay2 + freqcut * delay1; /* delay2/4 = lowpass output */
highpass = in[sample] - delay2 - qres * delay1;
delay1 = freqcut * highpass + delay1; /* delay1/3 = bandpass output */

delay4 = delay4 + freqcut2 * delay3;
highpass = delay2 - delay4 - qres * delay3;
delay3 = freqcut2 * highpass + delay3;

/* mix filter output into output buffer */
out[sample] += 0.1*atan(3*delay4 * amp[sample]);
}

voice->delay1 = delay1;
voice->delay2 = delay2;
voice->delay3 = delay3;
voice->delay4 = delay4;
voice->c5 = 0.0f;
}


/*
* nekobee_voice_render
*
* generate the actual sound data for this voice
*/
void
nekobee_voice_render(nekobee_synth_t *synth, nekobee_voice_t *voice,
float *out, unsigned long sample_count,
int do_control_update)
{
unsigned long sample;

/* state variables saved in voice */
float lfo_pos = voice->lfo_pos,
vca_eg = voice->vca_eg,
vcf_eg = voice->vcf_eg;
unsigned char vca_eg_phase = voice->vca_eg_phase,
vcf_eg_phase = voice->vcf_eg_phase;
int osc_index = voice->osc_index;

/* temporary variables used in calculating voice */
float fund_pitch;
float deltat = synth->deltat;
float freq, cutoff, vcf_amt;
float vcf_acc_amt;

/* set up synthesis variables from patch */
float omega;
float vca_eg_amp = qdB_to_amplitude(velocity_to_attenuation[voice->velocity] * 0);

float vca_eg_rate_level[3], vca_eg_one_rate[3];
float vcf_eg_amp = qdB_to_amplitude(velocity_to_attenuation[voice->velocity] * 0);

float vcf_eg_rate_level[3], vcf_eg_one_rate[3];
float qres = synth->resonance;
float vol_out = volume(synth->volume);

float velocity = (voice->velocity);

float vcf_egdecay = synth->decay;

fund_pitch = 0.1f*voice->target_pitch +0.9 * voice->prev_pitch; /* glide */

if (do_control_update) {
voice->prev_pitch = fund_pitch; /* save pitch for next time */
}

fund_pitch *= 440.0f;

omega = synth->tuning * fund_pitch;

// if we have triggered ACCENT
// we need a shorter decay
// we should probably have something like this in the note on code
// that could trigger an ACCENT light
if (velocity>90) {
vcf_egdecay=.0005;
}

// VCA - In a real 303, it is set for around 2 seconds
vca_eg_rate_level[0] = 0.1f * vca_eg_amp; // instant on attack
vca_eg_one_rate[0] = 0.9f; // very fast
vca_eg_rate_level[1] = 0.0f; // sustain is zero
vca_eg_one_rate[1] = 1.0f - 0.00001f; // decay time is very slow
vca_eg_rate_level[2] = 0.0f; // decays to zero
vca_eg_one_rate[2] = 0.975f; // very fast release

// VCF - funny things go on with the accent

vcf_eg_rate_level[0] = 0.1f * vcf_eg_amp;
vcf_eg_one_rate[0] = 1-0.1f; //0.9f;
vcf_eg_rate_level[1] = 0.0f; // vcf_egdecay * *(synth->vcf_eg_sustain_level) * vcf_eg_amp;
vcf_eg_one_rate[1] = 1.0f - vcf_egdecay;
vcf_eg_rate_level[2] = 0.0f;
vcf_eg_one_rate[2] = 0.9995f; // 1.0f - *(synth->vcf_eg_release_time);

vca_eg_amp *= 0.99f;
vcf_eg_amp *= 0.99f;

freq = M_PI_F * deltat * fund_pitch * synth->mod_wheel; /* now (0 to 1) * pi */

cutoff = 0.008f * synth->cutoff;

// 303 always has slight VCF mod
vcf_amt = 0.05f+(synth->envmod*0.75);

/* copy some things so oscillator functions can see them */
voice->osc1.waveform = lrintf(synth->waveform);

// work out how much the accent will affect the filter
vcf_acc_amt=.333f+ (synth->resonance/1.5f);

for (sample = 0; sample < sample_count; sample++) {
vca_eg = vca_eg_rate_level[vca_eg_phase] + vca_eg_one_rate[vca_eg_phase] * vca_eg;
vcf_eg = vcf_eg_rate_level[vcf_eg_phase] + vcf_eg_one_rate[vcf_eg_phase] * vcf_eg;

voice->freqcut_buf[sample] = (cutoff + (vcf_amt * vcf_eg/2.0f) + (synth->vcf_accent * synth->accent*0.5f));

voice->vca_buf[sample] = vca_eg * vol_out*(1.0f + synth->accent*synth->vca_accent);

if (!vca_eg_phase && vca_eg > vca_eg_amp) vca_eg_phase = 1; /* flip from attack to decay */
if (!vcf_eg_phase && vcf_eg > vcf_eg_amp) vcf_eg_phase = 1; /* flip from attack to decay */
}

// oscillator
vco(sample_count, voice, &voice->osc1, osc_index, deltat * omega);

// VCF and VCA
vcf_4pole(voice, sample_count, voice->osc_audio + osc_index, out, voice->freqcut_buf, qres, voice->vca_buf);

osc_index += sample_count;

if (do_control_update) {
/* do those things should be done only once per control-calculation
* interval ("nugget"), such as voice check-for-dead, pitch envelope
* calculations, volume envelope phase transition checks, etc. */
/* check if we've decayed to nothing, turn off voice if so */
if (vca_eg_phase == 2 && voice->vca_buf[sample_count - 1] < 6.26e-6f) {
// sound has completed its release phase (>96dB below volume '5' max)
XDB_MESSAGE(XDB_NOTE, " nekobee_voice_render check for dead: killing note id %d\n", voice->note_id);
nekobee_voice_off(voice);
return; // we're dead now, so return
}

/* already saved prev_pitch above */

/* check oscillator audio buffer index, shift buffer if necessary */
if (osc_index > MINBLEP_BUFFER_LENGTH - (XSYNTH_NUGGET_SIZE + LONGEST_DD_PULSE_LENGTH)) {
memcpy(voice->osc_audio, voice->osc_audio + osc_index,
LONGEST_DD_PULSE_LENGTH * sizeof (float));
memset(voice->osc_audio + LONGEST_DD_PULSE_LENGTH, 0,
(MINBLEP_BUFFER_LENGTH - LONGEST_DD_PULSE_LENGTH) * sizeof (float));
osc_index = 0;
}
}

/* save things for next time around */
voice->lfo_pos = lfo_pos;
voice->vca_eg = vca_eg;
voice->vca_eg_phase = vca_eg_phase;
voice->vcf_eg = vcf_eg;
voice->vcf_eg_phase = vcf_eg_phase;
voice->osc_index = osc_index;

return;
(void)freq;
(void)vcf_acc_amt;
}

+ 0
- 5651
source/modules/native-plugins/pingpongpan/DistrhoArtworkPingPongPan.cpp
File diff suppressed because it is too large
View File


+ 0
- 35
source/modules/native-plugins/pingpongpan/DistrhoArtworkPingPongPan.hpp View File

@@ -1,35 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORKPINGPONGPAN_HPP
#define BINARY_DISTRHOARTWORKPINGPONGPAN_HPP

namespace DistrhoArtworkPingPongPan
{
extern const char* aboutData;
const unsigned int aboutDataSize = 172710;
const unsigned int aboutWidth = 303;
const unsigned int aboutHeight = 190;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 7600;
const unsigned int aboutButtonHoverWidth = 95;
const unsigned int aboutButtonHoverHeight = 20;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 7600;
const unsigned int aboutButtonNormalWidth = 95;
const unsigned int aboutButtonNormalHeight = 20;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 157080;
const unsigned int backgroundWidth = 308;
const unsigned int backgroundHeight = 170;

extern const char* knobData;
const unsigned int knobDataSize = 17956;
const unsigned int knobWidth = 67;
const unsigned int knobHeight = 67;
}

#endif // BINARY_DISTRHOARTWORKPINGPONGPAN_HPP


+ 0
- 35
source/modules/native-plugins/pingpongpan/DistrhoPluginInfo.h View File

@@ -1,35 +0,0 @@
/*
* DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "Ping Pong Pan"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/PingPongPan"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 161
source/modules/native-plugins/pingpongpan/DistrhoPluginPingPongPan.cpp View File

@@ -1,161 +0,0 @@
/*
* DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#include "DistrhoPluginPingPongPan.hpp"
#include <cmath>
static const float k2PI = 6.283185307f;
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPluginPingPongPan::DistrhoPluginPingPongPan()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
// -----------------------------------------------------------------------
// Init
void DistrhoPluginPingPongPan::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramFreq:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Frequency";
parameter.symbol = "freq";
parameter.ranges.def = 50.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
case paramWidth:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Width";
parameter.symbol = "with";
parameter.unit = "%";
parameter.ranges.def = 75.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
break;
}
}
void DistrhoPluginPingPongPan::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPluginPingPongPan::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramFreq:
return fFreq;
case paramWidth:
return fWidth;
default:
return 0.0f;
}
}
void DistrhoPluginPingPongPan::d_setParameterValue(uint32_t index, float value)
{
if (d_getSampleRate() <= 0.0)
return;
switch (index)
{
case paramFreq:
fFreq = value;
waveSpeed = (k2PI * fFreq / 100.0f)/(float)d_getSampleRate();
break;
case paramWidth:
fWidth = value;
break;
}
}
void DistrhoPluginPingPongPan::d_setProgram(uint32_t index)
{
if (index != 0)
return;
// Default values
fFreq = 50.0f;
fWidth = 75.0f;
// reset filter values
d_activate();
}
// -----------------------------------------------------------------------
// Process
void DistrhoPluginPingPongPan::d_activate()
{
waveSpeed = (k2PI * fFreq / 100.0f)/(float)d_getSampleRate();
}
void DistrhoPluginPingPongPan::d_deactivate()
{
wavePos = 0.0f;
}
void DistrhoPluginPingPongPan::d_run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in1 = inputs[0];
const float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
for (uint32_t i=0; i < frames; ++i)
{
pan = std::fmin(std::fmax(std::sin(wavePos) * (fWidth/100.0f), -1.0f), 1.0f);
if ((wavePos += waveSpeed) >= k2PI)
wavePos -= k2PI;
out1[i] = in1[i] * (pan > 0.0f ? 1.0f-pan : 1.0f);
out2[i] = in2[i] * (pan < 0.0f ? 1.0f+pan : 1.0f);
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPluginPingPongPan();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 104
source/modules/native-plugins/pingpongpan/DistrhoPluginPingPongPan.hpp View File

@@ -1,104 +0,0 @@
/*
* DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#ifndef DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED
#define DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPluginPingPongPan : public Plugin
{
public:
enum Parameters
{
paramFreq = 0,
paramWidth,
paramCount
};
DistrhoPluginPingPongPan();
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "PingPongPan";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
const char* d_getLicense() const noexcept override
{
return "LGPL";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('D', 'P', 'P', 'P');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
float fFreq;
float fWidth;
float waveSpeed;
float pan, wavePos;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginPingPongPan)
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED

+ 0
- 130
source/modules/native-plugins/pingpongpan/DistrhoUIPingPongPan.cpp View File

@@ -1,130 +0,0 @@
/*
* DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#include "DistrhoPluginPingPongPan.hpp"
#include "DistrhoUIPingPongPan.hpp"

START_NAMESPACE_DISTRHO

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

DistrhoUIPingPongPan::DistrhoUIPingPongPan()
: UI(),
fAboutWindow(this)
{
// background
fImgBackground = Image(DistrhoArtworkPingPongPan::backgroundData, DistrhoArtworkPingPongPan::backgroundWidth, DistrhoArtworkPingPongPan::backgroundHeight, GL_BGR);

Image imageAbout(DistrhoArtworkPingPongPan::aboutData, DistrhoArtworkPingPongPan::aboutWidth, DistrhoArtworkPingPongPan::aboutHeight, GL_BGR);
fAboutWindow.setImage(imageAbout);

// knobs
Image knobImage(DistrhoArtworkPingPongPan::knobData, DistrhoArtworkPingPongPan::knobWidth, DistrhoArtworkPingPongPan::knobHeight);

// knob Low-Mid
fKnobFreq = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginPingPongPan::paramFreq);
fKnobFreq->setAbsolutePos(60, 58);
fKnobFreq->setRange(0.0f, 100.0f);
fKnobFreq->setDefault(50.0f);
fKnobFreq->setRotationAngle(270);
fKnobFreq->setCallback(this);

// knob Mid-High
fKnobWidth = new ImageKnob(this, knobImage, ImageKnob::Vertical, DistrhoPluginPingPongPan::paramWidth);
fKnobWidth->setAbsolutePos(182, 58);
fKnobWidth->setRange(0.0f, 100.0f);
fKnobWidth->setDefault(75.0f);
fKnobWidth->setRotationAngle(270);
fKnobWidth->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtworkPingPongPan::aboutButtonNormalData, DistrhoArtworkPingPongPan::aboutButtonNormalWidth, DistrhoArtworkPingPongPan::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtworkPingPongPan::aboutButtonHoverData, DistrhoArtworkPingPongPan::aboutButtonHoverWidth, DistrhoArtworkPingPongPan::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(183, 8);
fButtonAbout->setCallback(this);

// set default values
d_programChanged(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUIPingPongPan::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case DistrhoPluginPingPongPan::paramFreq:
fKnobFreq->setValue(value);
break;
case DistrhoPluginPingPongPan::paramWidth:
fKnobWidth->setValue(value);
break;
}
}

void DistrhoUIPingPongPan::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
fKnobFreq->setValue(50.0f);
fKnobWidth->setValue(75.0f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUIPingPongPan::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void DistrhoUIPingPongPan::imageKnobDragStarted(ImageKnob* knob)
{
d_editParameter(knob->getId(), true);
}

void DistrhoUIPingPongPan::imageKnobDragFinished(ImageKnob* knob)
{
d_editParameter(knob->getId(), false);
}

void DistrhoUIPingPongPan::imageKnobValueChanged(ImageKnob* knob, float value)
{
d_setParameterValue(knob->getId(), value);
}

void DistrhoUIPingPongPan::onDisplay()
{
fImgBackground.draw();
}

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

UI* createUI()
{
return new DistrhoUIPingPongPan();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 88
source/modules/native-plugins/pingpongpan/DistrhoUIPingPongPan.hpp View File

@@ -1,88 +0,0 @@
/*
* DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED
#define DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"

#include "DistrhoArtworkPingPongPan.hpp"

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;

START_NAMESPACE_DISTRHO

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

class DistrhoUIPingPongPan : public UI,
public ImageButton::Callback,
public ImageKnob::Callback
{
public:
DistrhoUIPingPongPan();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return DistrhoArtworkPingPongPan::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return DistrhoArtworkPingPongPan::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ScopedPointer<ImageButton> fButtonAbout;
ScopedPointer<ImageKnob> fKnobFreq, fKnobWidth;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIPingPongPan)
};

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

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED

BIN
source/modules/native-plugins/pingpongpan/artwork/about.png View File

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

BIN
source/modules/native-plugins/pingpongpan/artwork/aboutButtonHover.png View File

Before After
Width: 95  |  Height: 20  |  Size: 6.5KB

BIN
source/modules/native-plugins/pingpongpan/artwork/aboutButtonNormal.png View File

Before After
Width: 95  |  Height: 20  |  Size: 6.3KB

BIN
source/modules/native-plugins/pingpongpan/artwork/background.png View File

Before After
Width: 308  |  Height: 170  |  Size: 68KB

BIN
source/modules/native-plugins/pingpongpan/artwork/knob.png View File

Before After
Width: 67  |  Height: 67  |  Size: 3.4KB

+ 0
- 39
source/modules/native-plugins/powerjuice/DistrhoPluginInfo.h View File

@@ -1,39 +0,0 @@
/*
* Power Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "PowerJuice"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 1
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

// needed for spectrum
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1

#define DISTRHO_PLUGIN_URI "urn:distrho:PowerJuice"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 12222
source/modules/native-plugins/powerjuice/PowerJuiceArtwork.cpp
File diff suppressed because it is too large
View File


+ 0
- 35
source/modules/native-plugins/powerjuice/PowerJuiceArtwork.hpp View File

@@ -1,35 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_POWERJUICEARTWORK_HPP
#define BINARY_POWERJUICEARTWORK_HPP

namespace PowerJuiceArtwork
{
extern const char* aboutData;
const unsigned int aboutDataSize = 180000;
const unsigned int aboutWidth = 300;
const unsigned int aboutHeight = 200;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 5888;
const unsigned int aboutButtonHoverWidth = 92;
const unsigned int aboutButtonHoverHeight = 16;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 5888;
const unsigned int aboutButtonNormalWidth = 92;
const unsigned int aboutButtonNormalHeight = 16;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 571956;
const unsigned int backgroundWidth = 619;
const unsigned int backgroundHeight = 308;

extern const char* knobData;
const unsigned int knobDataSize = 10404;
const unsigned int knobWidth = 51;
const unsigned int knobHeight = 51;
}

#endif // BINARY_POWERJUICEARTWORK_HPP


+ 0
- 379
source/modules/native-plugins/powerjuice/PowerJuicePlugin.cpp View File

@@ -1,379 +0,0 @@
/*
* Power Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/
#include "PowerJuicePlugin.hpp"
//#include <cstring>
#include <cstdlib>
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
PowerJuicePlugin::PowerJuicePlugin()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
PowerJuicePlugin::~PowerJuicePlugin()
{
free(lookaheadStack.data);
free(RMSStack.data);
}
// -----------------------------------------------------------------------
// Init
void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramAttack:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Attack";
parameter.symbol = "att";
parameter.unit = "ms";
parameter.ranges.def = 20.0f;
parameter.ranges.min = 0.1f;
parameter.ranges.max = 1000.0f;
break;
case paramRelease:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Release";
parameter.symbol = "rel";
parameter.unit = "ms";
parameter.ranges.def = 200.0f;
parameter.ranges.min = 0.1f;
parameter.ranges.max = 1000.0f;
break;
case paramThreshold:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Threshold";
parameter.symbol = "thr";
parameter.unit = "dB";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -60.0f;
parameter.ranges.max = 0.0f;
break;
case paramRatio:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Ratio";
parameter.symbol = "rat";
parameter.unit = "";
parameter.ranges.def = 1.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 10.0f;
break;
case paramMakeup:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Make-Up";
parameter.symbol = "mak";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 20.0f;
break;
case paramMix:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Mix";
parameter.symbol = "Mix";
parameter.unit = "";
parameter.ranges.def = 1.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
}
}
void PowerJuicePlugin::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float PowerJuicePlugin::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramAttack:
return attack;
case paramRelease:
return release;
case paramThreshold:
return threshold;
case paramRatio:
return ratio;
case paramMakeup:
return makeup;
case paramMix:
return mix;
default:
return 0.0f;
}
}
void PowerJuicePlugin::d_setParameterValue(uint32_t index, float value)
{
switch (index)
{
case paramAttack:
attack = value;
attackSamples = d_getSampleRate()*(attack/1000.0f);
break;
case paramRelease:
release = value;
releaseSamples = d_getSampleRate()*(release/1000.0f);
break;
case paramThreshold:
threshold = value;
break;
case paramRatio:
ratio = value;
break;
case paramMakeup:
makeup = value;
makeupFloat = fromDB(makeup);
break;
case paramMix:
mix = value;
break;
}
}
void PowerJuicePlugin::d_setProgram(uint32_t index)
{
if (index != 0)
return;
/* Default parameter values */
attack = 20.0f;
release = 200.0f;
threshold = 0.0f;
ratio = 1.0f;
makeup = 0.0f;
mix = 1.0f;
makeupFloat = fromDB(makeup);
attackSamples = d_getSampleRate()*(attack/1000.0f);
releaseSamples = d_getSampleRate()*(release/1000.0f);
w = 563; //waveform plane size, size of the plane in pixels;
w2 = 1126; //wavefowm array
h = 121; //waveform plane height
x = 27; //waveform plane positions
y = 53;
dc = 113; //0DC line y position
/* Default variable values */
averageCounter = 0;
inputMax = 0.0f;
balancer = 1.0f;
GR = 1.0f;
newRepaint = false;
input.start = 0;
rms.start = 0;
gainReduction.start = 0;
RMSStack.start = 0;
lookaheadStack.start = 0;
repaintSkip = 0;
kFloatRMSStackCount = 400.0f/44100.0f*d_getSampleRate();
RMSStack.data = (float*) calloc(kFloatRMSStackCount, sizeof(float));
kFloatLookaheadStackCount = 800.0f/44100.0f*d_getSampleRate();
lookaheadStack.data = (float*) calloc(kFloatLookaheadStackCount, sizeof(float));
refreshSkip= 300.0f/44100.0f*d_getSampleRate();
std::memset(rms.data, 0, sizeof(float)*kFloatStackCount);
std::memset(gainReduction.data, 0, sizeof(float)*kFloatStackCount);
std::memset(RMSStack.data, 0, sizeof(float)*kFloatRMSStackCount);
std::memset(lookaheadStack.data, 0, sizeof(float)*kFloatLookaheadStackCount);
for (int j=0; j < kFloatStackCount; ++j)
history.rms[j] = h +y;
for (int j=0; j < kFloatStackCount; ++j)
history.gainReduction[j] = h +y;
d_activate();
}
float PowerJuicePlugin::getRMSHistory(int n) {
return history.rms[n];
}
bool PowerJuicePlugin::repaintNeeded() {
return newRepaint;
}
float PowerJuicePlugin::getGainReductionHistory(int n) {
if (n == kFloatStackCount-1) {
newRepaint = false;
//printf("falsing!\n");
}
return history.gainReduction[n];
}
// -----------------------------------------------------------------------
// Process
void PowerJuicePlugin::d_activate()
{
}
void PowerJuicePlugin::d_deactivate()
{
// all values to zero
}
void PowerJuicePlugin::d_run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in = inputs[0];
float* out = outputs[0];
float sum;
float data;
float difference;
for (uint32_t i=0; i < frames; i++) {
sum = 0.0f;
data = 0.0f;
difference = 0;
//sanitizeDenormal(in[i]); // FIXME - you cannot modify inputs
/* compute last RMS */
//store audio samples in an RMS buffer line
RMSStack.data[RMSStack.start++] = in[i];
if (RMSStack.start == kFloatRMSStackCount)
RMSStack.start = 0;
//compute RMS over last kFloatRMSStackCount samples
for (int j=0; j < kFloatRMSStackCount; ++j) {
data = RMSStack.data[(RMSStack.start+j) % kFloatRMSStackCount];
sum += data * data;
}
//root mean SQUARE
float RMS = sqrt(sum / kFloatRMSStackCount);
sanitizeDenormal(RMS);
/* compute gain reduction if needed */
float RMSDB = toDB(RMS);
if (RMSDB>threshold) {
//attack stage
float difference = (RMSDB-threshold);
//sanitizeDenormal(difference);
targetGR = difference - difference/ratio;
if (targetGR>difference/(ratio/4.0f)) {
targetGR = difference - difference/(ratio*1.5f);
//more power!
}
//
if (GR<targetGR) {
//approach targetGR at attackSamples rate
GR -= (GR-targetGR)/(attackSamples);
} else {
//approach targetGR at releaseSamples rate
GR -= (GR-targetGR)/releaseSamples;
}
sanitizeDenormal(GR);
} else {
//release stage
//approach targetGR at releaseSamples rate, targetGR = 0.0f
GR -= GR/releaseSamples;
}
//store audio in lookahead buffer
lookaheadStack.data[lookaheadStack.start++] = in[i];
//printf("rms\n");
if (lookaheadStack.start == kFloatLookaheadStackCount)
lookaheadStack.start = 0;
if (++averageCounter >= refreshSkip) {
//add relevant values to the shared memory
rms.data[rms.start++] = RMSDB;
gainReduction.data[gainReduction.start++] = GR;
//rewind stack reading heads if needed
if (rms.start == kFloatStackCount)
rms.start = 0;
if (gainReduction.start == kFloatStackCount)
gainReduction.start = 0;
//saving in gfx format, for speed
//share memory
for (int j=0; j < kFloatStackCount; ++j)
history.rms[j] = -toIEC(rms.data[(rms.start+j) % kFloatStackCount])/200*h +h +y;
for (int j=0; j < kFloatStackCount; ++j) {
history.gainReduction[j] = -toIEC(-gainReduction.data[(gainReduction.start+j) % kFloatStackCount])/200*h +h +y;
}
repaintSkip++;
if (repaintSkip>5) {
repaintSkip = 0;
newRepaint = true;
}
averageCounter = 0;
inputMax = 0.0f;
}
/* compress, mix, done. */
float compressedSignal = in[i]*fromDB(-GR);
out[i] = (compressedSignal*makeupFloat*mix)+in[i]*(1-mix);
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new PowerJuicePlugin();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 212
source/modules/native-plugins/powerjuice/PowerJuicePlugin.hpp View File

@@ -1,212 +0,0 @@
/*
* Power Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/
#ifndef POWERJUICEPLUGIN_HPP_INCLUDED
#define POWERJUICEPLUGIN_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
#include <cmath>
static const int kFloatStackCount = 563;
struct FloatStack { //history for GUI!
int32_t start;
float data[kFloatStackCount];
};
struct FloatRMSStack { //rms, sr-dependent
int32_t start;
float* data;
};
struct LookaheadStack { //lookahead buffer, sr-dependent
int32_t start;
float* data;
};
struct SharedMemData { //history for the GUI !
float rms[kFloatStackCount];
float gainReduction[kFloatStackCount];
};
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class PowerJuicePlugin : public Plugin
{
public:
enum Parameters
{
paramAttack = 0,
paramRelease,
paramThreshold,
paramRatio,
paramMakeup,
paramMix,
paramCount
};
PowerJuicePlugin();
~PowerJuicePlugin() override;
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "PowerJuice";
}
const char* d_getMaker() const noexcept override
{
return "Andre Sklenar";
}
const char* d_getLicense() const noexcept override
{
return "GPL v2+";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('P', 'w', 'r', 'J');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
// params
float attack, release, threshold, ratio, makeup, mix;
float attackSamples, releaseSamples, makeupFloat;
float balancer;
float targetGR;
float GR;
SharedMemData history;
float sum;
float data;
float difference;
int w; //waveform plane size, size of the plane in pixels;
int w2; //wavefowm array
int h; //waveform plane height
int x; //waveform plane positions
int y;
int dc; //0DC line y position
int kFloatRMSStackCount;
int kFloatLookaheadStackCount;
float refreshSkip;
int averageCounter;
float inputMax;
FloatStack input, rms, gainReduction;
struct FloatRMSStack RMSStack;
struct LookaheadStack lookaheadStack;
bool newRepaint;
int repaintSkip;
float fromDB(float gdb) {
return (std::exp(gdb/20.f*std::log(10.f)));
};
float toDB(float g) {
return (20.f*std::log10(g));
}
float toIEC(float db) {
float def = 0.0f; /* Meter deflection %age */
if (db < -70.0f) {
def = 0.0f;
} else if (db < -60.0f) {
def = (db + 70.0f) * 0.25f;
} else if (db < -50.0f) {
def = (db + 60.0f) * 0.5f + 5.0f;
} else if (db < -40.0f) {
def = (db + 50.0f) * 0.75f + 7.5;
} else if (db < -30.0f) {
def = (db + 40.0f) * 1.5f + 15.0f;
} else if (db < -20.0f) {
def = (db + 30.0f) * 2.0f + 30.0f;
} else if (db < 0.0f) {
def = (db + 20.0f) * 2.5f + 50.0f;
} else {
def = 100.0f;
}
return (def * 2.0f);
}
bool isNan(float& value ) {
if (((*(uint32_t *) &value) & 0x7fffffff) > 0x7f800000) {
return true;
}
return false;
}
void sanitizeDenormal(float& value) {
if (isNan(value)) {
//std::printf("Booo!\n");
value = 0.f;
}
}
public:
//methods
float getRMSHistory(int n);
float getGainReductionHistory(int n);
bool repaintNeeded();
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // POWERJUICE_HPP_INCLUDED

+ 0
- 307
source/modules/native-plugins/powerjuice/PowerJuiceUI.cpp View File

@@ -1,307 +0,0 @@
/*
* Power Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#include "PowerJuiceUI.hpp"

#include <cstdlib>
#include <ctime>

using DGL::Point;

START_NAMESPACE_DISTRHO

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

PowerJuiceUI::PowerJuiceUI()
: UI(),
fAboutWindow(this),
dsp((PowerJuicePlugin*)d_getPluginInstancePointer())
{
DISTRHO_SAFE_ASSERT(dsp != nullptr);

// background
fImgBackground = Image(PowerJuiceArtwork::backgroundData, PowerJuiceArtwork::backgroundWidth, PowerJuiceArtwork::backgroundHeight, GL_BGR);

// about
Image imageAbout(PowerJuiceArtwork::aboutData, PowerJuiceArtwork::aboutWidth, PowerJuiceArtwork::aboutHeight, GL_BGR);
fAboutWindow.setImage(imageAbout);

// knobs
Image knobImage(PowerJuiceArtwork::knobData, PowerJuiceArtwork::knobWidth, PowerJuiceArtwork::knobHeight);

// knob Attack
fKnobAttack = new ImageKnob(this, knobImage);
fKnobAttack->setAbsolutePos(37, 213);
fKnobAttack->setRange(0.1f, 1000.0f);
fKnobAttack->setStep(0.1f);
fKnobAttack->setValue(20.0f);
fKnobAttack->setRotationAngle(270);
fKnobAttack->setCallback(this);

// knob Release
fKnobRelease = new ImageKnob(this, knobImage);
fKnobRelease->setAbsolutePos(136, 213);
fKnobRelease->setRange(0.1f, 1000.0f);
fKnobRelease->setValue(0.1f);
fKnobRelease->setRotationAngle(270);
fKnobRelease->setCallback(this);

// knob Threshold
fKnobThreshold = new ImageKnob(this, knobImage);
fKnobThreshold->setAbsolutePos(235, 213);
fKnobThreshold->setRange(-60.0f, 0.0f);
fKnobThreshold->setValue(0.0f);
fKnobThreshold->setRotationAngle(270);
fKnobThreshold->setCallback(this);

// knob Ratio
fKnobRatio = new ImageKnob(this, knobImage);
fKnobRatio->setAbsolutePos(334, 213);
fKnobRatio->setRange(1.0f, 10.0f);
fKnobRatio->setValue(1.0f);
fKnobRatio->setRotationAngle(270);
fKnobRatio->setCallback(this);

// knob Make-Up
fKnobMakeup = new ImageKnob(this, knobImage);
fKnobMakeup->setAbsolutePos(433, 213);
fKnobMakeup->setRange(0.0f, 20.0f);
fKnobMakeup->setValue(0.0f);
fKnobMakeup->setRotationAngle(270);
fKnobMakeup->setCallback(this);

// knob Mix
fKnobMix = new ImageKnob(this, knobImage);
fKnobMix->setAbsolutePos(532, 213);
fKnobMix->setRange(0.0f, 1.0f);
fKnobMix->setValue(1.0f);
fKnobMix->setRotationAngle(270);
fKnobMix->setCallback(this);

// about button
Image aboutImageNormal(PowerJuiceArtwork::aboutButtonNormalData, PowerJuiceArtwork::aboutButtonNormalWidth, PowerJuiceArtwork::aboutButtonNormalHeight);
Image aboutImageHover(PowerJuiceArtwork::aboutButtonHoverData, PowerJuiceArtwork::aboutButtonHoverWidth, PowerJuiceArtwork::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(502, 17);
fButtonAbout->setCallback(this);

// set default values
d_programChanged(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void PowerJuiceUI::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case PowerJuicePlugin::paramAttack:
fKnobAttack->setValue(value);
break;
case PowerJuicePlugin::paramRelease:
fKnobRelease->setValue(value);
break;
case PowerJuicePlugin::paramThreshold:
fKnobThreshold->setValue(value);
break;
case PowerJuicePlugin::paramRatio:
fKnobRatio->setValue(value);
break;
case PowerJuicePlugin::paramMakeup:
fKnobMakeup->setValue(value);
break;
case PowerJuicePlugin::paramMix:
fKnobMix->setValue(value);
break;
}
}

void PowerJuiceUI::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
fKnobAttack->setValue(20.0f);
fKnobRelease->setValue(200.0f);
fKnobThreshold->setValue(0.0f);
fKnobRatio->setValue(1.0f);
fKnobMakeup->setValue(0.0f);
fKnobMix->setValue(1.0f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void PowerJuiceUI::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void PowerJuiceUI::imageKnobDragStarted(ImageKnob* knob)
{
if (knob == fKnobAttack)
d_editParameter(PowerJuicePlugin::paramAttack, true);
else if (knob == fKnobRelease)
d_editParameter(PowerJuicePlugin::paramRelease, true);
else if (knob == fKnobThreshold)
d_editParameter(PowerJuicePlugin::paramThreshold, true);
else if (knob == fKnobRatio)
d_editParameter(PowerJuicePlugin::paramRatio, true);
else if (knob == fKnobMakeup)
d_editParameter(PowerJuicePlugin::paramMakeup, true);
else if (knob == fKnobMix)
d_editParameter(PowerJuicePlugin::paramMix, true);
}

void PowerJuiceUI::imageKnobDragFinished(ImageKnob* knob)
{
if (knob == fKnobAttack)
d_editParameter(PowerJuicePlugin::paramAttack, false);
else if (knob == fKnobRelease)
d_editParameter(PowerJuicePlugin::paramRelease, false);
else if (knob == fKnobThreshold)
d_editParameter(PowerJuicePlugin::paramThreshold, false);
else if (knob == fKnobRatio)
d_editParameter(PowerJuicePlugin::paramRatio, false);
else if (knob == fKnobMakeup)
d_editParameter(PowerJuicePlugin::paramMakeup, false);
else if (knob == fKnobMix)
d_editParameter(PowerJuicePlugin::paramMix, false);
}

void PowerJuiceUI::imageKnobValueChanged(ImageKnob* knob, float value)
{
if (knob == fKnobAttack)
d_setParameterValue(PowerJuicePlugin::paramAttack, value);
else if (knob == fKnobRelease)
d_setParameterValue(PowerJuicePlugin::paramRelease, value);
else if (knob == fKnobThreshold)
d_setParameterValue(PowerJuicePlugin::paramThreshold, value);
else if (knob == fKnobRatio)
d_setParameterValue(PowerJuicePlugin::paramRatio, value);
else if (knob == fKnobMakeup)
d_setParameterValue(PowerJuicePlugin::paramMakeup, value);
else if (knob == fKnobMix)
d_setParameterValue(PowerJuicePlugin::paramMix, value);

}

void PowerJuiceUI::d_uiIdle()
{
if (dsp != nullptr && dsp->repaintNeeded())
repaint();
}

void PowerJuiceUI::onDisplay()
{
fImgBackground.draw();

if (dsp == nullptr)
return;

int w = 563; //waveform plane size, size of the plane in pixels;
int w2 = 1126; //wavefowm array
int h = 121; //waveform plane height
int x = 27; //waveform plane positions
int y = 53;
int dc = 113; //0DC line y position


glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);



float thresholdPosition = (-toIEC(fKnobThreshold->getValue()))/200*h+h+y;

//draw waveform
/*
glColor4f(0.0f, 1.0f, 0.0f, 0.4f);
glLineWidth(1.2f);
for (int i=0; i<w; i++) {

glBegin(GL_LINES);
glVertex2i(x+i, -toIEC(shmData->input[i])/200*h+h+y);
glVertex2i(x+i, y+h);
glEnd();
}
*/
//draw RMS

glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
glLineWidth(2.0f);
glBegin(GL_LINE_STRIP);
for (int i=2; i<w; i++) {
float value = dsp->getRMSHistory(i);
if (value<thresholdPosition) {
glColor4f(0.0f, 0.5f, 0.0f, 1.0f);
} else {
glColor4f(0.0f, 0.5f, 0.2f, 1.0f);
}
glVertex2i(x+i, value);
}
glEnd();
//draw gain reduction
glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
glLineWidth(3.0f);
glBegin(GL_LINES);
for (int i=2; i<w; i++) {
glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
float value = dsp->getGainReductionHistory(i);
glVertex2i(x+i, value);
glVertex2i(x+i, y);

value = dsp->getRMSHistory(i);
glColor4f(0.0f, 0.5f, 0.2f, 0.1f);
glVertex2i(x+i, value);
glVertex2i(x+i, y+h);
}
glEnd();

//draw Threshold
glLineWidth(2.0f);
glColor4f(0.4f, 0.4f, 1.0f, 0.8f);
//float thresholdPosition = ((60-fKnobThreshold->getValue())/60);
glBegin(GL_LINES);
glVertex2i(x, thresholdPosition);
glVertex2i(x+w, thresholdPosition);
glEnd();

// reset color
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}

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

UI* createUI()
{
return new PowerJuiceUI();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 130
source/modules/native-plugins/powerjuice/PowerJuiceUI.hpp View File

@@ -1,130 +0,0 @@
/*
* Power Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#ifndef POWERJUICEUI_HPP_INCLUDED
#define POWERJUICEUI_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"
#include "ImageSlider.hpp"

#include "PowerJuiceArtwork.hpp"
#include "PowerJuicePlugin.hpp"

#include <cmath>

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;

START_NAMESPACE_DISTRHO

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

class PowerJuiceUI : public UI,
public ImageButton::Callback,
public ImageKnob::Callback
{
public:
PowerJuiceUI();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return PowerJuiceArtwork::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return PowerJuiceArtwork::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// UI Callbacks

void d_uiIdle() override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;
void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ScopedPointer<ImageKnob> fKnobAttack, fKnobRelease, fKnobThreshold;
ScopedPointer<ImageKnob> fKnobRatio, fKnobMakeup, fKnobMix;
ScopedPointer<ImageButton> fButtonAbout;

PowerJuicePlugin* const dsp;

float fromDB(float gdb) {
return (std::exp(gdb/20.f*std::log(10.f)));
};

float toDB(float g) {
return (20.f*std::log10(g));
}

float toIEC(float db) {
float def = 0.0f; /* Meter deflection %age */

if (db < -70.0f) {
def = 0.0f;
} else if (db < -60.0f) {
def = (db + 70.0f) * 0.25f;
} else if (db < -50.0f) {
def = (db + 60.0f) * 0.5f + 5.0f;
} else if (db < -40.0f) {
def = (db + 50.0f) * 0.75f + 7.5;
} else if (db < -30.0f) {
def = (db + 40.0f) * 1.5f + 15.0f;
} else if (db < -20.0f) {
def = (db + 30.0f) * 2.0f + 30.0f;
} else if (db < 0.0f) {
def = (db + 20.0f) * 2.5f + 50.0f;
} else {
def = 100.0f;
}

return (def * 2.0f);
}
};

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

END_NAMESPACE_DISTRHO

#endif // POWERJUICEUI_HPP_INCLUDED

+ 0
- 38
source/modules/native-plugins/prom/DistrhoPluginInfo.h View File

@@ -1,38 +0,0 @@
/*
* DISTRHO ProM Plugin
* Copyright (C) 2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "ProM"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 1
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_IS_RT_SAFE 0
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/ProM"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 84
source/modules/native-plugins/prom/DistrhoPluginProM.cpp View File

@@ -1,84 +0,0 @@
/*
* DISTRHO ProM Plugin
* Copyright (C) 2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#include "DistrhoPluginProM.hpp"
#include "libprojectM/projectM.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPluginProM::DistrhoPluginProM()
: Plugin(0, 0, 0),
fPM(nullptr)
{
}
DistrhoPluginProM::~DistrhoPluginProM()
{
DISTRHO_SAFE_ASSERT(fPM == nullptr);
}
// -----------------------------------------------------------------------
// Init
void DistrhoPluginProM::d_initParameter(uint32_t, Parameter&)
{
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPluginProM::d_getParameterValue(uint32_t) const
{
return 0.0f;
}
void DistrhoPluginProM::d_setParameterValue(uint32_t, float)
{
}
// -----------------------------------------------------------------------
// Process
void DistrhoPluginProM::d_run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in = inputs[0];
float* out = outputs[0];
if (in != out)
std::memcpy(out, in, sizeof(float)*frames);
const MutexLocker csm(fMutex);
if (fPM == nullptr)
return;
if (PCM* const pcm = fPM->pcm())
pcm->addPCMfloat(in, frames);
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPluginProM();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 96
source/modules/native-plugins/prom/DistrhoPluginProM.hpp View File

@@ -1,96 +0,0 @@
/*
* DISTRHO ProM Plugin
* Copyright (C) 2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/
#ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED
#define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
#include "extra/d_mutex.hpp"
class projectM;
class DistrhoUIProM;
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPluginProM : public Plugin
{
public:
DistrhoPluginProM();
~DistrhoPluginProM() override;
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "ProM";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
const char* d_getLicense() const noexcept override
{
return "LGPL";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('D', 'P', 'r', 'M');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t, Parameter&) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t) const override;
void d_setParameterValue(uint32_t, float) override;
// -------------------------------------------------------------------
// Process
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
Mutex fMutex;
projectM* fPM;
friend class DistrhoUIProM;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginProM)
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED

+ 0
- 276
source/modules/native-plugins/prom/DistrhoUIProM.cpp View File

@@ -1,276 +0,0 @@
/*
* DISTRHO ProM Plugin
* Copyright (C) 2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#include "DistrhoPluginProM.hpp"
#include "DistrhoUIProM.hpp"

#include "libprojectM/projectM.hpp"

START_NAMESPACE_DISTRHO

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

static const projectM::Settings kSettings = {
/* meshX */ 32,
/* meshY */ 24,
/* fps */ 35,
/* textureSize */ 1024,
/* windowWidth */ 512,
/* windowHeight */ 512,
/* presetURL */ "/usr/share/projectM/presets",
/* titleFontURL */ "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
/* menuFontURL */ "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf",
/* smoothPresetDuration */ 5,
/* presetDuration */ 30,
/* beatSensitivity */ 10.0f,
/* aspectCorrection */ true,
/* easterEgg */ 1.0f,
/* shuffleEnabled */ true,
/* softCutRatingsEnabled */ false
};

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

DistrhoUIProM::DistrhoUIProM()
: UI()
{
}

DistrhoUIProM::~DistrhoUIProM()
{
if (DistrhoPluginProM* const dspPtr = (DistrhoPluginProM*)d_getPluginInstancePointer())
{
const MutexLocker csm(dspPtr->fMutex);
dspPtr->fPM = nullptr;
}
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUIProM::d_parameterChanged(uint32_t, float)
{
}

// -----------------------------------------------------------------------
// UI Callbacks

void DistrhoUIProM::d_uiIdle()
{
if (fPM == nullptr)
return;

repaint();

if (DistrhoPluginProM* const dspPtr = (DistrhoPluginProM*)d_getPluginInstancePointer())
{
if (dspPtr->fPM != nullptr)
return;

const MutexLocker csm(dspPtr->fMutex);
dspPtr->fPM = fPM;
}
}

void DistrhoUIProM::d_uiReshape(int width, int height)
{
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH);

glMatrixMode(GL_TEXTURE);
glLoadIdentity();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, 0.0f, 1.0f);
glViewport(0, 0, width, height);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glLineStipple(2, 0xAAAA);

if (fPM == nullptr)
fPM = new projectM(kSettings); // std::string("/usr/share/projectM/config.inp"));

fPM->projectM_resetGL(width, height);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUIProM::onDisplay()
{
if (fPM == nullptr)
return;

fPM->renderFrame();
}

bool DistrhoUIProM::onKeyboard(const KeyboardEvent& ev)
{
if (fPM == nullptr)
return false;

projectMKeycode pmKey = PROJECTM_K_NONE;
projectMModifier pmMod = PROJECTM_KMOD_LSHIFT;

if ((ev.key >= PROJECTM_K_0 && ev.key <= PROJECTM_K_9) ||
(ev.key >= PROJECTM_K_A && ev.key <= PROJECTM_K_Z) ||
(ev.key >= PROJECTM_K_a && ev.key <= PROJECTM_K_z))
{
pmKey = static_cast<projectMKeycode>(ev.key);
}
else
{
switch (ev.key)
{
case DGL::CHAR_BACKSPACE:
pmKey = PROJECTM_K_BACKSPACE;
break;
case DGL::CHAR_ESCAPE:
pmKey = PROJECTM_K_ESCAPE;
break;
case DGL::CHAR_DELETE:
pmKey = PROJECTM_K_DELETE;
break;
}
}

if (pmKey == PROJECTM_K_NONE)
return false;

if (ev.mod & DGL::MODIFIER_CTRL)
pmMod = PROJECTM_KMOD_LCTRL;

fPM->key_handler(ev.press ? PROJECTM_KEYUP : PROJECTM_KEYDOWN, pmKey, pmMod);

return true;
}

bool DistrhoUIProM::onSpecial(const SpecialEvent& ev)
{
if (fPM == nullptr)
return false;

projectMKeycode pmKey = PROJECTM_K_NONE;
projectMModifier pmMod = PROJECTM_KMOD_LSHIFT;

switch (ev.key)
{
case DGL::KEY_F1:
pmKey = PROJECTM_K_F1;
break;
case DGL::KEY_F2:
pmKey = PROJECTM_K_F2;
break;
case DGL::KEY_F3:
pmKey = PROJECTM_K_F3;
break;
case DGL::KEY_F4:
pmKey = PROJECTM_K_F4;
break;
case DGL::KEY_F5:
pmKey = PROJECTM_K_F5;
break;
case DGL::KEY_F6:
pmKey = PROJECTM_K_F6;
break;
case DGL::KEY_F7:
pmKey = PROJECTM_K_F7;
break;
case DGL::KEY_F8:
pmKey = PROJECTM_K_F8;
break;
case DGL::KEY_F9:
pmKey = PROJECTM_K_F9;
break;
case DGL::KEY_F10:
pmKey = PROJECTM_K_F10;
break;
case DGL::KEY_F11:
pmKey = PROJECTM_K_F11;
break;
case DGL::KEY_F12:
pmKey = PROJECTM_K_F12;
break;
case DGL::KEY_LEFT:
pmKey = PROJECTM_K_LEFT;
break;
case DGL::KEY_UP:
pmKey = PROJECTM_K_UP;
break;
case DGL::KEY_RIGHT:
pmKey = PROJECTM_K_RIGHT;
break;
case DGL::KEY_DOWN:
pmKey = PROJECTM_K_DOWN;
break;
case DGL::KEY_PAGE_UP:
pmKey = PROJECTM_K_PAGEUP;
break;
case DGL::KEY_PAGE_DOWN:
pmKey = PROJECTM_K_PAGEDOWN;
break;
case DGL::KEY_HOME:
pmKey = PROJECTM_K_HOME;
break;
case DGL::KEY_END:
pmKey = PROJECTM_K_END;
break;
case DGL::KEY_INSERT:
pmKey = PROJECTM_K_INSERT;
break;
case DGL::KEY_SHIFT:
pmKey = PROJECTM_K_LSHIFT;
break;
case DGL::KEY_CTRL:
pmKey = PROJECTM_K_LCTRL;
break;
case DGL::KEY_ALT:
case DGL::KEY_SUPER:
break;
}

if (pmKey == PROJECTM_K_NONE)
return false;

if (ev.mod & DGL::MODIFIER_CTRL)
pmMod = PROJECTM_KMOD_LCTRL;

fPM->key_handler(ev.press ? PROJECTM_KEYUP : PROJECTM_KEYDOWN, pmKey, pmMod);

return true;
}

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

UI* createUI()
{
return new DistrhoUIProM();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 76
source/modules/native-plugins/prom/DistrhoUIProM.hpp View File

@@ -1,76 +0,0 @@
/*
* DISTRHO ProM Plugin
* Copyright (C) 2014 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the LICENSE file.
*/

#ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED
#define DISTRHO_UI_3BANDEQ_HPP_INCLUDED

#include "DistrhoUI.hpp"

class projectM;

START_NAMESPACE_DISTRHO

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

class DistrhoUIProM : public UI
{
public:
DistrhoUIProM();
~DistrhoUIProM() override;

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return 512;
}

uint d_getHeight() const noexcept override
{
return 512;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t, float) override;

// -------------------------------------------------------------------
// UI Callbacks

void d_uiIdle() override;
void d_uiReshape(int width, int height) override;

// -------------------------------------------------------------------
// Widget Callbacks

void onDisplay() override;
bool onKeyboard(const KeyboardEvent&) override;
bool onSpecial(const SpecialEvent&) override;

private:
ScopedPointer<projectM> fPM;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIProM)
};

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

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED

+ 0
- 36
source/modules/native-plugins/segmentjuice/DistrhoPluginInfo.h View File

@@ -1,36 +0,0 @@
/*
* Segment Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "SegmentJuice"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 1

#define DISTRHO_PLUGIN_NUM_INPUTS 0
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_URI "urn:distrho:SegmentJuice"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 18008
source/modules/native-plugins/segmentjuice/SegmentJuiceArtwork.cpp
File diff suppressed because it is too large
View File


+ 0
- 40
source/modules/native-plugins/segmentjuice/SegmentJuiceArtwork.hpp View File

@@ -1,40 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_SEGMENTJUICEARTWORK_HPP
#define BINARY_SEGMENTJUICEARTWORK_HPP

namespace SegmentJuiceArtwork
{
extern const char* aboutData;
const unsigned int aboutDataSize = 180000;
const unsigned int aboutWidth = 300;
const unsigned int aboutHeight = 200;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 5888;
const unsigned int aboutButtonHoverWidth = 92;
const unsigned int aboutButtonHoverHeight = 16;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 5888;
const unsigned int aboutButtonNormalWidth = 92;
const unsigned int aboutButtonNormalHeight = 16;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 933432;
const unsigned int backgroundWidth = 712;
const unsigned int backgroundHeight = 437;

extern const char* knobData;
const unsigned int knobDataSize = 4900;
const unsigned int knobWidth = 35;
const unsigned int knobHeight = 35;

extern const char* knob2Data;
const unsigned int knob2DataSize = 9216;
const unsigned int knob2Width = 48;
const unsigned int knob2Height = 48;
}

#endif // BINARY_SEGMENTJUICEARTWORK_HPP


+ 0
- 688
source/modules/native-plugins/segmentjuice/SegmentJuicePlugin.cpp View File

@@ -1,688 +0,0 @@
/*
* Segment Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/
#include "SegmentJuicePlugin.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
SegmentJuicePlugin::SegmentJuicePlugin()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
SegmentJuicePlugin::~SegmentJuicePlugin()
{
}
// -----------------------------------------------------------------------
// Init
void SegmentJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramWave1:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Wave1";
parameter.symbol = "w1";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramWave2:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Wave2";
parameter.symbol = "w2";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramWave3:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Wave3";
parameter.symbol = "w3";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramWave4:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Wave4";
parameter.symbol = "w4";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramWave5:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Wave5";
parameter.symbol = "w5";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramWave6:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "w6";
parameter.symbol = "";
parameter.unit = "";
parameter.ranges.def = 3.0f;
parameter.ranges.min = 1.0f;
parameter.ranges.max = 4.0f;
break;
case paramFM1:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "FM1";
parameter.symbol = "f1";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramFM2:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "FM2";
parameter.symbol = "f2";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramFM3:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "FM3";
parameter.symbol = "f3";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramFM4:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "FM4";
parameter.symbol = "f4";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramFM5:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "FM5";
parameter.symbol = "f5";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramFM6:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "FM6";
parameter.symbol = "f6";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramPan1:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Pan1";
parameter.symbol = "p1";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramPan2:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Pan2";
parameter.symbol = "p2";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramPan3:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Pan3";
parameter.symbol = "p3";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramPan4:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Pan4";
parameter.symbol = "p4";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramPan5:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Pan5";
parameter.symbol = "p5";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramPan6:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "p6";
parameter.symbol = "p6";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramAmp1:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Amp1";
parameter.symbol = "a1";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramAmp2:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Amp2";
parameter.symbol = "a2";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramAmp3:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Amp3";
parameter.symbol = "a3";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramAmp4:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Amp4";
parameter.symbol = "a4";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramAmp5:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Amp5";
parameter.symbol = "a5";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramAmp6:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Amp6";
parameter.symbol = "a6";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramAttack:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Attack";
parameter.symbol = "att";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramDecay:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Decay";
parameter.symbol = "dec";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramSustain:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Sustain";
parameter.symbol = "sus";
parameter.unit = "";
parameter.ranges.def = 1.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramRelease:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Release";
parameter.symbol = "rel";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramStereo:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Stereo";
parameter.symbol = "str";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramTune:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Tune";
parameter.symbol = "tun";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = -1.0f;
parameter.ranges.max = 1.0f;
break;
case paramVolume:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Volume";
parameter.symbol = "vol";
parameter.unit = "";
parameter.ranges.def = 0.5f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
case paramGlide:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Glide";
parameter.symbol = "gld";
parameter.unit = "";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
break;
}
}
void SegmentJuicePlugin::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float SegmentJuicePlugin::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramWave1:
return wave1;
case paramWave2:
return wave2;
case paramWave3:
return wave3;
case paramWave4:
return wave4;
case paramWave5:
return wave5;
case paramWave6:
return wave6;
case paramFM1:
return FM1;
case paramFM2:
return FM2;
case paramFM3:
return FM3;
case paramFM4:
return FM4;
case paramFM5:
return FM5;
case paramFM6:
return FM6;
case paramPan1:
return pan1;
case paramPan2:
return pan2;
case paramPan3:
return pan3;
case paramPan4:
return pan4;
case paramPan5:
return pan5;
case paramPan6:
return pan6;
case paramAmp1:
return amp1;
case paramAmp2:
return amp2;
case paramAmp3:
return amp3;
case paramAmp4:
return amp4;
case paramAmp5:
return amp5;
case paramAmp6:
return amp6;
case paramAttack:
return attack;
case paramDecay:
return decay;
case paramSustain:
return sustain;
case paramRelease:
return release;
case paramStereo:
return stereo;
case paramTune:
return tune;
case paramVolume:
return volume;
case paramGlide:
return glide;
default:
return 0.0f;
}
}
void SegmentJuicePlugin::d_setParameterValue(uint32_t index, float value)
{
switch (index)
{
case paramWave1:
synthL.setWave(0, value);
synthR.setWave(0, value);
wave1 = value;
break;
case paramWave2:
synthL.setWave(1, value);
synthR.setWave(1, value);
wave2 = value;
break;
case paramWave3:
synthL.setWave(2, value);
synthR.setWave(2, value);
wave3 = value;
break;
case paramWave4:
synthL.setWave(3, value);
synthR.setWave(3, value);
wave4 = value;
break;
case paramWave5:
synthL.setWave(4, value);
synthR.setWave(4, value);
wave5 = value;
break;
case paramWave6:
synthL.setWave(5, value);
synthR.setWave(5, value);
wave6 = value;
break;
case paramFM1:
synthL.setFM(0, value);
synthR.setFM(0, value);
FM1 = value;
break;
case paramFM2:
synthL.setFM(1, value);
synthR.setFM(1, value);
FM2 = value;
break;
case paramFM3:
synthL.setFM(2, value);
synthR.setFM(2, value);
FM3 = value;
break;
case paramFM4:
synthL.setFM(3, value);
synthR.setFM(3, value);
FM4 = value;
break;
case paramFM5:
synthL.setFM(4, value);
synthR.setFM(4, value);
FM5 = value;
break;
case paramFM6:
synthL.setFM(5, value);
synthR.setFM(5, value);
FM6 = value;
break;
case paramPan1:
synthL.setPan(0, -value);
synthR.setPan(0, value);
pan1 = value;
break;
case paramPan2:
synthL.setPan(1, -value);
synthR.setPan(1, value);
pan2 = value;
break;
case paramPan3:
synthL.setPan(2, -value);
synthR.setPan(2, value);
pan3 = value;
break;
case paramPan4:
synthL.setPan(3, -value);
synthR.setPan(3, value);
pan4 = value;
break;
case paramPan5:
synthL.setPan(4, -value);
synthR.setPan(4, value);
pan5 = value;
break;
case paramPan6:
synthL.setPan(5, -value);
synthR.setPan(5, value);
pan6 = value;
break;
case paramAmp1:
synthL.setAmp(0, value);
synthR.setAmp(0, value);
amp1 = value;
break;
case paramAmp2:
synthL.setAmp(1, value);
synthR.setAmp(1, value);
amp2 = value;
break;
case paramAmp3:
synthL.setAmp(2, value);
synthR.setAmp(2, value);
amp3 = value;
break;
case paramAmp4:
synthL.setAmp(3, value);
synthR.setAmp(3, value);
amp4 = value;
break;
case paramAmp5:
synthL.setAmp(4, value);
synthR.setAmp(4, value);
amp5 = value;
break;
case paramAmp6:
synthL.setAmp(5, value);
synthR.setAmp(5, value);
amp6 = value;
break;
case paramAttack:
synthL.setAttack(value);
synthR.setAttack(value);
attack = value;
break;
case paramDecay:
synthL.setDecay(value);
synthR.setDecay(value);
attack = value;
break;
case paramSustain:
synthL.setSustain(value);
synthR.setSustain(value);
attack = value;
break;
case paramRelease:
synthL.setRelease(value);
synthR.setRelease(value);
attack = value;
break;
case paramStereo:
synthL.setStereo(-value);
synthR.setStereo(value);
attack = value;
break;
case paramTune:
synthL.setTune(value);
synthR.setTune(value);
attack = value;
break;
case paramVolume:
synthL.setMAmp(value);
synthR.setMAmp(value);
attack = value;
case paramGlide:
synthL.setGlide(value);
synthR.setGlide(value);
glide = value;
break;
}
}
void SegmentJuicePlugin::d_setProgram(uint32_t index)
{
if (index != 0)
return;
/* Default parameter values */
wave1=wave2=wave3=wave4=wave5=wave6=3.0f;
FM1=FM2=FM3=FM4=FM5=FM6=0.5f;
pan1=pan2=pan3=pan4=pan5=pan6=0.0f;
amp1=amp2=amp3=amp4=amp5=amp6=0.5f;
attack=decay=release=stereo=tune=glide=0.0f;
sustain=1.0f;
volume=0.5f;
for (int i=0; i<6; i++) {
synthL.setFM(i, 0.5f);
synthR.setFM(i, 0.5f);
synthL.setPan(i, 0.0f);
synthR.setPan(i, 0.0f);
synthL.setAmp(i, 0.5f);
synthR.setAmp(i, 0.5f);
}
/* Default variable values */
synthL.setSampleRate(d_getSampleRate());
synthR.setSampleRate(d_getSampleRate());
synthL.setMAmp(0.5);
synthR.setMAmp(0.5);
synthL.setTune(0.0f);
synthR.setTune(0.0f);
synthL.setStereo(0.0f);
synthR.setStereo(0.0f);
synthL.setGlide(0.0f);
synthR.setGlide(0.0f);
synthL.setAttack(0.0f);
synthR.setAttack(0.0f);
synthL.setDecay(0.0f);
synthR.setDecay(0.0f);
synthL.setSustain(1.0f);
synthR.setSustain(1.0f);
synthL.setRelease(0.0f);
synthR.setRelease(0.0f);
/* reset filter values */
d_activate();
}
// -----------------------------------------------------------------------
// Process
void SegmentJuicePlugin::d_activate()
{
}
void SegmentJuicePlugin::d_deactivate()
{
// all values to zero
}
void SegmentJuicePlugin::d_run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount)
{
for (uint32_t i = 0; i<midiEventCount; i++) {
int mType = midiEvents[i].buf[0] & 0xF0;
//int mChan = midiEvents[i].buf[0] & 0x0F;
int mNum = midiEvents[i].buf[1];
if (mType == 0x90) {
//note on
synthL.play(mNum);
synthR.play(mNum);
} else if (mType == 0x80) {
//note off
synthL.stop(mNum);
synthR.stop(mNum);
}
}
for (uint32_t i = 0; i<frames; i++) {
outputs[0][i] = synthL.run();
outputs[1][i] = synthR.run();
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new SegmentJuicePlugin();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 136
source/modules/native-plugins/segmentjuice/SegmentJuicePlugin.hpp View File

@@ -1,136 +0,0 @@
/*
* Segment Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/
#ifndef SEGMENTJUICEPLUGIN_HPP_INCLUDED
#define SEGMENTJUICEPLUGIN_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
#include <iostream>
#include "Synth.hxx"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class SegmentJuicePlugin : public Plugin
{
public:
enum Parameters
{
paramWave1 = 0,
paramWave2,
paramWave3,
paramWave4,
paramWave5,
paramWave6,
paramFM1,
paramFM2,
paramFM3,
paramFM4,
paramFM5,
paramFM6,
paramPan1,
paramPan2,
paramPan3,
paramPan4,
paramPan5,
paramPan6,
paramAmp1,
paramAmp2,
paramAmp3,
paramAmp4,
paramAmp5,
paramAmp6,
paramAttack,
paramDecay,
paramSustain,
paramRelease,
paramStereo,
paramTune,
paramVolume,
paramGlide,
paramCount
};
SegmentJuicePlugin();
~SegmentJuicePlugin() override;
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "SegmentJuice";
}
const char* d_getMaker() const noexcept override
{
return "Andre Sklenar";
}
const char* d_getLicense() const noexcept override
{
return "GPL v2+";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('S', 'g', 't', 'J');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
// -------------------------------------------------------------------
private:
CSynth synthL, synthR;
float wave1, wave2, wave3, wave4, wave5, wave6;
float FM1, FM2, FM3, FM4, FM5, FM6;
float pan1, pan2, pan3, pan4, pan5, pan6;
float amp1, amp2, amp3, amp4, amp5, amp6;
float attack, decay, sustain, release, stereo, tune, volume, glide;
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // SEGMENTJUICE_HPP_INCLUDED

+ 0
- 821
source/modules/native-plugins/segmentjuice/SegmentJuiceUI.cpp View File

@@ -1,821 +0,0 @@
/*
* Segment Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#include "SegmentJuiceUI.hpp"

using DGL::Point;

START_NAMESPACE_DISTRHO

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

SegmentJuiceUI::SegmentJuiceUI()
: UI(),
fAboutWindow(this)
{
// background
fImgBackground = Image(SegmentJuiceArtwork::backgroundData, SegmentJuiceArtwork::backgroundWidth, SegmentJuiceArtwork::backgroundHeight, GL_BGR);

// about
Image imageAbout(SegmentJuiceArtwork::aboutData, SegmentJuiceArtwork::aboutWidth, SegmentJuiceArtwork::aboutHeight, GL_BGR);
fAboutWindow.setImage(imageAbout);

// knobs
Image knobImage(SegmentJuiceArtwork::knobData, SegmentJuiceArtwork::knobWidth, SegmentJuiceArtwork::knobHeight);

// knobs2
Image knobImage2(SegmentJuiceArtwork::knob2Data, SegmentJuiceArtwork::knob2Width, SegmentJuiceArtwork::knob2Height);

// knob Wave1
fKnobWave1 = new ImageKnob(this, knobImage);
fKnobWave1->setAbsolutePos(446, 79);
fKnobWave1->setRange(1.0f, 4.0f);
fKnobWave1->setValue(0.3f);
fKnobWave1->setRotationAngle(270);
fKnobWave1->setCallback(this);

// knob Wave2
fKnobWave2 = new ImageKnob(this, knobImage);
fKnobWave2->setAbsolutePos(446, 139);
fKnobWave2->setRange(1.0f, 4.0f);
fKnobWave2->setValue(3.0f);
fKnobWave2->setRotationAngle(270);
fKnobWave2->setCallback(this);

// knob Wave3
fKnobWave3 = new ImageKnob(this, knobImage);
fKnobWave3->setAbsolutePos(446, 199);
fKnobWave3->setRange(1.0f, 4.0f);
fKnobWave3->setValue(3.0f);
fKnobWave3->setRotationAngle(270);
fKnobWave3->setCallback(this);

// knob Wave4
fKnobWave4 = new ImageKnob(this, knobImage);
fKnobWave4->setAbsolutePos(446, 259);
fKnobWave4->setRange(1.0f, 4.0f);
fKnobWave4->setValue(3.0f);
fKnobWave4->setRotationAngle(270);
fKnobWave4->setCallback(this);

// knob Wave5
fKnobWave5 = new ImageKnob(this, knobImage);
fKnobWave5->setAbsolutePos(446, 319);
fKnobWave5->setRange(1.0f, 4.0f);
fKnobWave5->setValue(3.0f);
fKnobWave5->setRotationAngle(270);
fKnobWave5->setCallback(this);

// knob Wave6
fKnobWave6 = new ImageKnob(this, knobImage);
fKnobWave6->setAbsolutePos(446, 379);
fKnobWave6->setRange(1.0f, 4.0f);
fKnobWave6->setValue(3.0f);
fKnobWave6->setRotationAngle(270);
fKnobWave6->setCallback(this);

// knob FM1
fKnobFM1 = new ImageKnob(this, knobImage);
fKnobFM1->setAbsolutePos(510, 79);
fKnobFM1->setRange(0.0f, 1.0f);
fKnobFM1->setValue(0.5f);
fKnobFM1->setRotationAngle(270);
fKnobFM1->setCallback(this);

// knob FM2
fKnobFM2 = new ImageKnob(this, knobImage);
fKnobFM2->setAbsolutePos(510, 139);
fKnobFM2->setRange(0.0f, 1.0f);
fKnobFM2->setValue(0.5f);
fKnobFM2->setRotationAngle(270);
fKnobFM2->setCallback(this);

// knob FM3
fKnobFM3 = new ImageKnob(this, knobImage);
fKnobFM3->setAbsolutePos(510, 199);
fKnobFM3->setRange(0.0f, 1.0f);
fKnobFM3->setValue(0.5f);
fKnobFM3->setRotationAngle(270);
fKnobFM3->setCallback(this);

// knob FM4
fKnobFM4 = new ImageKnob(this, knobImage);
fKnobFM4->setAbsolutePos(510, 259);
fKnobFM4->setRange(0.0f, 1.0f);
fKnobFM4->setValue(0.5f);
fKnobFM4->setRotationAngle(270);
fKnobFM4->setCallback(this);

// knob FM5
fKnobFM5 = new ImageKnob(this, knobImage);
fKnobFM5->setAbsolutePos(510, 319);
fKnobFM5->setRange(0.0f, 1.0f);
fKnobFM5->setValue(0.5f);
fKnobFM5->setRotationAngle(270);
fKnobFM5->setCallback(this);

// knob FM6
fKnobFM6 = new ImageKnob(this, knobImage);
fKnobFM6->setAbsolutePos(510, 379);
fKnobFM6->setRange(0.0f, 1.0f);
fKnobFM6->setValue(0.5f);
fKnobFM6->setRotationAngle(270);
fKnobFM6->setCallback(this);

// knob Pan1
fKnobPan1 = new ImageKnob(this, knobImage);
fKnobPan1->setAbsolutePos(574, 79);
fKnobPan1->setRange(-1.0f, 1.0f);
fKnobPan1->setValue(0.0f);
fKnobPan1->setRotationAngle(270);
fKnobPan1->setCallback(this);

// knob Pan2
fKnobPan2 = new ImageKnob(this, knobImage);
fKnobPan2->setAbsolutePos(574, 139);
fKnobPan2->setRange(-1.0f, 1.0f);
fKnobPan2->setValue(0.0f);
fKnobPan2->setRotationAngle(270);
fKnobPan2->setCallback(this);

// knob Pan3
fKnobPan3 = new ImageKnob(this, knobImage);
fKnobPan3->setAbsolutePos(574, 199);
fKnobPan3->setRange(-1.0f, 1.0f);
fKnobPan3->setValue(0.0f);
fKnobPan3->setRotationAngle(270);
fKnobPan3->setCallback(this);

// knob Pan4
fKnobPan4 = new ImageKnob(this, knobImage);
fKnobPan4->setAbsolutePos(574, 259);
fKnobPan4->setRange(-1.0f, 1.0f);
fKnobPan4->setValue(0.0f);
fKnobPan4->setRotationAngle(270);
fKnobPan4->setCallback(this);

// knob Pan5
fKnobPan5 = new ImageKnob(this, knobImage);
fKnobPan5->setAbsolutePos(574, 319);
fKnobPan5->setRange(-1.0f, 1.0f);
fKnobPan5->setValue(0.0f);
fKnobPan5->setRotationAngle(270);
fKnobPan5->setCallback(this);

// knob Pan6
fKnobPan6 = new ImageKnob(this, knobImage);
fKnobPan6->setAbsolutePos(574, 379);
fKnobPan6->setRange(-1.0f, 1.0f);
fKnobPan6->setValue(0.0f);
fKnobPan6->setRotationAngle(270);
fKnobPan6->setCallback(this);

// knob Amp1
fKnobAmp1 = new ImageKnob(this, knobImage);
fKnobAmp1->setAbsolutePos(638, 79);
fKnobAmp1->setRange(0.0f, 1.0f);
fKnobAmp1->setValue(0.5f);
fKnobAmp1->setRotationAngle(270);
fKnobAmp1->setCallback(this);

// knob Amp2
fKnobAmp2 = new ImageKnob(this, knobImage);
fKnobAmp2->setAbsolutePos(638, 139);
fKnobAmp2->setRange(0.0f, 1.0f);
fKnobAmp2->setValue(0.5f);
fKnobAmp2->setRotationAngle(270);
fKnobAmp2->setCallback(this);

// knob Amp3
fKnobAmp3 = new ImageKnob(this, knobImage);
fKnobAmp3->setAbsolutePos(638, 199);
fKnobAmp3->setRange(0.0f, 1.0f);
fKnobAmp3->setValue(0.5f);
fKnobAmp3->setRotationAngle(270);
fKnobAmp3->setCallback(this);

// knob Amp4
fKnobAmp4 = new ImageKnob(this, knobImage);
fKnobAmp4->setAbsolutePos(638, 259);
fKnobAmp4->setRange(0.0f, 1.0f);
fKnobAmp4->setValue(0.5f);
fKnobAmp4->setRotationAngle(270);
fKnobAmp4->setCallback(this);

// knob Amp5
fKnobAmp5 = new ImageKnob(this, knobImage);
fKnobAmp5->setAbsolutePos(638, 319);
fKnobAmp5->setRange(0.0f, 1.0f);
fKnobAmp5->setValue(0.5f);
fKnobAmp5->setRotationAngle(270);
fKnobAmp5->setCallback(this);

// knob Amp6
fKnobAmp6 = new ImageKnob(this, knobImage);
fKnobAmp6->setAbsolutePos(638, 379);
fKnobAmp6->setRange(0.0f, 1.0f);
fKnobAmp6->setValue(0.5f);
fKnobAmp6->setRotationAngle(270);
fKnobAmp6->setCallback(this);

// knob Attack
fKnobAttack = new ImageKnob(this, knobImage2);
fKnobAttack->setAbsolutePos(34, 248);
fKnobAttack->setRange(0.0f, 1.0f);
fKnobAttack->setValue(0.0f);
fKnobAttack->setRotationAngle(270);
fKnobAttack->setCallback(this);

// knob Decay
fKnobDecay = new ImageKnob(this, knobImage2);
fKnobDecay->setAbsolutePos(132, 248);
fKnobDecay->setRange(0.0f, 1.0f);
fKnobDecay->setValue(0.0f);
fKnobDecay->setRotationAngle(270);
fKnobDecay->setCallback(this);

// knob Sustain
fKnobSustain = new ImageKnob(this, knobImage2);
fKnobSustain->setAbsolutePos(232, 248);
fKnobSustain->setRange(0.0f, 1.0f);
fKnobSustain->setValue(1.0f);
fKnobSustain->setRotationAngle(270);
fKnobSustain->setCallback(this);

// knob Release
fKnobRelease = new ImageKnob(this, knobImage2);
fKnobRelease->setAbsolutePos(330, 248);
fKnobRelease->setRange(0.0f, 1.0f);
fKnobRelease->setValue(0.0f);
fKnobRelease->setRotationAngle(270);
fKnobRelease->setCallback(this);

// knob Stereo
fKnobStereo = new ImageKnob(this, knobImage2);
fKnobStereo->setAbsolutePos(34, 339);
fKnobStereo->setRange(-1.0f, 1.0f);
fKnobStereo->setValue(0.0f);
fKnobStereo->setRotationAngle(270);
fKnobStereo->setCallback(this);

// knob Tune
fKnobTune = new ImageKnob(this, knobImage2);
fKnobTune->setAbsolutePos(132, 339);
fKnobTune->setRange(-1.0f, 1.0f);
fKnobTune->setValue(0.0f);
fKnobTune->setRotationAngle(270);
fKnobTune->setCallback(this);

// knob Volume
fKnobVolume = new ImageKnob(this, knobImage2);
fKnobVolume->setAbsolutePos(232, 339);
fKnobVolume->setRange(0.0f, 1.0f);
fKnobVolume->setValue(0.5f);
fKnobVolume->setRotationAngle(270);
fKnobVolume->setCallback(this);

// knob Glide
fKnobGlide = new ImageKnob(this, knobImage2);
fKnobGlide->setAbsolutePos(330, 339);
fKnobGlide->setRange(0.0f, 1.0f);
fKnobGlide->setValue(0.0f);
fKnobGlide->setRotationAngle(270);
fKnobGlide->setCallback(this);

// about button
Image aboutImageNormal(SegmentJuiceArtwork::aboutButtonNormalData, SegmentJuiceArtwork::aboutButtonNormalWidth, SegmentJuiceArtwork::aboutButtonNormalHeight);
Image aboutImageHover(SegmentJuiceArtwork::aboutButtonHoverData, SegmentJuiceArtwork::aboutButtonHoverWidth, SegmentJuiceArtwork::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setAbsolutePos(599, 17);
fButtonAbout->setCallback(this);

// set default values
d_programChanged(0);
}

void SegmentJuiceUI::updateSynth() {
synthL.setWave(0, fKnobWave1->getValue());
synthL.setWave(1, fKnobWave2->getValue());
synthL.setWave(2, fKnobWave3->getValue());
synthL.setWave(3, fKnobWave4->getValue());
synthL.setWave(4, fKnobWave5->getValue());
synthL.setWave(5, fKnobWave6->getValue());
synthL.setFM(0, fKnobFM1->getValue());
synthL.setFM(1, fKnobFM2->getValue());
synthL.setFM(2, fKnobFM3->getValue());
synthL.setFM(3, fKnobFM4->getValue());
synthL.setFM(4, fKnobFM5->getValue());
synthL.setFM(5, fKnobFM6->getValue());
synthL.setPan(0, -fKnobPan1->getValue());
synthL.setPan(1, -fKnobPan2->getValue());
synthL.setPan(2, -fKnobPan3->getValue());
synthL.setPan(3, -fKnobPan4->getValue());
synthL.setPan(4, -fKnobPan5->getValue());
synthL.setPan(5, -fKnobPan6->getValue());
synthL.setAmp(0, fKnobAmp1->getValue());
synthL.setAmp(1, fKnobAmp2->getValue());
synthL.setAmp(2, fKnobAmp3->getValue());
synthL.setAmp(3, fKnobAmp4->getValue());
synthL.setAmp(4, fKnobAmp5->getValue());
synthL.setAmp(5, fKnobAmp6->getValue());
synthL.setMAmp(fKnobVolume->getValue());

synthR.setWave(0, fKnobWave1->getValue());
synthR.setWave(1, fKnobWave2->getValue());
synthR.setWave(2, fKnobWave3->getValue());
synthR.setWave(3, fKnobWave4->getValue());
synthR.setWave(4, fKnobWave5->getValue());
synthR.setWave(5, fKnobWave6->getValue());
synthR.setFM(0, fKnobFM1->getValue());
synthR.setFM(1, fKnobFM2->getValue());
synthR.setFM(2, fKnobFM3->getValue());
synthR.setFM(3, fKnobFM4->getValue());
synthR.setFM(4, fKnobFM5->getValue());
synthR.setFM(5, fKnobFM6->getValue());
synthR.setPan(0, fKnobPan1->getValue());
synthR.setPan(1, fKnobPan2->getValue());
synthR.setPan(2, fKnobPan3->getValue());
synthR.setPan(3, fKnobPan4->getValue());
synthR.setPan(4, fKnobPan5->getValue());
synthR.setPan(5, fKnobPan6->getValue());
synthR.setAmp(0, fKnobAmp1->getValue());
synthR.setAmp(1, fKnobAmp2->getValue());
synthR.setAmp(2, fKnobAmp3->getValue());
synthR.setAmp(3, fKnobAmp4->getValue());
synthR.setAmp(4, fKnobAmp5->getValue());
synthR.setAmp(5, fKnobAmp6->getValue());
synthR.setMAmp(fKnobVolume->getValue());
}

// -----------------------------------------------------------------------
// DSP Callbacks

void SegmentJuiceUI::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case SegmentJuicePlugin::paramWave1:
fKnobWave1->setValue(value);
break;
case SegmentJuicePlugin::paramWave2:
fKnobWave2->setValue(value);
break;
case SegmentJuicePlugin::paramWave3:
fKnobWave3->setValue(value);
break;
case SegmentJuicePlugin::paramWave4:
fKnobWave4->setValue(value);
break;
case SegmentJuicePlugin::paramWave5:
fKnobWave5->setValue(value);
break;
case SegmentJuicePlugin::paramWave6:
fKnobWave6->setValue(value);
break;
case SegmentJuicePlugin::paramFM1:
fKnobFM1->setValue(value);
break;
case SegmentJuicePlugin::paramFM2:
fKnobFM2->setValue(value);
break;
case SegmentJuicePlugin::paramFM3:
fKnobFM3->setValue(value);
break;
case SegmentJuicePlugin::paramFM4:
fKnobFM4->setValue(value);
break;
case SegmentJuicePlugin::paramFM5:
fKnobFM5->setValue(value);
break;
case SegmentJuicePlugin::paramFM6:
fKnobFM6->setValue(value);
break;
case SegmentJuicePlugin::paramPan1:
fKnobPan1->setValue(value);
break;
case SegmentJuicePlugin::paramPan2:
fKnobPan2->setValue(value);
break;
case SegmentJuicePlugin::paramPan3:
fKnobPan3->setValue(value);
break;
case SegmentJuicePlugin::paramPan4:
fKnobPan4->setValue(value);
break;
case SegmentJuicePlugin::paramPan5:
fKnobPan5->setValue(value);
break;
case SegmentJuicePlugin::paramPan6:
fKnobPan6->setValue(value);
break;
case SegmentJuicePlugin::paramAmp1:
fKnobAmp1->setValue(value);
break;
case SegmentJuicePlugin::paramAmp2:
fKnobAmp2->setValue(value);
break;
case SegmentJuicePlugin::paramAmp3:
fKnobAmp3->setValue(value);
break;
case SegmentJuicePlugin::paramAmp4:
fKnobAmp4->setValue(value);
break;
case SegmentJuicePlugin::paramAmp5:
fKnobAmp5->setValue(value);
break;
case SegmentJuicePlugin::paramAmp6:
fKnobAmp6->setValue(value);
break;
case SegmentJuicePlugin::paramAttack:
fKnobAttack->setValue(value);
break;
case SegmentJuicePlugin::paramDecay:
fKnobDecay->setValue(value);
break;
case SegmentJuicePlugin::paramSustain:
fKnobSustain->setValue(value);
break;
case SegmentJuicePlugin::paramRelease:
fKnobRelease->setValue(value);
break;
case SegmentJuicePlugin::paramStereo:
fKnobStereo->setValue(value);
break;
case SegmentJuicePlugin::paramTune:
fKnobTune->setValue(value);
break;
case SegmentJuicePlugin::paramVolume:
fKnobVolume->setValue(value);
break;
case SegmentJuicePlugin::paramGlide:
fKnobGlide->setValue(value);
break;
}

updateSynth();
}

void SegmentJuiceUI::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
fKnobWave1->setValue(3.0f);
fKnobWave2->setValue(3.0f);
fKnobWave3->setValue(3.0f);
fKnobWave6->setValue(3.0f);
fKnobWave5->setValue(3.0f);
fKnobWave6->setValue(3.0f);

fKnobFM1->setValue(0.5f);
fKnobFM2->setValue(0.5f);
fKnobFM3->setValue(0.5f);
fKnobFM6->setValue(0.5f);
fKnobFM5->setValue(0.5f);
fKnobFM6->setValue(0.5f);

fKnobPan1->setValue(0.0f);
fKnobPan2->setValue(0.0f);
fKnobPan3->setValue(0.0f);
fKnobPan6->setValue(0.0f);
fKnobPan5->setValue(0.0f);
fKnobPan6->setValue(0.0f);

fKnobAmp1->setValue(0.5f);
fKnobAmp2->setValue(0.5f);
fKnobAmp3->setValue(0.5f);
fKnobAmp6->setValue(0.5f);
fKnobAmp5->setValue(0.5f);
fKnobAmp6->setValue(0.5f);

fKnobAttack->setValue(0.0f);
fKnobDecay->setValue(0.0f);
fKnobSustain->setValue(1.0f);
fKnobRelease->setValue(0.0f);

fKnobStereo->setValue(0.0f);
fKnobTune->setValue(0.0f);
fKnobVolume->setValue(0.5f);
fKnobGlide->setValue(0.0f);

for (int i=0; i<6; i++) {
synthL.setFM(i, 0.5f);
synthR.setFM(i, 0.5f);

synthL.setPan(i, 0.0f);
synthR.setPan(i, 0.0f);

synthL.setAmp(i, 0.5f);
synthR.setAmp(i, 0.5f);
}

synthL.setSampleRate(d_getSampleRate());
synthR.setSampleRate(d_getSampleRate());

synthL.setMAmp(0.5f);
synthR.setMAmp(0.5f);

synthL.play(69);
synthR.play(69);
synthL.setAttack(0);
synthR.setAttack(0);
synthL.setDecay(0);
synthR.setDecay(0);
synthL.setSustain(1);
synthR.setSustain(1);
synthL.setRelease(0);
synthR.setRelease(0);
synthL.setGlide(0);
synthR.setGlide(0);
synthL.setTune(0);
synthR.setTune(0);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void SegmentJuiceUI::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void SegmentJuiceUI::imageKnobDragStarted(ImageKnob* knob)
{
if (knob == fKnobWave1)
d_editParameter(SegmentJuicePlugin::paramWave1, true);
else if (knob == fKnobWave2)
d_editParameter(SegmentJuicePlugin::paramWave2, true);
else if (knob == fKnobWave3)
d_editParameter(SegmentJuicePlugin::paramWave3, true);
else if (knob == fKnobWave4)
d_editParameter(SegmentJuicePlugin::paramWave4, true);
else if (knob == fKnobWave5)
d_editParameter(SegmentJuicePlugin::paramWave5, true);
else if (knob == fKnobWave6)
d_editParameter(SegmentJuicePlugin::paramWave6, true);
else if (knob == fKnobFM1)
d_editParameter(SegmentJuicePlugin::paramFM1, true);
else if (knob == fKnobFM2)
d_editParameter(SegmentJuicePlugin::paramFM2, true);
else if (knob == fKnobFM3)
d_editParameter(SegmentJuicePlugin::paramFM3, true);
else if (knob == fKnobFM4)
d_editParameter(SegmentJuicePlugin::paramFM4, true);
else if (knob == fKnobFM5)
d_editParameter(SegmentJuicePlugin::paramFM5, true);
else if (knob == fKnobFM6)
d_editParameter(SegmentJuicePlugin::paramFM6, true);
else if (knob == fKnobPan1)
d_editParameter(SegmentJuicePlugin::paramPan1, true);
else if (knob == fKnobPan2)
d_editParameter(SegmentJuicePlugin::paramPan2, true);
else if (knob == fKnobPan3)
d_editParameter(SegmentJuicePlugin::paramPan3, true);
else if (knob == fKnobPan4)
d_editParameter(SegmentJuicePlugin::paramPan4, true);
else if (knob == fKnobPan5)
d_editParameter(SegmentJuicePlugin::paramPan5, true);
else if (knob == fKnobPan6)
d_editParameter(SegmentJuicePlugin::paramPan6, true);
else if (knob == fKnobAmp1)
d_editParameter(SegmentJuicePlugin::paramAmp1, true);
else if (knob == fKnobAmp2)
d_editParameter(SegmentJuicePlugin::paramAmp2, true);
else if (knob == fKnobAmp3)
d_editParameter(SegmentJuicePlugin::paramAmp3, true);
else if (knob == fKnobAmp4)
d_editParameter(SegmentJuicePlugin::paramAmp4, true);
else if (knob == fKnobAmp5)
d_editParameter(SegmentJuicePlugin::paramAmp5, true);
else if (knob == fKnobAmp6)
d_editParameter(SegmentJuicePlugin::paramAmp6, true);
else if (knob == fKnobAttack)
d_editParameter(SegmentJuicePlugin::paramAttack, true);
else if (knob == fKnobDecay)
d_editParameter(SegmentJuicePlugin::paramDecay, true);
else if (knob == fKnobSustain)
d_editParameter(SegmentJuicePlugin::paramSustain, true);
else if (knob == fKnobRelease)
d_editParameter(SegmentJuicePlugin::paramRelease, true);
else if (knob == fKnobStereo)
d_editParameter(SegmentJuicePlugin::paramStereo, true);
else if (knob == fKnobTune)
d_editParameter(SegmentJuicePlugin::paramTune, true);
else if (knob == fKnobVolume)
d_editParameter(SegmentJuicePlugin::paramVolume, true);
else if (knob == fKnobGlide)
d_editParameter(SegmentJuicePlugin::paramGlide, true);
}

void SegmentJuiceUI::imageKnobDragFinished(ImageKnob* knob)
{
if (knob == fKnobWave1)
d_editParameter(SegmentJuicePlugin::paramWave1, false);
else if (knob == fKnobWave2)
d_editParameter(SegmentJuicePlugin::paramWave2, false);
else if (knob == fKnobWave3)
d_editParameter(SegmentJuicePlugin::paramWave3, false);
else if (knob == fKnobWave4)
d_editParameter(SegmentJuicePlugin::paramWave4, false);
else if (knob == fKnobWave5)
d_editParameter(SegmentJuicePlugin::paramWave5, false);
else if (knob == fKnobWave6)
d_editParameter(SegmentJuicePlugin::paramWave6, false);
else if (knob == fKnobFM1)
d_editParameter(SegmentJuicePlugin::paramFM1, false);
else if (knob == fKnobFM2)
d_editParameter(SegmentJuicePlugin::paramFM2, false);
else if (knob == fKnobFM3)
d_editParameter(SegmentJuicePlugin::paramFM3, false);
else if (knob == fKnobFM4)
d_editParameter(SegmentJuicePlugin::paramFM4, false);
else if (knob == fKnobFM5)
d_editParameter(SegmentJuicePlugin::paramFM5, false);
else if (knob == fKnobFM6)
d_editParameter(SegmentJuicePlugin::paramFM6, false);
else if (knob == fKnobPan1)
d_editParameter(SegmentJuicePlugin::paramPan1, false);
else if (knob == fKnobPan2)
d_editParameter(SegmentJuicePlugin::paramPan2, false);
else if (knob == fKnobPan3)
d_editParameter(SegmentJuicePlugin::paramPan3, false);
else if (knob == fKnobPan4)
d_editParameter(SegmentJuicePlugin::paramPan4, false);
else if (knob == fKnobPan5)
d_editParameter(SegmentJuicePlugin::paramPan5, false);
else if (knob == fKnobPan6)
d_editParameter(SegmentJuicePlugin::paramPan6, false);
else if (knob == fKnobAmp1)
d_editParameter(SegmentJuicePlugin::paramAmp1, false);
else if (knob == fKnobAmp2)
d_editParameter(SegmentJuicePlugin::paramAmp2, false);
else if (knob == fKnobAmp3)
d_editParameter(SegmentJuicePlugin::paramAmp3, false);
else if (knob == fKnobAmp4)
d_editParameter(SegmentJuicePlugin::paramAmp4, false);
else if (knob == fKnobAmp5)
d_editParameter(SegmentJuicePlugin::paramAmp5, false);
else if (knob == fKnobAmp6)
d_editParameter(SegmentJuicePlugin::paramAmp6, false);
else if (knob == fKnobAttack)
d_editParameter(SegmentJuicePlugin::paramAttack, false);
else if (knob == fKnobDecay)
d_editParameter(SegmentJuicePlugin::paramDecay, false);
else if (knob == fKnobSustain)
d_editParameter(SegmentJuicePlugin::paramSustain, false);
else if (knob == fKnobRelease)
d_editParameter(SegmentJuicePlugin::paramRelease, false);
else if (knob == fKnobStereo)
d_editParameter(SegmentJuicePlugin::paramStereo, false);
else if (knob == fKnobTune)
d_editParameter(SegmentJuicePlugin::paramTune, false);
else if (knob == fKnobVolume)
d_editParameter(SegmentJuicePlugin::paramVolume, false);
else if (knob == fKnobGlide)
d_editParameter(SegmentJuicePlugin::paramGlide, false);
}

void SegmentJuiceUI::imageKnobValueChanged(ImageKnob* knob, float value)
{
if (knob == fKnobWave1)
d_setParameterValue(SegmentJuicePlugin::paramWave1, value);
else if (knob == fKnobWave2)
d_setParameterValue(SegmentJuicePlugin::paramWave2, value);
else if (knob == fKnobWave3)
d_setParameterValue(SegmentJuicePlugin::paramWave3, value);
else if (knob == fKnobWave4)
d_setParameterValue(SegmentJuicePlugin::paramWave4, value);
else if (knob == fKnobWave5)
d_setParameterValue(SegmentJuicePlugin::paramWave5, value);
else if (knob == fKnobWave6)
d_setParameterValue(SegmentJuicePlugin::paramWave6, value);
else if (knob == fKnobFM1)
d_setParameterValue(SegmentJuicePlugin::paramFM1, value);
else if (knob == fKnobFM2)
d_setParameterValue(SegmentJuicePlugin::paramFM2, value);
else if (knob == fKnobFM3)
d_setParameterValue(SegmentJuicePlugin::paramFM3, value);
else if (knob == fKnobFM4)
d_setParameterValue(SegmentJuicePlugin::paramFM4, value);
else if (knob == fKnobFM5)
d_setParameterValue(SegmentJuicePlugin::paramFM5, value);
else if (knob == fKnobFM6)
d_setParameterValue(SegmentJuicePlugin::paramFM6, value);
else if (knob == fKnobPan1)
d_setParameterValue(SegmentJuicePlugin::paramPan1, value);
else if (knob == fKnobPan2)
d_setParameterValue(SegmentJuicePlugin::paramPan2, value);
else if (knob == fKnobPan3)
d_setParameterValue(SegmentJuicePlugin::paramPan3, value);
else if (knob == fKnobPan4)
d_setParameterValue(SegmentJuicePlugin::paramPan4, value);
else if (knob == fKnobPan5)
d_setParameterValue(SegmentJuicePlugin::paramPan5, value);
else if (knob == fKnobPan6)
d_setParameterValue(SegmentJuicePlugin::paramPan6, value);
else if (knob == fKnobAmp1)
d_setParameterValue(SegmentJuicePlugin::paramAmp1, value);
else if (knob == fKnobAmp2)
d_setParameterValue(SegmentJuicePlugin::paramAmp2, value);
else if (knob == fKnobAmp3)
d_setParameterValue(SegmentJuicePlugin::paramAmp3, value);
else if (knob == fKnobAmp4)
d_setParameterValue(SegmentJuicePlugin::paramAmp4, value);
else if (knob == fKnobAmp5)
d_setParameterValue(SegmentJuicePlugin::paramAmp5, value);
else if (knob == fKnobAmp6)
d_setParameterValue(SegmentJuicePlugin::paramAmp6, value);
else if (knob == fKnobAttack)
d_setParameterValue(SegmentJuicePlugin::paramAttack, value);
else if (knob == fKnobDecay)
d_setParameterValue(SegmentJuicePlugin::paramDecay, value);
else if (knob == fKnobSustain)
d_setParameterValue(SegmentJuicePlugin::paramSustain, value);
else if (knob == fKnobRelease)
d_setParameterValue(SegmentJuicePlugin::paramRelease, value);
else if (knob == fKnobStereo)
d_setParameterValue(SegmentJuicePlugin::paramStereo, value);
else if (knob == fKnobTune)
d_setParameterValue(SegmentJuicePlugin::paramTune, value);
else if (knob == fKnobVolume)
d_setParameterValue(SegmentJuicePlugin::paramVolume, value);
else if (knob == fKnobGlide)
d_setParameterValue(SegmentJuicePlugin::paramGlide, value);

updateSynth();

}

void SegmentJuiceUI::onDisplay()
{
fImgBackground.draw();

int cX = 23+4;
int cY = 50;
int cW = 388-cX-3;
int cH = 216-cY;

//draw waveform
synthL.play(71);
synthR.play(71);
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable( GL_LINE_SMOOTH );
//glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glLineWidth(1.0f);
//draw #left waveform
glColor4f(0.0f, 1.0f, 0.0f, 0.5f);
glBegin(GL_LINE_STRIP);
for (int i = 0; i<cW; i++) {
float out = synthL.run()*cH/2+cH/2+cY;
glVertex2i(i+cX, out);
std::cout << out << std::endl;
}
//draw #right waveform
glEnd();
glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
glBegin(GL_LINE_STRIP);
for (int i = 0; i<cW; i++) {
glVertex2i(i+cX, synthR.run()*cH/2+cH/2+cY);
}
glEnd();

//draw 0dc line

glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
glBegin(GL_LINES);
glVertex2i(cX, cY+cH/2);
glVertex2i(cX+cW, cY+cH/2);
glEnd();

glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}

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

UI* createUI()
{
return new SegmentJuiceUI();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 100
source/modules/native-plugins/segmentjuice/SegmentJuiceUI.hpp View File

@@ -1,100 +0,0 @@
/*
* Segment Juice Plugin
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*
* 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 doc/GPL.txt file.
*/

#ifndef WOBBLEJUICEUI_HPP_INCLUDED
#define WOBBLEJUICEUI_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageAboutWindow.hpp"
#include "ImageButton.hpp"
#include "ImageKnob.hpp"
#include "ImageSlider.hpp"

#include "SegmentJuiceArtwork.hpp"
#include "SegmentJuicePlugin.hpp"
#include <iostream>
#include "Synth.hxx"

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;

START_NAMESPACE_DISTRHO

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

class SegmentJuiceUI : public UI,
public ImageButton::Callback,
public ImageKnob::Callback
{
public:
SegmentJuiceUI();

void updateSynth();

protected:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return SegmentJuiceArtwork::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return SegmentJuiceArtwork::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ScopedPointer<ImageButton> fButtonAbout;
ScopedPointer<ImageKnob> fKnobWave1, fKnobWave2, fKnobWave3, fKnobWave4, fKnobWave5, fKnobWave6;
ScopedPointer<ImageKnob> fKnobFM1, fKnobFM2, fKnobFM3, fKnobFM4, fKnobFM5, fKnobFM6;
ScopedPointer<ImageKnob> fKnobPan1, fKnobPan2, fKnobPan3, fKnobPan4, fKnobPan5, fKnobPan6;
ScopedPointer<ImageKnob> fKnobAmp1, fKnobAmp2, fKnobAmp3, fKnobAmp4, fKnobAmp5, fKnobAmp6;
ScopedPointer<ImageKnob> fKnobAttack, fKnobDecay, fKnobSustain, fKnobRelease;
ScopedPointer<ImageKnob> fKnobStereo, fKnobTune, fKnobVolume, fKnobGlide;

CSynth synthL, synthR;
};

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

END_NAMESPACE_DISTRHO

#endif // WOBBLEJUICEUI_HPP_INCLUDED

+ 0
- 299
source/modules/native-plugins/segmentjuice/Synth.hxx View File

@@ -1,299 +0,0 @@
/*
* Segment Synthesizer Design
* Implemented by Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz .
*
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
*/

#ifndef SYNTH_HXX_INCLUDED
#define SYNTH_HXX_INCLUDED

#include <cmath>
#include <cstdlib>

class CSynth
{
public:
CSynth()
{
for (int i=0; i<6; i++) {
waves[i] = 3.0f;
}
for (int i=0; i<6; i++) {
FMs[i] = 0.5f*64;
}
for (int i=0; i<6; i++) {
pans[i] = 1.0f;
}
for (int i=0; i<6; i++) {
amps[i] = 0.5f;
}
waveBlend = 0;
freq = 0;
phaseAccum = 0;
playing = false;
cycleSize = 0;
sampleRate = 0;
notePlaying = 0;
env = 0;
envPhase = 0;
aCoeff=dCoeff=rCoeff=0;
stereo = 0;
tFreq=0;
gl = 0;
glideDistance = 0;
attack=decay=sustain=release=0.0f;
mAmp = 0.5;
freqOffset = 0;
}

float getSinePhase(float x) {
return -(std::sin(x));
}
float getSawPhase(float x) {
return (-(2/M_PI *std::atan(1/std::tan(x/2))));
}
float getRevSawPhase(float x) {
return ((2/M_PI *std::atan(1/std::tan(x/2))));
}
float getSquarePhase(float x) {
return (std::round((std::sin(x)+1)/2)-0.5)*2;
}

//saw, sqr, sin, revSaw
float getBlendedPhase(float x, float wave, float polarity)
{
//wave = 2;
if (wave>=1 && wave<2) {
/* saw vs sqr */
waveBlend = wave-1;
return (getSawPhase(x)*(1-waveBlend) + getSquarePhase(x)*waveBlend)*polarity;
} else if (wave>=2 && wave<3) {
/* sqr vs sin */
waveBlend = wave-2;
return (getSquarePhase(x)*(1-waveBlend) + getSinePhase(x)*waveBlend)*polarity;
} else if (wave>=3 && wave<=4) {
/* sin vs revSaw */
waveBlend = wave-3;
return (getSinePhase(x)*(1-waveBlend) + getRevSawPhase(x)*waveBlend)*polarity;
} else {
return 0.0f;
}
}

void setWave(int i, float nWave) {
waves[i] = nWave;
}

void setFM(int i, float nFM) {
FMs[i] = nFM*64;
}

void setPan(int i, float nPan) {
pans[i] = (nPan+1)/2;
}

void setAmp(int i, float nAmp) {
amps[i] = nAmp;
}

void setMAmp(float nMAmp) {
mAmp = nMAmp;
}

void setStereo(float nStereo) {
stereo = nStereo;
if (playing) {
freq = 440.0 * pow(2.0, (notePlaying - 69)/12);
freq += freq*(stereo/12);
}
}

void setTune(float nTune) {
freqOffset = nTune;
if (playing) {
freq = 440.0 * pow(2.0, (notePlaying - 69)/12);
freq +=freq*freqOffset;
freq += freq*(stereo/12);
tFreq = freq;
//gl = 1;
//freq += freq*freqOffset;
glideDistance = 0;
cycleSize = sampleRate/(freq/4);
//glide init
//gCoeff = 1.0f - expf(-1/glide);
}
}

void setAttack(float nAttack) {
attack = nAttack*sampleRate*4;
}

void setDecay(float nDecay) {
decay = nDecay*sampleRate;
}

void setSustain(float nSustain) {
sustain = nSustain*4;
}

void setRelease(float nRelease) {
release = nRelease*sampleRate;
}

void setGlide(float nGlide) {
glide = nGlide*sampleRate;
}

float getWave(int i) {
return waves[i];
}

float getFM(int i) {
return FMs[i];
}

float getPan(int i) {
return (pans[i]*2)-1;
}
float getAmp(int i) {
return amps[i];
}

void stop(int note) {
if (note==notePlaying) {
envPhase = 2; //release
}
}

void play(float note) {
if (!playing || (playing && notePlaying==note)) {
notePlaying = note;
freq = 440.0 * pow(2.0, (notePlaying - 69)/12);
freq += freq*(freqOffset);
freq += freq*(stereo/12);
cycleSize = sampleRate/(freq/4);
tFreq = freq;
playing = true;
phaseAccum = 0;
env = 0.0f;
envPhase = 0;
//env init
aCoeff = 1.0f - expf(-1/attack);
dCoeff = 1.0f - expf(-1/decay);
rCoeff = 1.0f - expf(-1/release);
} else {
std::cout << "not playing" << std::endl;
//glide towards the target freq
notePlaying = note;
tFreq = 440.0 * pow(2.0, (notePlaying - 69)/12);
tFreq += tFreq*(freqOffset);
tFreq += tFreq*(stereo/12);
glideDistance = tFreq-freq;
gl = 0;
if (envPhase == 2) {
envPhase = 0;

}

//glide init
gCoeff = 1.0f - expf(-1/glide);
}
}

float run() {
float out = 0;
if (playing) {
if (freq!=tFreq) {
//gliding yo
gl+=gCoeff * ((1.0/1.0) - gl);
freq=(tFreq-glideDistance)+glideDistance*gl;
cycleSize = sampleRate/(freq/4);
}

out = getSinePhase((phaseAccum/cycleSize)*(2*M_PI))*amps[0]*0.5;
out += getSinePhase((phaseAccum/cycleSize)*2*(2*M_PI))*amps[0]*0.5;
out += getBlendedPhase((phaseAccum/cycleSize)*(getBlendedPhase(phaseAccum/(cycleSize/8), waves[0], 1)*FMs[0])*(2*M_PI), waves[0], 1)*pans[0]*amps[0]*0.5;
if (phaseAccum<cycleSize*0.5) {
out += getBlendedPhase((phaseAccum/cycleSize)*(getBlendedPhase(phaseAccum/(cycleSize*2), waves[1], -1)*FMs[1])*(2*M_PI), waves[1], -1)*pans[1]*amps[1]*0.5*2;
out += getBlendedPhase((phaseAccum/cycleSize)*(getBlendedPhase(phaseAccum/(cycleSize*2), waves[2], -1)*FMs[2])*(2*M_PI), waves[2], -1)*pans[2]*amps[2]*0.5*2;
} else if (phaseAccum<cycleSize*0.75) {
out += getBlendedPhase((phaseAccum/cycleSize)*(getBlendedPhase(phaseAccum/(cycleSize*8), waves[3], 1)*FMs[3])*4*(2*M_PI), waves[3], 1)*pans[3]*amps[3]*0.5*2;
out += getBlendedPhase((phaseAccum/cycleSize)*(getBlendedPhase(phaseAccum/(cycleSize*8), waves[4], 1)*FMs[4])*8*(2*M_PI), waves[4], 1)*pans[4]*amps[4]*0.5*2;
} else {// if (phaseAccum<cycleSize*0.875) {
out += getBlendedPhase((phaseAccum/cycleSize)*(getBlendedPhase(phaseAccum/(cycleSize*8), waves[5], -1)*FMs[5])*16*(2*M_PI), waves[5], -1)*pans[5]*amps[5]*0.5*2;
}
phaseAccum++;
if (phaseAccum>cycleSize) {
phaseAccum = 0;
}

//calculate amplitude envelope
if (envPhase==0) {
//attack phase
env+=aCoeff * ((1.0/0.63) - env);
if (env>1.0) envPhase++;
} else if (envPhase==1) {
//decay and sustain phase

env+=dCoeff * (sustain - env);
} else {
//release phase
env += rCoeff * (1.0-(1.0/0.63) - env);
if (env<0.0) { playing = false; env = 0.0; }
}
//apply amplitude envelope
out*=env;

//apply master volume
out*=mAmp*0.5;
//apply hard clipping
if (out>1) out=1;
if (out<-1) out=-1;
}
return out;
}
void setSampleRate(float sr) {
sampleRate = sr;
attack = sampleRate/2;
decay = sampleRate/2;
release = sampleRate/2;
}


private:
/* vcf filter */
float waves[6];
float FMs[6];
float pans[6];
float amps[6];
float waveBlend;
float freq;
float freqOffset;
float tFreq; //target frequency for gliding
float glideDistance; //freq distance
float stereo;
float mAmp;
float phaseAccum;
float cycleSize;
float sampleRate;
float notePlaying;
float glide, gl;
bool playing;

float attack, decay, sustain, release;
float env;
float envPhase; //0, 1(d+s), 2
float aCoeff, dCoeff, rCoeff, gCoeff;
};

#endif // SYNTH_HXX_INCLUDED

+ 0
- 12540
source/modules/native-plugins/stereoenhancer/DistrhoArtworkStereoEnhancer.cpp
File diff suppressed because it is too large
View File


+ 0
- 35
source/modules/native-plugins/stereoenhancer/DistrhoArtworkStereoEnhancer.hpp View File

@@ -1,35 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORKSTEREOENHANCER_HPP
#define BINARY_DISTRHOARTWORKSTEREOENHANCER_HPP

namespace DistrhoArtworkStereoEnhancer
{
extern const char* aboutData;
const unsigned int aboutDataSize = 172710;
const unsigned int aboutWidth = 303;
const unsigned int aboutHeight = 190;

extern const char* aboutButtonHoverData;
const unsigned int aboutButtonHoverDataSize = 9152;
const unsigned int aboutButtonHoverWidth = 104;
const unsigned int aboutButtonHoverHeight = 22;

extern const char* aboutButtonNormalData;
const unsigned int aboutButtonNormalDataSize = 9152;
const unsigned int aboutButtonNormalWidth = 104;
const unsigned int aboutButtonNormalHeight = 22;

extern const char* backgroundData;
const unsigned int backgroundDataSize = 195024;
const unsigned int backgroundWidth = 478;
const unsigned int backgroundHeight = 136;

extern const char* knobData;
const unsigned int knobDataSize = 543036;
const unsigned int knobWidth = 59;
const unsigned int knobHeight = 2301;
}

#endif // BINARY_DISTRHOARTWORKSTEREOENHANCER_HPP


+ 0
- 35
source/modules/native-plugins/stereoenhancer/DistrhoPluginInfo.h View File

@@ -1,35 +0,0 @@
/*
* DISTRHO 3BandEQ Plugin, based on StereoEnhancer by Michael Gruhn
* Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the doc/LGPL.txt file.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "Stereo Enhancer"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2

#define DISTRHO_PLUGIN_WANT_LATENCY 0
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
#define DISTRHO_PLUGIN_WANT_STATE 0
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0

#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/StereoEnhancer"

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 0
- 211
source/modules/native-plugins/stereoenhancer/DistrhoPluginStereoEnhancer.cpp View File

@@ -1,211 +0,0 @@
/*
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the doc/LGPL.txt file.
*/
#include "DistrhoPluginStereoEnhancer.hpp"
#include <cmath>
static const float kDC_ADD = 1e-30f;
static const float kPI = 3.141592654f;
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPluginStereoEnhancer::DistrhoPluginStereoEnhancer()
: Plugin(paramCount, 1, 0) // 1 program, 0 states
{
// set default values
d_setProgram(0);
// reset
d_deactivate();
}
DistrhoPluginStereoEnhancer::~DistrhoPluginStereoEnhancer()
{
}
// -----------------------------------------------------------------------
// Init
void DistrhoPluginStereoEnhancer::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramWidthLows:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Width Lows";
parameter.symbol = "width_lows";
parameter.unit = "%";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 100.0f;
parameter.ranges.max = 200.0f;
break;
case paramWidthHighs:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "WidthHighs";
parameter.symbol = "width_highs";
parameter.unit = "%";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 100.0f;
parameter.ranges.max = 200.0f;
break;
case paramCrossover:
parameter.hints = PARAMETER_IS_AUTOMABLE;
parameter.name = "Crossover";
parameter.symbol = "crossover";
parameter.unit = "%";
parameter.ranges.def = 0.0f;
parameter.ranges.min = 27.51604f;
parameter.ranges.max = 100.0f;
break;
}
}
void DistrhoPluginStereoEnhancer::d_initProgramName(uint32_t index, d_string& programName)
{
if (index != 0)
return;
programName = "Default";
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPluginStereoEnhancer::d_getParameterValue(uint32_t index) const
{
switch (index)
{
case paramWidthLows:
return widthLP;
case paramWidthHighs:
return widthHP;
case paramCrossover:
return freqHP;
default:
return 0.0f;
}
}
void DistrhoPluginStereoEnhancer::d_setParameterValue(uint32_t index, float value)
{
if (d_getSampleRate() <= 0.0)
return;
switch (index)
{
case paramWidthLows:
widthLP = value;
widthCoeffLP = std::fmax(widthLP, 1.0f);
break;
case paramWidthHighs:
widthHP = value;
widthCoeffHP = std::fmax(widthHP, 1.0f);
break;
case paramCrossover:
freqHPFader = value;
freqHP = freqHPFader*freqHPFader*freqHPFader*24000.0f;
xHP = std::exp(-2.0f * kPI * freqHP / (float)d_getSampleRate());
a0HP = 1.0f-xHP;
b1HP = -xHP;
break;
}
}
void DistrhoPluginStereoEnhancer::d_setProgram(uint32_t index)
{
if (index != 0)
return;
// Default values
widthLP = 100.0f;
widthHP = 100.0f;
freqHPFader = 27.51604f;
// Internal stuff
widthCoeffLP = 1.0f;
widthCoeffHP = 1.0f;
freqHP = 500.0f;
// reset filter values
d_activate();
}
// -----------------------------------------------------------------------
// Process
void DistrhoPluginStereoEnhancer::d_activate()
{
xHP = std::exp(-2.0f * kPI * freqHP/ (float)d_getSampleRate());
a0HP = 1.0f-xHP;
b1HP = -xHP;
}
void DistrhoPluginStereoEnhancer::d_deactivate()
{
out1HP = out2HP = 0.0f;
tmp1HP = tmp2HP = 0.0f;
}
void DistrhoPluginStereoEnhancer::d_run(float** inputs, float** outputs, uint32_t frames)
{
float* in1 = inputs[0];
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
for (uint32_t i=0; i < frames; ++i)
{
out1HP = in1[i];
out2HP = in2[i];
in1[i] = (tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + kDC_ADD);
in2[i] = (tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + kDC_ADD);
out1HP -= in1[i] - kDC_ADD;
out2HP -= in2[i] - kDC_ADD;
monoLP = (in1[i] + in2[i]) / 2.0f;
stereoLP = in1[i] - in2[i];
(*in1) = (monoLP + stereoLP * widthLP) / widthCoeffLP;
(*in2) = (monoLP - stereoLP * widthLP) / widthCoeffLP;
monoHP = (out1HP + out2HP) / 2.0f;
stereoHP = out1HP - out2HP;
out1HP = (monoHP + stereoHP * widthHP) / widthCoeffHP;
out2HP = (monoHP - stereoHP * widthHP) / widthCoeffHP;
out1[i] = in1[i] + out1HP;
out2[i] = in2[i] + out2HP;
}
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPluginStereoEnhancer();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 0
- 110
source/modules/native-plugins/stereoenhancer/DistrhoPluginStereoEnhancer.hpp View File

@@ -1,110 +0,0 @@
/*
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de>
* Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the doc/LGPL.txt file.
*/
#ifndef DISTRHO_PLUGIN_STEREO_ENHANCER_HPP_INCLUDED
#define DISTRHO_PLUGIN_STEREO_ENHANCER_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPluginStereoEnhancer : public Plugin
{
public:
enum Parameters
{
paramWidthLows = 0,
paramWidthHighs,
paramCrossover,
paramCount
};
DistrhoPluginStereoEnhancer();
~DistrhoPluginStereoEnhancer() override;
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "StereoEnhancer";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
const char* d_getLicense() const noexcept override
{
return "LGPL";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
long d_getUniqueId() const noexcept override
{
return d_cconst('D', 'S', 't', 'E');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
// -------------------------------------------------------------------
private:
float widthLP, widthCoeffLP;
float freqHP, freqHPFader;
float widthHP, widthCoeffHP;
float xHP, a0HP, b1HP;
float out1HP, out2HP;
float tmp1HP, tmp2HP;
float monoHP, stereoHP;
float monoLP, stereoLP;
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_STEREO_ENHANCER_HPP_INCLUDED

+ 0
- 157
source/modules/native-plugins/stereoenhancer/DistrhoUIStereoEnhancer.cpp View File

@@ -1,157 +0,0 @@
/*
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn
* Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the doc/LGPL.txt file.
*/

#include "DistrhoUIStereoEnhancer.hpp"

using DGL::Point;

START_NAMESPACE_DISTRHO

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

DistrhoUIStereoEnhancer::DistrhoUIStereoEnhancer()
: UI(),
fAboutWindow(this)
{
// background
fImgBackground = Image(DistrhoArtworkStereoEnhancer::backgroundData, DistrhoArtworkStereoEnhancer::backgroundWidth, DistrhoArtworkStereoEnhancer::backgroundHeight, GL_BGR);

Image imageAbout(DistrhoArtworkStereoEnhancer::aboutData, DistrhoArtworkStereoEnhancer::aboutWidth, DistrhoArtworkStereoEnhancer::aboutHeight, GL_BGR);
fAboutWindow.setImage(imageAbout);

// knobs
Image knobImage(DistrhoArtworkStereoEnhancer::knobData, DistrhoArtworkStereoEnhancer::knobWidth, DistrhoArtworkStereoEnhancer::knobHeight);

fKnobWidthLows = new ImageKnob(this, knobImage);
fKnobWidthLows->setPos(140, 35);
fKnobWidthLows->setRange(0.0f, 200.0f);
fKnobWidthLows->setValue(100.0f);
fKnobWidthLows->setCallback(this);

fKnobWidthHighs = new ImageKnob(this, knobImage);
fKnobWidthHighs->setPos(362, 35);
fKnobWidthHighs->setRange(0.0f, 200.0f);
fKnobWidthHighs->setValue(100.0f);
fKnobWidthHighs->setCallback(this);

fKnobCrossover = new ImageKnob(this, knobImage);
fKnobCrossover->setPos(253, 35);
fKnobCrossover->setRange(0.0f, 100.0f);
fKnobCrossover->setValue(27.51604f);
fKnobCrossover->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtworkStereoEnhancer::aboutButtonNormalData, DistrhoArtworkStereoEnhancer::aboutButtonNormalWidth, DistrhoArtworkStereoEnhancer::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtworkStereoEnhancer::aboutButtonHoverData, DistrhoArtworkStereoEnhancer::aboutButtonHoverWidth, DistrhoArtworkStereoEnhancer::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setPos(346, 3);
fButtonAbout->setCallback(this);
}

DistrhoUIStereoEnhancer::~DistrhoUIStereoEnhancer()
{
delete fKnobWidthLows;
delete fKnobWidthHighs;
delete fKnobCrossover;
delete fButtonAbout;
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUIStereoEnhancer::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case DistrhoPluginStereoEnhancer::paramWidthLows:
fKnobWidthLows->setValue(value);
break;
case DistrhoPluginStereoEnhancer::paramWidthHighs:
fKnobWidthHighs->setValue(value);
break;
case DistrhoPluginStereoEnhancer::paramCrossover:
fKnobCrossover->setValue(value);
break;
}
}

void DistrhoUIStereoEnhancer::d_programChanged(uint32_t index)
{
if (index != 0)
return;

// Default values
fKnobWidthLows->setValue(100.0f);
fKnobWidthHighs->setValue(100.0f);
fKnobCrossover->setValue(27.51604f);
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUIStereoEnhancer::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void DistrhoUIStereoEnhancer::imageKnobDragStarted(ImageKnob* knob)
{
if (knob == fKnobWidthLows)
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthLows, true);
else if (knob == fKnobWidthHighs)
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthHighs, true);
else if (knob == fKnobCrossover)
d_editParameter(DistrhoPluginStereoEnhancer::paramCrossover, true);
}

void DistrhoUIStereoEnhancer::imageKnobDragFinished(ImageKnob* knob)
{
if (knob == fKnobWidthLows)
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthLows, false);
else if (knob == fKnobWidthHighs)
d_editParameter(DistrhoPluginStereoEnhancer::paramWidthHighs, false);
else if (knob == fKnobCrossover)
d_editParameter(DistrhoPluginStereoEnhancer::paramCrossover, false);
}

void DistrhoUIStereoEnhancer::imageKnobValueChanged(ImageKnob* knob, float value)
{
if (knob == fKnobWidthLows)
d_setParameterValue(DistrhoPluginStereoEnhancer::paramWidthLows, value);
else if (knob == fKnobWidthHighs)
d_setParameterValue(DistrhoPluginStereoEnhancer::paramWidthHighs, value);
else if (knob == fKnobCrossover)
d_setParameterValue(DistrhoPluginStereoEnhancer::paramCrossover, value);
}

void DistrhoUIStereoEnhancer::onDisplay()
{
fImgBackground.draw();
}

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

UI* createUI()
{
return new DistrhoUIStereoEnhancer();
}

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

END_NAMESPACE_DISTRHO

+ 0
- 90
source/modules/native-plugins/stereoenhancer/DistrhoUIStereoEnhancer.hpp View File

@@ -1,90 +0,0 @@
/*
* DISTRHO StereoEnhancer Plugin, based on StereoEnhancer by Michael Gruhn
* Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* For a full copy of the license see the doc/LGPL.txt file.
*/

#ifndef DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED
#define DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "dgl/ImageAboutWindow.hpp"
#include "dgl/ImageButton.hpp"
#include "dgl/ImageKnob.hpp"

#include "DistrhoArtworkStereoEnhancer.hpp"
#include "DistrhoPluginStereoEnhancer.hpp"

using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;

START_NAMESPACE_DISTRHO

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

class DistrhoUIStereoEnhancer : public UI,
public ImageButton::Callback,
public ImageKnob::Callback
{
public:
DistrhoUIStereoEnhancer();
~DistrhoUIStereoEnhancer() override;

protected:
// -------------------------------------------------------------------
// Information

unsigned int d_getWidth() const noexcept override
{
return DistrhoArtworkStereoEnhancer::backgroundWidth;
}

unsigned int d_getHeight() const noexcept override
{
return DistrhoArtworkStereoEnhancer::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageButtonClicked(ImageButton* button, int) override;
void imageKnobDragStarted(ImageKnob* knob) override;
void imageKnobDragFinished(ImageKnob* knob) override;
void imageKnobValueChanged(ImageKnob* knob, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ImageAboutWindow fAboutWindow;

ImageKnob* fKnobWidthLows;
ImageKnob* fKnobWidthHighs;
ImageKnob* fKnobCrossover;
ImageButton* fButtonAbout;
};

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

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED

BIN
source/modules/native-plugins/stereoenhancer/artwork/about.png View File

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

BIN
source/modules/native-plugins/stereoenhancer/artwork/aboutButtonHover.png View File

Before After
Width: 104  |  Height: 22  |  Size: 6.8KB

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save