filter changes, add rest of parameters
This commit is contained in:
parent
81b17f1a0a
commit
d054c99eb1
|
@ -24,17 +24,9 @@
|
||||||
|
|
||||||
#include "DistrhoPluginInfo.h"
|
#include "DistrhoPluginInfo.h"
|
||||||
|
|
||||||
Generator::Generator(uint32_t bufferSize) {
|
Generator::Generator(uint32_t bufferSize, float sampleRate) {
|
||||||
output = new float[bufferSize];
|
output = new float[bufferSize];
|
||||||
|
// create the phase increments for each semitone
|
||||||
}
|
|
||||||
|
|
||||||
Generator::~Generator() {
|
|
||||||
delete output;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Generator::setupGenerator(double sampleRate) {
|
|
||||||
// create the phase increments for each semitone
|
|
||||||
for (uint8_t i = 0; i < 12; i++) {
|
for (uint8_t i = 0; i < 12; i++) {
|
||||||
phase[i] = 0;
|
phase[i] = 0;
|
||||||
uint32_t f;
|
uint32_t f;
|
||||||
|
@ -43,6 +35,10 @@ void Generator::setupGenerator(double sampleRate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Generator::~Generator() {
|
||||||
|
delete output;
|
||||||
|
}
|
||||||
|
|
||||||
void Generator::runBlock(uint8_t *noteTable, uint32_t frames) {
|
void Generator::runBlock(uint8_t *noteTable, uint32_t frames) {
|
||||||
Voice *v;
|
Voice *v;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -69,23 +65,20 @@ void Generator::runBlock(uint8_t *noteTable, uint32_t frames) {
|
||||||
v->vc78 = ((n - v->vc78) * v->c78) + v->vc78;
|
v->vc78 = ((n - v->vc78) * v->c78) + v->vc78;
|
||||||
v->vc107 = ((v->vc78 - v->vc107) * v->c107) + v->vc107;
|
v->vc107 = ((v->vc78 - v->vc107) * v->c107) + v->vc107;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
d = (phase[n1] & (0x80000000 >> n2)) != 0;
|
d = (phase[n1] & (0x80000000 >> n2)) != 0;
|
||||||
n = d ? 0.25 : -0.25;
|
n = d ? 0.25 : -0.25;
|
||||||
v->vc33 = ((n - v->vc33) * v->c33) + v->vc33;
|
v->vc33 = ((n - v->vc33) * v->c33) + v->vc33;
|
||||||
n -= v->vc33;
|
n -= v->vc33;
|
||||||
n *= d ? 1 : 0;
|
n *= d ? 1 : 0;
|
||||||
v->vc22 = ((n - v->vc22) * v->c22) + v->vc22;
|
v->vc22 = ((n - v->vc22) * v->c22) + v->vc22;
|
||||||
v->vc31 = ((v->vc31 - v->vc31) * v->c31) + v->vc31;
|
v->vc31 = ((v->vc22 - v->vc31) * v->c31) + v->vc31;
|
||||||
|
|
||||||
|
|
||||||
v->vca = ((v->gate - v->vca) * v->vcatc) + v->vca;
|
v->vca = ((v->gate - v->vca) * v->vcatc) + v->vca;
|
||||||
|
|
||||||
float v4 = (v->vc78 - v->vc107);
|
float v4 = (v->vc78 - v->vc107);
|
||||||
float v8 = (v->vc22 - v->vc31);
|
float v8 = (v->vc22 - v->vc31);
|
||||||
|
|
||||||
output[i] += (v4 + v8) * v->vca; //((noteTable[k]&0x80)?0:1);
|
output[i] += 0.25* (v4 + v8) * v->vca; //((noteTable[k]&0x80)?0:1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,18 +88,17 @@ void Voice::startNote(uint8_t key, double sampleRate) {
|
||||||
// violin and viola filter params
|
// violin and viola filter params
|
||||||
float fc = 88.4 * powf(2, 0.083334 * (key - 24));
|
float fc = 88.4 * powf(2, 0.083334 * (key - 24));
|
||||||
c34 = 1 - exp(-6.283 * fc / sampleRate);
|
c34 = 1 - exp(-6.283 * fc / sampleRate);
|
||||||
c33 = 1 - exp(-6.283 * fc /2 / sampleRate);
|
c33 = 1 - exp(-6.283 * fc / 2 / sampleRate);
|
||||||
|
|
||||||
// violin register
|
// violin register
|
||||||
fc = 4000 * powf(2, 0.06 * (key - 24));
|
fc = 4000 + 65.8 * powf(2, 0.08 * (key - 24));
|
||||||
c78 = 1 - exp(-6.283 * fc / sampleRate);
|
c78 = 1 - exp(-6.283 * fc / sampleRate);
|
||||||
c107 = 1 - exp(-6.283 * 154.0 / sampleRate);
|
c107 = 1 - exp(-6.283 * 154.0 / sampleRate);
|
||||||
|
|
||||||
// viola register
|
// viola register
|
||||||
fc = 6000 * powf(2, 0.07 * (key - 24));
|
fc = 3000 + 65.8 * powf(2, 0.07 * (key - 24));
|
||||||
c22 = 1 - exp(-6.283 * fc / sampleRate);
|
c22 = 1 - exp(-6.283 * fc / sampleRate);
|
||||||
c31 = 1 - exp(-6.283 * 54.0 / sampleRate);
|
c31 = 1 - exp(-6.283 * 150.0 / sampleRate);
|
||||||
|
|
||||||
|
|
||||||
gate = 1;
|
gate = 1;
|
||||||
vcatc = 0.0001;
|
vcatc = 0.0001;
|
||||||
|
|
|
@ -45,9 +45,8 @@ class Voice {
|
||||||
|
|
||||||
class Generator {
|
class Generator {
|
||||||
public:
|
public:
|
||||||
Generator(uint32_t bufferSize);
|
Generator(uint32_t bufferSize, float sampleRate);
|
||||||
~Generator();
|
~Generator();
|
||||||
void setupGenerator(double sampleRate);
|
|
||||||
void runBlock(uint8_t *noteTable, uint32_t frames);
|
void runBlock(uint8_t *noteTable, uint32_t frames);
|
||||||
Voice voices[NUM_VOICES];
|
Voice voices[NUM_VOICES];
|
||||||
float *output;
|
float *output;
|
||||||
|
|
|
@ -21,6 +21,20 @@
|
||||||
void Sonnenlicht::initParameter(uint32_t index, Parameter& parameter) {
|
void Sonnenlicht::initParameter(uint32_t index, Parameter& parameter) {
|
||||||
// define all the different control input parameters
|
// define all the different control input parameters
|
||||||
switch (index) {
|
switch (index) {
|
||||||
|
case pContraBass:
|
||||||
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||||
|
parameter.name = "Contrabass";
|
||||||
|
parameter.symbol = "s_contra";
|
||||||
|
parameter.ranges.def = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case pCello:
|
||||||
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||||
|
parameter.name = "Cello";
|
||||||
|
parameter.symbol = "s_cello";
|
||||||
|
parameter.ranges.def = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
case pViola:
|
case pViola:
|
||||||
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||||
parameter.name = "Viola";
|
parameter.name = "Viola";
|
||||||
|
@ -35,6 +49,26 @@ void Sonnenlicht::initParameter(uint32_t index, Parameter& parameter) {
|
||||||
parameter.ranges.def = 1;
|
parameter.ranges.def = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case pTrumpet:
|
||||||
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||||
|
parameter.name = "Trumpet";
|
||||||
|
parameter.symbol = "s_trumpet";
|
||||||
|
parameter.ranges.def = 0;
|
||||||
|
break;
|
||||||
|
case pHorn:
|
||||||
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||||
|
parameter.name = "Horn";
|
||||||
|
parameter.symbol = "s_horn";
|
||||||
|
parameter.ranges.def = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case pChorale:
|
||||||
|
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||||
|
parameter.name = "Chorale";
|
||||||
|
parameter.symbol = "s_chorale";
|
||||||
|
parameter.ranges.def = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case pBassVolume:
|
case pBassVolume:
|
||||||
parameter.hints = kParameterIsAutomatable;
|
parameter.hints = kParameterIsAutomatable;
|
||||||
parameter.name = "Bass Volume";
|
parameter.name = "Bass Volume";
|
||||||
|
@ -43,6 +77,22 @@ void Sonnenlicht::initParameter(uint32_t index, Parameter& parameter) {
|
||||||
parameter.ranges.max = 1.0f;
|
parameter.ranges.max = 1.0f;
|
||||||
parameter.ranges.def = 0.7f;
|
parameter.ranges.def = 0.7f;
|
||||||
break;
|
break;
|
||||||
|
case pAttack:
|
||||||
|
parameter.hints = kParameterIsAutomatable;
|
||||||
|
parameter.name = "Attack";
|
||||||
|
parameter.symbol = "s_attack";
|
||||||
|
parameter.ranges.min = 0.0f;
|
||||||
|
parameter.ranges.max = 1.0f;
|
||||||
|
parameter.ranges.def = 0.7f;
|
||||||
|
break;
|
||||||
|
case pSustain:
|
||||||
|
parameter.hints = kParameterIsAutomatable;
|
||||||
|
parameter.name = "Sustain";
|
||||||
|
parameter.symbol = "s_sustain";
|
||||||
|
parameter.ranges.min = 0.0f;
|
||||||
|
parameter.ranges.max = 1.0f;
|
||||||
|
parameter.ranges.def = 0.7f;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,8 @@
|
||||||
START_NAMESPACE_DISTRHO
|
START_NAMESPACE_DISTRHO
|
||||||
|
|
||||||
Sonnenlicht::Sonnenlicht() : Plugin(kParameterCount, 0, 0), fSampleRate(getSampleRate()) {
|
Sonnenlicht::Sonnenlicht() : Plugin(kParameterCount, 0, 0), fSampleRate(getSampleRate()) {
|
||||||
genny = new Generator(getBufferSize());
|
genny = new Generator(getBufferSize(), fSampleRate);
|
||||||
genny->setupGenerator(fSampleRate);
|
|
||||||
|
|
||||||
assigner = new Assigner(genny->voices);
|
assigner = new Assigner(genny->voices);
|
||||||
|
|
||||||
chorus = new Chorus(getBufferSize(), fSampleRate);
|
chorus = new Chorus(getBufferSize(), fSampleRate);
|
||||||
|
|
|
@ -29,9 +29,16 @@ START_NAMESPACE_DISTRHO
|
||||||
class Sonnenlicht : public Plugin {
|
class Sonnenlicht : public Plugin {
|
||||||
public:
|
public:
|
||||||
enum Parameters {
|
enum Parameters {
|
||||||
|
pContraBass,
|
||||||
|
pCello,
|
||||||
|
pBassVolume,
|
||||||
|
pAttack,
|
||||||
|
pSustain,
|
||||||
pViola,
|
pViola,
|
||||||
pViolin,
|
pViolin,
|
||||||
pBassVolume,
|
pTrumpet,
|
||||||
|
pHorn,
|
||||||
|
pChorale,
|
||||||
kParameterCount
|
kParameterCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue