Browse Source

plugin.hpp is intended for shared plugin-wide symbols so Common.hpp is redundant.

tags/v1.1.0^2
Andrew Belt 3 years ago
parent
commit
a9a0e4d314
15 changed files with 113 additions and 131 deletions
  1. +0
    -1
      src/ABC.cpp
  2. +0
    -1
      src/ChoppingKinky.cpp
  3. +3
    -1
      src/ChowDSP.hpp
  4. +0
    -112
      src/Common.hpp
  5. +0
    -1
      src/DualAtenuverter.cpp
  6. +0
    -1
      src/EvenVCO.cpp
  7. +0
    -1
      src/HexmixVCA.cpp
  8. +0
    -1
      src/Kickall.cpp
  9. +0
    -1
      src/Mixer.cpp
  10. +0
    -1
      src/Percall.cpp
  11. +1
    -4
      src/PulseGenerator_4.hpp
  12. +0
    -1
      src/Rampage.cpp
  13. +0
    -1
      src/SlewLimiter.cpp
  14. +1
    -3
      src/SpringReverb.cpp
  15. +108
    -1
      src/plugin.hpp

+ 0
- 1
src/ABC.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"


using simd::float_4; using simd::float_4;




+ 0
- 1
src/ChoppingKinky.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"
#include "ChowDSP.hpp" #include "ChowDSP.hpp"


+ 3
- 1
src/ChowDSP.hpp View File

@@ -1,4 +1,6 @@
#pragma once #pragma once
#include <rack.hpp>
namespace chowdsp { namespace chowdsp {
// code taken from https://github.com/jatinchowdhury18/ChowDSP-VCV/blob/master/src/shared/, commit 21701fb // code taken from https://github.com/jatinchowdhury18/ChowDSP-VCV/blob/master/src/shared/, commit 21701fb
@@ -417,4 +419,4 @@ private:
BaseOversampling* oss[NumOS] = { &os0, &os1, &os2, &os3, &os4 }; BaseOversampling* oss[NumOS] = { &os0, &os1, &os2, &os3, &os4 };
}; };
}
} // namespace chowdsp

+ 0
- 112
src/Common.hpp View File

@@ -1,112 +0,0 @@
#pragma once

#include <rack.hpp>
#include <dsp/common.hpp>

struct BefacoTinyKnobRed : app::SvgKnob {
BefacoTinyKnobRed() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg")));
}
};

struct BefacoTinyKnobWhite : app::SvgKnob {
BefacoTinyKnobWhite() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg")));
}
};

struct BefacoTinyKnobGrey : app::SvgKnob {
BefacoTinyKnobGrey() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobGrey.svg")));
}
};

struct Davies1900hLargeGreyKnob : Davies1900hKnob {
Davies1900hLargeGreyKnob() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hLargeGrey.svg")));
}
};

struct BefacoOutputPort : app::SvgPort {
BefacoOutputPort() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg")));
}
};

struct BefacoInputPort : app::SvgPort {
BefacoInputPort() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoInputPort.svg")));
}
};

template <typename T>
T sin2pi_pade_05_5_4(T x) {
x -= 0.5f;
return (T(-6.283185307) * x + T(33.19863968) * simd::pow(x, 3) - T(32.44191367) * simd::pow(x, 5))
/ (1 + T(1.296008659) * simd::pow(x, 2) + T(0.7028072946) * simd::pow(x, 4));
}

template <typename T>
T tanh_pade(T x) {
T x2 = x * x;
T q = 12.f + x2;
return 12.f * x * q / (36.f * x2 + q * q);
}


struct ADEnvelope {

enum Stage {
STAGE_OFF,
STAGE_ATTACK,
STAGE_DECAY
};

Stage stage = STAGE_OFF;
float env = 0.f;
float attackTime = 0.1, decayTime = 0.1;
float attackShape = 1.0, decayShape = 1.0;

ADEnvelope() { };

void process(const float& sampleTime) {

if (stage == STAGE_OFF) {
env = envLinear = 0.0f;
}
else if (stage == STAGE_ATTACK) {
envLinear += sampleTime / attackTime;
env = std::pow(envLinear, attackShape);
}
else if (stage == STAGE_DECAY) {
envLinear -= sampleTime / decayTime;
env = std::pow(envLinear, decayShape);
}

if (envLinear >= 1.0f) {
stage = STAGE_DECAY;
env = envLinear = 1.0f;
}
else if (envLinear <= 0.0f) {
stage = STAGE_OFF;
env = envLinear = 0.0f;
}
}

void trigger() {
stage = ADEnvelope::STAGE_ATTACK;
// non-linear envelopes won't retrigger at the correct starting point if
// attackShape != decayShape, so we advance the linear envelope
envLinear = std::pow(env, 1.0f / attackShape);
}

private:
float envLinear = 0.f;

};

+ 0
- 1
src/DualAtenuverter.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"


struct DualAtenuverter : Module { struct DualAtenuverter : Module {
enum ParamIds { enum ParamIds {


+ 0
- 1
src/EvenVCO.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"


using simd::float_4; using simd::float_4;




+ 0
- 1
src/HexmixVCA.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"
using simd::float_4; using simd::float_4;


+ 0
- 1
src/Kickall.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"
#include "ChowDSP.hpp" #include "ChowDSP.hpp"


+ 0
- 1
src/Mixer.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"


using simd::float_4; using simd::float_4;




+ 0
- 1
src/Percall.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"
using simd::float_4; using simd::float_4;


+ 1
- 4
src/PulseGenerator_4.hpp View File

@@ -1,11 +1,9 @@
#pragma once #pragma once

#include "rack.hpp"
#include <rack.hpp>




/** When triggered, holds a high value for a specified time before going low again */ /** When triggered, holds a high value for a specified time before going low again */
struct PulseGenerator_4 { struct PulseGenerator_4 {

simd::float_4 remaining = simd::float_4::zero(); simd::float_4 remaining = simd::float_4::zero();


/** Immediately disables the pulse */ /** Immediately disables the pulse */
@@ -29,4 +27,3 @@ struct PulseGenerator_4 {
remaining = ifelse(mask & (duration_4 > remaining), duration_4, remaining); remaining = ifelse(mask & (duration_4 > remaining), duration_4, remaining);
} }
}; };


+ 0
- 1
src/Rampage.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"
#include "PulseGenerator_4.hpp" #include "PulseGenerator_4.hpp"


using simd::float_4; using simd::float_4;


+ 0
- 1
src/SlewLimiter.cpp View File

@@ -1,5 +1,4 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "Common.hpp"


using simd::float_4; using simd::float_4;




+ 1
- 3
src/SpringReverb.cpp View File

@@ -1,7 +1,5 @@
#include <string.h>
#include "plugin.hpp" #include "plugin.hpp"
#include "pffft.h"
#include "Common.hpp"
#include <pffft.h>


BINARY(src_SpringReverbIR_pcm); BINARY(src_SpringReverbIR_pcm);




+ 108
- 1
src/plugin.hpp View File

@@ -1,4 +1,4 @@
#include "rack.hpp"
#include <rack.hpp>




using namespace rack; using namespace rack;
@@ -18,6 +18,7 @@ extern Model *modelHexmixVCA;
extern Model *modelChoppingKinky; extern Model *modelChoppingKinky;
extern Model *modelKickall; extern Model *modelKickall;



struct Knurlie : SvgScrew { struct Knurlie : SvgScrew {
Knurlie() { Knurlie() {
sw->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/Knurlie.svg")); sw->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/Knurlie.svg"));
@@ -25,3 +26,109 @@ struct Knurlie : SvgScrew {
box.size = sw->box.size; box.size = sw->box.size;
} }
}; };

struct BefacoTinyKnobRed : app::SvgKnob {
BefacoTinyKnobRed() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg")));
}
};

struct BefacoTinyKnobWhite : app::SvgKnob {
BefacoTinyKnobWhite() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg")));
}
};

struct BefacoTinyKnobGrey : app::SvgKnob {
BefacoTinyKnobGrey() {
minAngle = -0.8 * M_PI;
maxAngle = 0.8 * M_PI;
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobGrey.svg")));
}
};

struct Davies1900hLargeGreyKnob : Davies1900hKnob {
Davies1900hLargeGreyKnob() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hLargeGrey.svg")));
}
};

struct BefacoOutputPort : app::SvgPort {
BefacoOutputPort() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg")));
}
};

struct BefacoInputPort : app::SvgPort {
BefacoInputPort() {
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoInputPort.svg")));
}
};

template <typename T>
T sin2pi_pade_05_5_4(T x) {
x -= 0.5f;
return (T(-6.283185307) * x + T(33.19863968) * simd::pow(x, 3) - T(32.44191367) * simd::pow(x, 5))
/ (1 + T(1.296008659) * simd::pow(x, 2) + T(0.7028072946) * simd::pow(x, 4));
}

template <typename T>
T tanh_pade(T x) {
T x2 = x * x;
T q = 12.f + x2;
return 12.f * x * q / (36.f * x2 + q * q);
}


struct ADEnvelope {
enum Stage {
STAGE_OFF,
STAGE_ATTACK,
STAGE_DECAY
};

Stage stage = STAGE_OFF;
float env = 0.f;
float attackTime = 0.1, decayTime = 0.1;
float attackShape = 1.0, decayShape = 1.0;

ADEnvelope() { };

void process(const float& sampleTime) {

if (stage == STAGE_OFF) {
env = envLinear = 0.0f;
}
else if (stage == STAGE_ATTACK) {
envLinear += sampleTime / attackTime;
env = std::pow(envLinear, attackShape);
}
else if (stage == STAGE_DECAY) {
envLinear -= sampleTime / decayTime;
env = std::pow(envLinear, decayShape);
}

if (envLinear >= 1.0f) {
stage = STAGE_DECAY;
env = envLinear = 1.0f;
}
else if (envLinear <= 0.0f) {
stage = STAGE_OFF;
env = envLinear = 0.0f;
}
}

void trigger() {
stage = ADEnvelope::STAGE_ATTACK;
// non-linear envelopes won't retrigger at the correct starting point if
// attackShape != decayShape, so we advance the linear envelope
envLinear = std::pow(env, 1.0f / attackShape);
}

private:
float envLinear = 0.f;
};

Loading…
Cancel
Save