Compare commits
No commits in common. "e452e282f441fcf99996919f09a6509851587cd8" and "4982d2701907dad67cceff8c82ef34ecac149708" have entirely different histories.
e452e282f4
...
4982d27019
|
|
@ -23,15 +23,6 @@
|
|||
#define DISTRHO_PLUGIN_NAME "peacock-8"
|
||||
#define DISTRHO_PLUGIN_URI "https://gjcp.net/plugins/peacock"
|
||||
|
||||
#define DISTRHO_PLUGIN_CLAP_ID "net.gjcp.peacock"
|
||||
#define DISTRHO_PLUGIN_CLAP_FEATURES "instrument","synthesizer","stereo"
|
||||
|
||||
#define DISTRHO_PLUGIN_BRAND_ID GJCP
|
||||
#define DISTRHO_PLUGIN_UNIQUE_ID Pfau
|
||||
|
||||
#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:InstrumentPlugin"
|
||||
#define DISTRHO_PLUGIN_VST_CATEGORY "Fx|Instrument"
|
||||
|
||||
#define DISTRHO_PLUGIN_NUM_INPUTS 0
|
||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
|
||||
#define DISTRHO_PLUGIN_IS_SYNTH 1
|
||||
|
|
@ -72,7 +63,7 @@
|
|||
pSustain,
|
||||
pRelease,
|
||||
|
||||
pChorusMode,
|
||||
pChorus,
|
||||
|
||||
parameterCount
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ include ../dpf/Makefile.plugins.mk
|
|||
|
||||
SKIP_NATIVE_AUDIO_FALLBACK = true
|
||||
|
||||
# omitting LV2 for the moment until I figure out cross-compiling
|
||||
TARGETS += jack vst2 vst3 clap
|
||||
TARGETS += jack lv2_sep
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
|
|
|||
30610
plugin/artwork.cpp
30610
plugin/artwork.cpp
File diff suppressed because it is too large
Load Diff
|
|
@ -43,12 +43,7 @@ Assigner::Assigner() {
|
|||
}
|
||||
|
||||
void Assigner::handleMidi(MidiEvent* ev) {
|
||||
|
||||
uint8_t status = ev->data[0];
|
||||
|
||||
//printf("called with event %04x (%02x): %02x %02x %02x\n", ev->frame, ev->size, ev->data[0], ev->data[1], ev->data[2]);
|
||||
if (ev->size > 3) return; // sysex bug
|
||||
|
||||
switch (status & 0xf0) {
|
||||
case 0x80:
|
||||
noteOff(ev->data[1]);
|
||||
|
|
@ -115,10 +110,6 @@ void Assigner::noteOn(uint8_t note) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ((noteTbl[voiceTbl[0]] & 0x80)) {
|
||||
m->lfoRampOn();
|
||||
}
|
||||
|
||||
// loop around the voices
|
||||
for (i = NUM_VOICES - 1; i >= 0; i--) {
|
||||
v = voiceTbl[i];
|
||||
|
|
@ -146,6 +137,6 @@ void Assigner::noteOn(uint8_t note) {
|
|||
// printf("at end, l=%d e=%d\n", l,e);
|
||||
noteTbl[v] = note;
|
||||
|
||||
d_debug("send voice on %3d to voice %d", note, i);
|
||||
d_debug("send voice on %3d to voice %d", note, v);
|
||||
voice[v].on(note);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ class Assigner {
|
|||
Assigner();
|
||||
void handleMidi(MidiEvent* ev);
|
||||
Voice* voice;
|
||||
Module *m;
|
||||
|
||||
private:
|
||||
void noteOn(uint8_t note); // incoming note on (or off, if velocity = 0)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
#include "chorus.hpp"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
Chorus::Chorus() {
|
||||
lpfOut1 = new float[bufferSize];
|
||||
lpfOut2 = new float[bufferSize];
|
||||
|
|
@ -29,8 +29,7 @@ Chorus::Chorus() {
|
|||
lfoPhase = 1;
|
||||
lfoSpeed = 6.283 * 10.7 / sampleRate; // plainly silly value to show if it hasn't been set
|
||||
|
||||
gainTC = 1 - exp(-6.283 * 10 / sampleRate); // 1/10th of a second declick
|
||||
bbdTC = 1 - exp(-6.283 * 30 / sampleRate); // hpf into BBD at 159Hz
|
||||
gainTC = 1 - exp(-6.283 * 10 / sampleRate);
|
||||
|
||||
// not quite Butterworth but you'd never hear the difference
|
||||
// these are calculated from the real-world component values
|
||||
|
|
@ -59,7 +58,7 @@ void Chorus::run(float* input, float** outputs, uint32_t frames) {
|
|||
// run highpass / bass boost and stereo chorus effect for one full block
|
||||
|
||||
float s0 = 0, s1 = 0;
|
||||
float dly1, frac, flt;
|
||||
float lfoMod, dly1, frac, flt;
|
||||
uint16_t tap, delay;
|
||||
|
||||
for (uint32_t i = 0; i < frames; i++) {
|
||||
|
|
@ -76,14 +75,11 @@ void Chorus::run(float* input, float** outputs, uint32_t frames) {
|
|||
hpDelay = flt;
|
||||
input[i] += (flt * hpGain);
|
||||
|
||||
flt = ((input[i] - bbdRC) * bbdTC) + bbdRC;
|
||||
bbdRC = flt;
|
||||
|
||||
ram[delayptr] = input[i] - flt;
|
||||
ram[delayptr] = input[i];
|
||||
|
||||
// delays in milliseconds
|
||||
#define BASE 0.0035
|
||||
#define AMT 0.002
|
||||
#define BASE 0.005
|
||||
#define AMT 0.00175
|
||||
|
||||
dly1 = (BASE + (AMT * lfoPhase)) * sampleRate;
|
||||
delay = (int)dly1;
|
||||
|
|
@ -106,6 +102,7 @@ void Chorus::run(float* input, float** outputs, uint32_t frames) {
|
|||
delayptr++;
|
||||
delayptr &= 0x3ff;
|
||||
}
|
||||
|
||||
postFilter1l->runSVF(lpfOut1, lpfOut1, frames);
|
||||
postFilter2l->runSVF(lpfOut1, lpfOut1, frames);
|
||||
postFilter1r->runSVF(lpfOut2, lpfOut2, frames);
|
||||
|
|
@ -114,6 +111,7 @@ void Chorus::run(float* input, float** outputs, uint32_t frames) {
|
|||
for (uint32_t i = 0; i < frames; i++) {
|
||||
float y = input[i];
|
||||
gainRC = (gain - gainRC) * gainTC + gainRC;
|
||||
|
||||
outputs[0][i] = y + (gainRC * lpfOut1[i]);
|
||||
outputs[1][i] = y + (gainRC * lpfOut2[i]);
|
||||
}
|
||||
|
|
@ -149,16 +147,15 @@ void Chorus::setChorus(uint8_t mode) {
|
|||
// switch chorus mode
|
||||
switch (mode) {
|
||||
case 0x60:
|
||||
case 0x20:
|
||||
gain = 0;
|
||||
break;
|
||||
case 0x40:
|
||||
gain = 1.2;
|
||||
lfoSpeed = 6.283 * 0.525 / sampleRate / 2;
|
||||
lfoSpeed = 6.283 * 0.5 / sampleRate;
|
||||
break;
|
||||
case 0x00:
|
||||
gain = 1.2;
|
||||
lfoSpeed = 6.283 * 0.85 / sampleRate / 2;
|
||||
lfoSpeed = 6.283 * 0.9 / sampleRate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ class Chorus {
|
|||
float gainRC = 0;
|
||||
float gainTC = 0;
|
||||
|
||||
float bbdRC=0, bbdTC=0;
|
||||
|
||||
|
||||
uint16_t delayptr = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ Module::Module() {
|
|||
vcaBuf = new float[bufferSize];
|
||||
subBuf = new float[bufferSize];
|
||||
pwmBuf = new float[bufferSize];
|
||||
noiseBuf = new float[bufferSize];
|
||||
}
|
||||
|
||||
Module::~Module() {
|
||||
|
|
@ -41,117 +40,59 @@ Module::~Module() {
|
|||
delete subBuf;
|
||||
delete pwmBuf;
|
||||
}
|
||||
|
||||
void Module::genNoise() {
|
||||
for (uint32_t i = 0; i < bufferSize; i++) {
|
||||
noiseRNG *= 0x8088405;
|
||||
noiseRNG++;
|
||||
noiseBuf[i] = 2 - (noiseRNG & 0xffff) / 16384.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Module::lfoRampOn() {
|
||||
lfoDelayState = 1;
|
||||
lfoDelayTimer = 0;
|
||||
lfoDelay = 0;
|
||||
}
|
||||
|
||||
void Module::runLFO() {
|
||||
if (lfoDelayState == 1) {
|
||||
lfoDelayTimer += attackTable[patchRam.lfoDelay];
|
||||
if (lfoDelayTimer > 0x3fff) lfoDelayState = 2;
|
||||
}
|
||||
if ((lfoDelayState == 2)) {
|
||||
lfoDelay += lfoDelayTable[patchRam.lfoDelay >> 4];
|
||||
}
|
||||
|
||||
if (lfoDelay > 0xff) {
|
||||
lfoDelayState = 0;
|
||||
lfoDelay = 0xff;
|
||||
}
|
||||
|
||||
lfoRate = lfoRateTable[patchRam.lfoRate]; // FIXME move to parameters
|
||||
|
||||
lfoPhase += (lfoState & 0x01) ? -lfoRate : lfoRate;
|
||||
if (lfoPhase > 0x1fff) {
|
||||
lfoPhase = 0x1fff;
|
||||
lfoState++;
|
||||
}
|
||||
if (lfoPhase < 0x0000) {
|
||||
lfoPhase = 0x0000;
|
||||
lfoState++;
|
||||
}
|
||||
lfo = (lfoState & 0x02) ? -lfoPhase : lfoPhase;
|
||||
|
||||
pw = (lfoState & 0x02) ? lfoPhase + 0x2000 : 0x2000 - lfoPhase; // PW LFO is unipolar
|
||||
pw = (patchRam.switch2 & 0x01) ? 0x3fff : pw; // either LFO or "all on"
|
||||
pw = 0x3fff - ((pw * patchRam.pwmLfo) >> 7); // scaled by PWM pot
|
||||
}
|
||||
|
||||
void Module::run(Voice* voices, uint32_t blockSize) {
|
||||
// run updates for module board
|
||||
|
||||
int16_t lfoToVco = 0, lfoToVcf = 0;
|
||||
|
||||
// FIXME break these out to the patch setter
|
||||
a = attackTable[patchRam.env_a]; // attack time coeff looked up in table
|
||||
d = decayTable[patchRam.env_d]; // decay time coeff looked up in table
|
||||
r = decayTable[patchRam.env_r]; // release time coeff looked up in table
|
||||
s = patchRam.env_s << 7; // scale 0x00-0x7f to 0x0000-0x3f80
|
||||
|
||||
master = powf(2, (patchRam.vca / 31.75 - 4.0f)) * 0.1;
|
||||
square = (patchRam.switch1 & 0x08) ? 0.63 : 0;
|
||||
saw = (patchRam.switch1 & 0x10) ? 0.8 : 0;
|
||||
sub = patchRam.sub / 127.0f;
|
||||
lfoPhase += lfoRateTable[patchRam.lfoRate];
|
||||
|
||||
// originally I had 0.28, 0.36, 0.4
|
||||
// measurement suggests that saw and square are around 100mV each with sub 160mV
|
||||
|
||||
square = (patchRam.switch1 & 0x08) ? 0.3 : 0;
|
||||
saw = (patchRam.switch1 & 0x10) ? .3 : 0;
|
||||
sub = (patchRam.sub / 127.0f) * 0.48;
|
||||
|
||||
res = patchRam.vcfReso / 127.0;
|
||||
noise = (patchRam.noise / 127.0) * 0.4;
|
||||
res = patchRam.vcfReso / 127.0 * 5;
|
||||
noise = patchRam.noise / 127.0;
|
||||
|
||||
// FIXME the exp in these is expensive, don't call it all the time
|
||||
chorus->setChorus(patchRam.switch1 & 0x60);
|
||||
chorus->setHpf(patchRam.switch2 & 0x18);
|
||||
|
||||
runLFO();
|
||||
if (lfoPhase & 0x4000)
|
||||
lfo = 0x1fff - (lfoPhase & 0x3fff);
|
||||
else
|
||||
lfo = (lfoPhase & 0x3fff) - 0x1fff;
|
||||
|
||||
// FIXME represent PW as int until we calculate the block?
|
||||
pw = 0.5 - ((0x2000 + lfo) * patchRam.pwmLfo) / (32768.0f * 128);
|
||||
pw = (patchRam.switch2 & 0x01) ? 0.5 - (patchRam.pwmLfo / 256.0f) : pw;
|
||||
|
||||
float master = powf(2, (patchRam.vca / 31.75 - 4.0f));
|
||||
float sub = patchRam.sub/ 127.0f;
|
||||
|
||||
// calculate "smoothed" parameters
|
||||
// these are single outputs with heavy RC smoothing
|
||||
for (uint32_t i = 0; i < blockSize; i++) {
|
||||
vcaRC = (master - vcaRC) * subTC + vcaRC;
|
||||
pwmRC = ((pw / 32768.0f) - pwmRC) * pwmTC + pwmRC;
|
||||
pwmRC = (pw - pwmRC) * pwmTC + pwmRC;
|
||||
subRC = (sub - subRC) * vcaTC + subRC;
|
||||
|
||||
vcaBuf[i] = vcaRC;
|
||||
pwmBuf[i] = pwmRC;
|
||||
subBuf[i] = subRC;
|
||||
|
||||
|
||||
if (bufPtr < bufferSize) bufPtr++;
|
||||
}
|
||||
|
||||
lfoToVco = (lfoDepthTable[patchRam.vcoLfo] * lfoDelay) >> 8; // lookup table is 0-255
|
||||
lfoToVco += /* lfo from modwheel FIXME */ 0;
|
||||
if (lfoToVco > 0xff) lfoToVco = 0xff;
|
||||
lfoToVco = (lfo * lfoToVco) >> 11; // 8 for normalisation plus three additional DSLR EA
|
||||
int16_t vcf = (patchRam.vcfEnv << 7) * ((patchRam.switch2 & 0x02) ? -1 : 1);
|
||||
|
||||
lfoToVcf = (patchRam.vcfLfo * lfoDelay) >> 7; // value is 0-127
|
||||
lfoToVcf = (lfo * lfoToVcf) >> 9; // 8 for normalisation plus one additional DSLR EA
|
||||
int16_t pitchBase = 0x1818;
|
||||
pitchBase += (lfo * lfoDepthTable[patchRam.vcoLfo]) >> 9;
|
||||
|
||||
int16_t pitchBase = 0x1818, vcfBase = 0;
|
||||
pitchBase += lfoToVco;
|
||||
pitchBase += /* pitch bend FIXME */ 0;
|
||||
|
||||
// int16_t vcf = (patchRam.vcfEnv << 7) * ((patchRam.switch2 & 0x02) ? -1 : 1);
|
||||
vcfBase = (patchRam.vcfFreq << 7) + /* vcf bend FIXME */ 0;
|
||||
vcfBase += lfoToVcf;
|
||||
if (vcfBase > 0x3fff) vcfBase = 0x3fff;
|
||||
if (vcfBase < 0x0000) vcfBase = 0x0000;
|
||||
|
||||
// per-voice calculations
|
||||
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||
// run one step of the envelope
|
||||
// maybe move all this into voice.cpp FIXME
|
||||
Voice* v = &voices[i];
|
||||
switch (v->envPhase) {
|
||||
case 0: // release phase FIXME use an enum I guess
|
||||
|
|
@ -170,22 +111,21 @@ void Module::run(Voice* voices, uint32_t blockSize) {
|
|||
}
|
||||
|
||||
// pitch
|
||||
uint16_t pitch = pitchBase + (v->note << 8);
|
||||
uint8_t semi = pitch >> 8;
|
||||
// FIXME clean this all up a bit
|
||||
int16_t pitch = pitchBase + (v->note << 8);
|
||||
int16_t semi = pitch >> 8;
|
||||
float frac = (pitch & 0xff) / 256.0;
|
||||
|
||||
float p1 = pitchTable[semi], p2 = pitchTable[semi + 1];
|
||||
int16_t px = ((p2 - p1) * frac + p1); // interpolated pitch from table
|
||||
int16_t px = ((p2 - p1) * frac + p1);
|
||||
|
||||
// octave divider
|
||||
px *= (patchRam.switch1 & 0x07);
|
||||
|
||||
v->omega = px / (sampleRate * 8.0f); // FIXME recalculate table using proper scaler
|
||||
v->omega = px / (sampleRate * 4.0f); // fixme use proper scaler
|
||||
|
||||
// per voice we need to calculate the key follow amount and envelope amount
|
||||
v->vcfCut = vcfBase + (((v->env * patchRam.vcfEnv)>>7) * ((patchRam.switch1 & 0x02) ? -1 : 1));
|
||||
|
||||
v->vcfCut += (int)((v->note - 36) * (patchRam.vcfKey << 1) * 0.375);
|
||||
v->vcfCut = (patchRam.vcfFreq << 7) + ((vcf * v->env) >> 14);
|
||||
v->vcfCut += (int)(v->note * (patchRam.vcfKey << 1) * 0.375);
|
||||
|
||||
if (v->vcfCut > 0x3fff) v->vcfCut = 0x3fff;
|
||||
if (v->vcfCut < 0) v->vcfCut = 0;
|
||||
|
|
|
|||
|
|
@ -33,85 +33,40 @@ class Module {
|
|||
Module();
|
||||
~Module();
|
||||
|
||||
void genNoise();
|
||||
void lfoRampOn();
|
||||
void run(Voice* voices, uint32_t blockLeft);
|
||||
|
||||
float res = 0;
|
||||
// precomputed values for all voices
|
||||
float pw; //, saw, square, sub;
|
||||
|
||||
// "internal state" values for patch parameters
|
||||
uint16_t a, d, s, r;
|
||||
int16_t lfo;
|
||||
uint32_t lfoPhase;
|
||||
|
||||
float saw = 0, square = 0, sub = 0, noise = 0, master = 0;
|
||||
float saw = 0, square = 0, sub = 0, noise = 0;
|
||||
|
||||
/*
|
||||
#if 0
|
||||
struct {
|
||||
uint8_t lfoRate = 0x58;
|
||||
uint8_t lfoDelay = 0x00;
|
||||
uint8_t vcoLfo = 0x00;
|
||||
uint8_t pwmLfo = 0x3b;
|
||||
uint8_t noise = 0x00;
|
||||
uint8_t vcfFreq = 0x25; // 1c; // 0x3f80
|
||||
uint8_t vcfReso = 0x6a;
|
||||
uint8_t vcfEnv = 0x25; // 4e;
|
||||
uint8_t vcfLfo = 0x00;
|
||||
uint8_t vcfKey = 0x00; // 47;
|
||||
uint8_t vca = 0x35;
|
||||
uint8_t env_a = 0x00;
|
||||
uint8_t env_d = 0x3c;
|
||||
uint8_t env_s = 0x00; // 0x3f80
|
||||
uint8_t env_r = 0x3c;
|
||||
uint8_t sub = 0x7f;
|
||||
uint8_t switch1 = 0x4a;
|
||||
uint8_t switch2 = 0x18;
|
||||
} patchRam;
|
||||
|
||||
#else
|
||||
struct {
|
||||
uint8_t lfoRate = 0x40;
|
||||
uint8_t lfoDelay = 0x00;
|
||||
uint8_t vcoLfo = 0x00;
|
||||
uint8_t pwmLfo = 0x00;
|
||||
uint8_t noise = 0x01;
|
||||
uint8_t vcfFreq = 0x31;
|
||||
uint8_t vcfReso = 0x7f;
|
||||
uint8_t vcfEnv = 0x00;
|
||||
uint8_t vcfLfo = 0x00;
|
||||
uint8_t vcfKey = 0x7f;
|
||||
uint8_t vca = 0x40;
|
||||
uint8_t env_a = 0x00;
|
||||
uint8_t env_d = 0x00;
|
||||
uint8_t env_s = 0x00; // 0x3f80
|
||||
uint8_t env_r = 0x00;
|
||||
uint8_t sub = 0x00;
|
||||
uint8_t switch1 = 0x22;
|
||||
uint8_t switch2 = 0x1d;
|
||||
} patchRam;
|
||||
#endif
|
||||
*/
|
||||
|
||||
struct {
|
||||
uint8_t lfoRate = 0x1f;
|
||||
uint8_t lfoRate = 0x18;
|
||||
uint8_t lfoDelay = 0x00;
|
||||
uint8_t vcoLfo = 0x00;
|
||||
uint8_t pwmLfo = 0x3c;
|
||||
uint8_t pwmLfo = 0x60;
|
||||
uint8_t noise = 0x00;
|
||||
uint8_t vcfFreq = 0x25; // 1c; // 0x3f80
|
||||
uint8_t vcfReso = 0x1d;
|
||||
uint8_t vcfEnv = 0x1c; // 4e;
|
||||
uint8_t vcfLfo = 0x00;
|
||||
uint8_t vcfKey = 0x2b; // 47;
|
||||
uint8_t vca = 0x5c;
|
||||
uint8_t vcfFreq = 0x30; // 1c; // 0x3f80
|
||||
uint8_t vcfReso = 0x00;
|
||||
uint8_t vcfEnv = 0x40; // 4e;
|
||||
uint8_t vcfLfo = 0;
|
||||
uint8_t vcfKey = 0x7f; // 47;
|
||||
uint8_t vca = 0x28;
|
||||
uint8_t env_a = 0x00;
|
||||
uint8_t env_d = 0x2a;
|
||||
uint8_t env_s = 0x23; // 0x3f80
|
||||
uint8_t env_r = 0x00;
|
||||
uint8_t env_d = 0x39;
|
||||
uint8_t env_s = 0x30; // 0x3f80
|
||||
uint8_t env_r = 0x30;
|
||||
uint8_t sub = 0x40;
|
||||
uint8_t switch1 = 0x19;
|
||||
uint8_t switch1 = 0x59;
|
||||
uint8_t switch2 = 0x18;
|
||||
} patchRam;
|
||||
|
||||
Chorus* chorus;
|
||||
|
||||
float vcaTC;
|
||||
|
|
@ -120,25 +75,13 @@ class Module {
|
|||
float* vcaBuf;
|
||||
float* subBuf;
|
||||
float* pwmBuf;
|
||||
float* noiseBuf;
|
||||
|
||||
private:
|
||||
void runLFO();
|
||||
|
||||
// precalculated coefficients for RC networks
|
||||
float pwmTC = 0, subTC = 0, mVcaTC = 0;
|
||||
float pwmRC = 0, subRC = 0, vcaRC = 0;
|
||||
|
||||
int16_t lfo, pw;
|
||||
int16_t lfoPhase;
|
||||
uint8_t lfoState = 0;
|
||||
uint16_t lfoRate;
|
||||
|
||||
uint32_t noiseRNG = 1;
|
||||
|
||||
uint16_t lfoDelay = 0;
|
||||
uint8_t lfoDelayState = 0;
|
||||
uint16_t lfoDelayTimer = 0;
|
||||
// controls
|
||||
};
|
||||
|
||||
class Voice {
|
||||
|
|
@ -148,7 +91,7 @@ class Voice {
|
|||
Voice();
|
||||
void on(uint8_t midiNote);
|
||||
void off();
|
||||
void run(Module* m, float* buffer, uint32_t framePos, uint32_t samples);
|
||||
void run(Module* m, float* buffer, uint32_t samples);
|
||||
|
||||
private:
|
||||
float omega = 0, theta = 0; // phase increment and angle FIXME better names
|
||||
|
|
@ -156,16 +99,16 @@ class Voice {
|
|||
uint8_t pulseStage = 1; // pulse wave phase
|
||||
float subosc = 1; // sub oscillator flipflop output
|
||||
|
||||
uint8_t envPhase = 0; // current running state of envelope
|
||||
int16_t env = 0; // calculated envelope amount
|
||||
int16_t vcfCut; // calculated cutoff to filter
|
||||
int16_t vcaEnv; // calculated level to VCA (env/gate)
|
||||
float vcaRC = 0, vcfRC = 0; // RC circuit state values
|
||||
uint8_t envPhase = 0;
|
||||
int16_t env = 0; // output amplitude
|
||||
int16_t vcfCut;
|
||||
int16_t vcaEnv;
|
||||
float vcaRC = 0, vcfRC = 0;
|
||||
|
||||
uint8_t note = 0;
|
||||
|
||||
// filter
|
||||
float y0 = 0, y1 = 0, y2 = 0, y3 = 0;
|
||||
float b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pLFORate:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "LFO Rate";
|
||||
parameter.symbol = "pfau_lforate";
|
||||
parameter.symbol = "ch_lforate";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 48.0f;
|
||||
|
|
@ -33,7 +33,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pLFODelay:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "LFO Delay";
|
||||
parameter.symbol = "pfau_lfodelay";
|
||||
parameter.symbol = "ch_lfodelay";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -43,7 +43,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pVCORange:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
||||
parameter.name = "Range";
|
||||
parameter.symbol = "pfau_vcorange";
|
||||
parameter.symbol = "ch_vcorange";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 2.0f;
|
||||
parameter.ranges.def = 1.0f;
|
||||
|
|
@ -65,7 +65,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pLFODepth:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "LFO";
|
||||
parameter.symbol = "pfau_lfo";
|
||||
parameter.symbol = "ch_lfo";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 10.0f;
|
||||
|
|
@ -75,7 +75,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pPWMDepth:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "PWM";
|
||||
parameter.symbol = "pfau_pwm";
|
||||
parameter.symbol = "ch_pwm";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 48.0f;
|
||||
|
|
@ -85,7 +85,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pPWMMode:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||
parameter.name = "PWM Mode";
|
||||
parameter.symbol = "pfau_pwmmode";
|
||||
parameter.symbol = "ch_pwmmode";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 1.0f;
|
||||
parameter.ranges.def = 1.0f;
|
||||
|
|
@ -106,7 +106,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pSaw:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||
parameter.name = "Saw";
|
||||
parameter.symbol = "pfau_saw";
|
||||
parameter.symbol = "ch_saw";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 1.0f;
|
||||
parameter.ranges.def = 1.0f;
|
||||
|
|
@ -116,7 +116,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pSqr:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsBoolean;
|
||||
parameter.name = "Square";
|
||||
parameter.symbol = "pfau_sqr";
|
||||
parameter.symbol = "ch_sqr";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 1.0f;
|
||||
parameter.ranges.def = 1.0f;
|
||||
|
|
@ -126,7 +126,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pSubLevel:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Sub Osc";
|
||||
parameter.symbol = "pfau_sub";
|
||||
parameter.symbol = "ch_sub";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -136,7 +136,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pNoiseLevel:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Noise";
|
||||
parameter.symbol = "pfau_noise";
|
||||
parameter.symbol = "ch_noise";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -146,7 +146,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pHPF:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
||||
parameter.name = "HPF";
|
||||
parameter.symbol = "pfau_hpf";
|
||||
parameter.symbol = "ch_hpf";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 3.9f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -156,7 +156,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pCutoff:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Freq";
|
||||
parameter.symbol = "pfau_freq";
|
||||
parameter.symbol = "ch_freq";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 60.0f;
|
||||
|
|
@ -165,7 +165,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pRes:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Res";
|
||||
parameter.symbol = "pfau_reso";
|
||||
parameter.symbol = "ch_reso";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -174,7 +174,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pVCFPol:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
||||
parameter.name = "Polarity";
|
||||
parameter.symbol = "pfau_vcfmode";
|
||||
parameter.symbol = "ch_vcfmode";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 1.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -194,7 +194,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pEnv:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Env";
|
||||
parameter.symbol = "pfau_vcfenv";
|
||||
parameter.symbol = "ch_vcfenv";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 46.0f;
|
||||
|
|
@ -203,7 +203,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pLfo:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "LFO";
|
||||
parameter.symbol = "pfau_vcflfo";
|
||||
parameter.symbol = "ch_vcflfo";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -212,7 +212,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pKyb:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Kybd";
|
||||
parameter.symbol = "pfau_vcfkey";
|
||||
parameter.symbol = "ch_vcfkey";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 71.0f;
|
||||
|
|
@ -222,7 +222,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pAttack:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Attack";
|
||||
parameter.symbol = "pfau_attack";
|
||||
parameter.symbol = "ch_attack";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 27.0f;
|
||||
|
|
@ -232,7 +232,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pDecay:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Decay";
|
||||
parameter.symbol = "pfau_decay";
|
||||
parameter.symbol = "ch_decay";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 57.0f;
|
||||
|
|
@ -242,7 +242,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pSustain:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Sustain";
|
||||
parameter.symbol = "pfau_sustain";
|
||||
parameter.symbol = "ch_sustain";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 57.0f;
|
||||
|
|
@ -252,7 +252,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pRelease:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "Release";
|
||||
parameter.symbol = "pfau_release";
|
||||
parameter.symbol = "ch_release";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 48.0f;
|
||||
|
|
@ -262,7 +262,7 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pEnvGate:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsInteger; // | kParameterIsBoolean;
|
||||
parameter.name = "Env-Gate";
|
||||
parameter.symbol = "pfau_envgate";
|
||||
parameter.symbol = "ch_envgate";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 1.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -282,38 +282,39 @@ void Peacock::initParameter(uint32_t index, Parameter& parameter) {
|
|||
case pVCALevel:
|
||||
parameter.hints = kParameterIsAutomatable;
|
||||
parameter.name = "VCA Level";
|
||||
parameter.symbol = "pfau_vcalevel";
|
||||
parameter.symbol = "ch_vcalevel";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 40.0f;
|
||||
parameter.midiCC = 26;
|
||||
break;
|
||||
|
||||
case pChorusMode:
|
||||
case pChorus:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsInteger;
|
||||
parameter.name = "Chorus";
|
||||
parameter.symbol = "pfau_chorus";
|
||||
parameter.symbol = "ch_chorus";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 2.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
parameter.ranges.def = 1.0f;
|
||||
parameter.midiCC = 93;
|
||||
parameter.enumValues.count = 3;
|
||||
parameter.enumValues.restrictedMode = true;
|
||||
{
|
||||
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[3];
|
||||
enumValues[0].value = 0.0f;
|
||||
enumValues[0].label = "Off";
|
||||
enumValues[0].label = "Off'";
|
||||
enumValues[1].value = 1.0f;
|
||||
enumValues[1].label = "Slow";
|
||||
enumValues[2].value = 2.0f;
|
||||
enumValues[2].label = "Fast";
|
||||
parameter.enumValues.values = enumValues;
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case pModWheel:
|
||||
parameter.hints = kParameterIsAutomatable | kParameterIsHidden;
|
||||
parameter.name = "Mod wheel";
|
||||
parameter.symbol = "pfau_modwheel";
|
||||
parameter.symbol = "ch_modwheel";
|
||||
parameter.ranges.min = 0.0f;
|
||||
parameter.ranges.max = 127.0f;
|
||||
parameter.ranges.def = 0.0f;
|
||||
|
|
@ -399,7 +400,7 @@ void Peacock::setParameterValue(uint32_t index, float value) {
|
|||
m->patchRam.switch1 |= (value >= 0.5) << 4;
|
||||
break;
|
||||
|
||||
case pChorusMode:
|
||||
case pChorus:
|
||||
m->patchRam.switch1 &= 0x9f;
|
||||
switch ((int)value) {
|
||||
case 0:
|
||||
|
|
@ -525,7 +526,8 @@ float Peacock::getParameterValue(uint32_t index) const {
|
|||
case pVCALevel:
|
||||
return m->patchRam.vca;
|
||||
break;
|
||||
case pChorusMode:
|
||||
case pChorus:
|
||||
|
||||
switch (m->patchRam.switch1 & 0x60) {
|
||||
case 0x60:
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ Peacock::Peacock() : Plugin(parameterCount, 0, 0) {
|
|||
m = new Module();
|
||||
ic1 = new Assigner;
|
||||
ic1->voice = voice;
|
||||
ic1->m = m;
|
||||
m->chorus = chorus;
|
||||
}
|
||||
|
||||
|
|
@ -70,27 +69,27 @@ void Peacock::run(const float**, float** outputs, uint32_t frames, const MidiEve
|
|||
memset(outputs[0], 0, frames * sizeof(float));
|
||||
memset(outputs[1], 0, frames * sizeof(float));
|
||||
|
||||
m->genNoise();
|
||||
|
||||
// if there were any events that happen between now and the end of this block, process them
|
||||
lastEvent = 0;
|
||||
m->bufPtr = 0; // reset the output buffer pointer
|
||||
m->bufPtr = 0;
|
||||
runMidi(midiEvents, midiEventCount, blockLeft);
|
||||
|
||||
while (framePos < frames) {
|
||||
if (blockLeft == 0) {
|
||||
// no more samples to calculate in this update period
|
||||
blockLeft = sampleRate / 233.5; // update rate in Hz, measured
|
||||
blockLeft = sampleRate / 238; // update rate in Hz
|
||||
runMidi(midiEvents, midiEventCount, framePos + blockLeft);
|
||||
m->run(voice, blockLeft);
|
||||
|
||||
}
|
||||
|
||||
// how many frames to do? Are we about to run off an update block
|
||||
sizeThisTime = (framesLeft < blockLeft) ? framesLeft : blockLeft;
|
||||
m->run(voice, sizeThisTime);
|
||||
|
||||
|
||||
// now run all the voices for this chunk of samples
|
||||
for (uint32_t i = 0; i < NUM_VOICES; i++) {
|
||||
voice[i].run(m, outputs[0], framePos, sizeThisTime);
|
||||
voice[i].run(m, outputs[0] + framePos, sizeThisTime);
|
||||
}
|
||||
|
||||
framePos += sizeThisTime;
|
||||
|
|
@ -99,7 +98,7 @@ void Peacock::run(const float**, float** outputs, uint32_t frames, const MidiEve
|
|||
}
|
||||
|
||||
// now we've assembled a full chunk of audio
|
||||
// memcpy(outputs[0], m->vcaBuf, sizeof(float)* frames);
|
||||
//memcpy(outputs[0], m->vcaBuf, sizeof(float)* frames);
|
||||
chorus->run(outputs[0], outputs, frames);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -258,20 +258,18 @@ void DistrhoUIPeacock::parameterChanged(uint32_t index, float value) {
|
|||
sw1 &= 0xf8; // mask
|
||||
if (value > 2) value = 2;
|
||||
sw1 |= (1 << (int)value);
|
||||
repaint();
|
||||
xBtn16ft->repaint(); // will repaint all the panel
|
||||
break;
|
||||
case pSqr:
|
||||
sw1 &= 0xf7;
|
||||
sw1 |= ((value >= 0.5)) << 3;
|
||||
repaint();
|
||||
break;
|
||||
case pSaw:
|
||||
sw1 &= 0xef;
|
||||
sw1 |= (value > 0.5) << 4;
|
||||
repaint();
|
||||
break;
|
||||
|
||||
case pChorusMode:
|
||||
case pChorus:
|
||||
sw1 &= 0x9f;
|
||||
// 60, 40, 00
|
||||
switch ((int)value) {
|
||||
|
|
@ -285,8 +283,6 @@ void DistrhoUIPeacock::parameterChanged(uint32_t index, float value) {
|
|||
sw1 |= 0x00;
|
||||
break;
|
||||
}
|
||||
repaint();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -330,21 +326,20 @@ void DistrhoUIPeacock::imageButtonClicked(ImageButton* imgBtn, int) {
|
|||
break;
|
||||
case btnCh0:
|
||||
sw1 = (sw1 & 0x9f) | 0x20;
|
||||
setParameterValue(pChorusMode, 0);
|
||||
setParameterValue(pChorus, 0);
|
||||
break;
|
||||
case btnCh1:
|
||||
sw1 = (sw1 & 0x9f) | 0x40;
|
||||
setParameterValue(pChorusMode, 1);
|
||||
setParameterValue(pChorus, 1);
|
||||
break;
|
||||
case btnCh2:
|
||||
sw1 = (sw1 & 0x9f);
|
||||
setParameterValue(pChorusMode, 2);
|
||||
setParameterValue(pChorus, 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
void DistrhoUIPeacock::onDisplay() {
|
||||
|
|
|
|||
|
|
@ -40,9 +40,11 @@ Voice::Voice() {
|
|||
}
|
||||
|
||||
void Voice::on(uint8_t midiNote) {
|
||||
while (midiNote < 24) midiNote += 12;
|
||||
while (midiNote > 108) midiNote -= 12;
|
||||
note = midiNote - 24;
|
||||
// omega = 261.63 * powf(2, (note - 60) / 12.0f) / 48000.0f;
|
||||
if (midiNote > 24)
|
||||
note = midiNote - 24;
|
||||
else
|
||||
note = 24;
|
||||
envPhase = 1;
|
||||
}
|
||||
|
||||
|
|
@ -50,27 +52,15 @@ void Voice::off() {
|
|||
envPhase = 0;
|
||||
}
|
||||
|
||||
// tanh(x)/x approximation, flatline at very high inputs
|
||||
// so might not be safe for very large feedback gains
|
||||
// [limit is 1/15 so very large means ~15 or +23dB]
|
||||
|
||||
float tanhXdX(float x) {
|
||||
return 1 - 0.05 * abs(x);
|
||||
float s = 0.0333, d = 30.0;
|
||||
return 1.0f - s * (d + 1.0f) * x * x / (d + x * x);
|
||||
}
|
||||
|
||||
void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) {
|
||||
void Voice::run(Module* m, float* buffer, uint32_t samples) {
|
||||
// carry out per-voice calculations for each block of samples
|
||||
float out, t, fb;
|
||||
|
||||
// FIXME incorrect
|
||||
// calculate cutoff frequency
|
||||
float cut = 261.0f * (powf(2, (vcfCut - 0x1880) / 1143.0f)); // FIXME explain magic numbers
|
||||
cut = M_PI * cut / sampleRate;
|
||||
cut = cut / (1 + cut); // correct tuning warp
|
||||
if (cut > 0.7) cut = 0.7;
|
||||
|
||||
float r = 5 * m->res;
|
||||
float cut = 248.0f * (powf(2, (vcfCut - 0x1880) / 1143.0f));
|
||||
cut = 0.25 * 6.2832 * cut / 48000.0f; // FIXME hardcoded values
|
||||
cut = cut / (1 + cut); // correct tuning warp
|
||||
|
||||
float amp = vcaEnv / 4096.0f;
|
||||
|
||||
|
|
@ -104,31 +94,36 @@ void Voice::run(Module* m, float* buffer, uint32_t framePos, uint32_t samples) {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME DC offset removal
|
||||
delay += m->saw * (1 - (2 * theta));
|
||||
delay += m->square * ((pulseStage ? -1.f : 1.f) - m->pwmBuf[i] + 0.5);
|
||||
delay += m->subBuf[i] * subosc;
|
||||
delay += m->subBuf[i] * subosc ;
|
||||
|
||||
out += m->noise * m->noiseBuf[i + framePos];
|
||||
out += m->noise * (0.8 - 1.6 * (rand() & 0xffff) / 65536.0);
|
||||
out *= 0.5;
|
||||
|
||||
// same time constant for both VCF and VCF RC circuits
|
||||
vcfRC = (cut - vcfRC) * m->vcaTC + vcfRC;
|
||||
|
||||
for (uint8_t ovs = 0; ovs < 2; ovs++) {
|
||||
fb = y3;
|
||||
for (uint8_t ovs = 0; ovs < 4; ovs++) {
|
||||
fb = b4;
|
||||
// hard clip
|
||||
fb = ((out * 0.5) - fb) * r;
|
||||
if (fb > 2) fb = 2;
|
||||
if (fb < -2) fb = -2;
|
||||
fb = ((out * 0.5) - fb) * m->res;
|
||||
if (fb > 4) fb = 4;
|
||||
if (fb < -4) fb = -4;
|
||||
// fb = 1.5 * fb - 0.5 * fb * fb * fb;
|
||||
//
|
||||
|
||||
y0 = ((out + fb - y0) * vcfRC) + y0;
|
||||
y1 = ((y0 - y1) * vcfRC) + y1;
|
||||
y2 = ((y1 - y2) * vcfRC) + y2;
|
||||
y3 = ((y2 - y3) * vcfRC) + y3;
|
||||
b1 = ((out + fb - b1) * vcfRC) + b1;
|
||||
b2 = ((b1 - b2) * vcfRC) + b2;
|
||||
b3 = ((b2 - b3) * vcfRC) + b3;
|
||||
b4 = ((b3 - b4) * vcfRC) + b4;
|
||||
}
|
||||
|
||||
vcaRC = (amp - vcaRC) * m->vcaTC + vcaRC;
|
||||
buffer[framePos + i] += m->vcaBuf[i] * vcaRC * y3;
|
||||
buffer[i] += 0.09367 * m->vcaBuf[i] * vcaRC * b4;
|
||||
|
||||
lastpw = m->pwmBuf[i];
|
||||
}
|
||||
// buffer[0] += 1; // buzzing noise to test
|
||||
// buffer[0] += 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue