messy highpass filter
This commit is contained in:
parent
ecc1c82c99
commit
6f7f9340f1
|
|
@ -55,14 +55,14 @@ Chorus::~Chorus() {
|
||||||
delete postFilter2r;
|
delete postFilter2r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chorus::run(const float* input, float** outputs, uint32_t frames) {
|
void Chorus::run(float* input, float** outputs, uint32_t frames) {
|
||||||
// actual effects here
|
// actual effects here
|
||||||
|
|
||||||
// FIXME add highpass filter
|
// FIXME add highpass filter
|
||||||
|
|
||||||
// now run the DSP
|
// now run the DSP
|
||||||
float s0 = 0, s1 = 0;
|
float s0 = 0, s1 = 0;
|
||||||
float lfoMod, dly1, frac;
|
float lfoMod, dly1, frac, flt;
|
||||||
uint16_t tap, delay;
|
uint16_t tap, delay;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < frames; i++) {
|
for (uint32_t i = 0; i < frames; i++) {
|
||||||
|
|
@ -70,6 +70,10 @@ void Chorus::run(const float* input, float** outputs, uint32_t frames) {
|
||||||
fastPhase += fastOmega;
|
fastPhase += fastOmega;
|
||||||
if (fastPhase > 6.283) fastPhase -= 6.283;
|
if (fastPhase > 6.283) fastPhase -= 6.283;
|
||||||
|
|
||||||
|
flt = ((hpdelay - input[i]) * hpcut) + input[i];
|
||||||
|
hpdelay = flt;
|
||||||
|
input[i] += (flt * hpgain);
|
||||||
|
|
||||||
ram[delayptr] = input[i];
|
ram[delayptr] = input[i];
|
||||||
|
|
||||||
#define BASE 0.005
|
#define BASE 0.005
|
||||||
|
|
@ -115,6 +119,24 @@ void Chorus::run(const float* input, float** outputs, uint32_t frames) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chorus::setHpf(uint8_t mode) {
|
void Chorus::setHpf(uint8_t mode) {
|
||||||
|
switch (mode) {
|
||||||
|
case 0x00:
|
||||||
|
hpcut = 0.91245;
|
||||||
|
hpgain = -1;
|
||||||
|
break;
|
||||||
|
case 0x08:
|
||||||
|
hpcut = 0.97097;
|
||||||
|
hpgain = -1;
|
||||||
|
break;
|
||||||
|
case 0x10:
|
||||||
|
hpcut = 1;
|
||||||
|
hpgain = 0;
|
||||||
|
break;
|
||||||
|
case 0x18:
|
||||||
|
hpcut = 0.99088;
|
||||||
|
hpgain = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chorus::setChorus(uint8_t mode) {
|
void Chorus::setChorus(uint8_t mode) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class Chorus {
|
||||||
public:
|
public:
|
||||||
Chorus();
|
Chorus();
|
||||||
~Chorus();
|
~Chorus();
|
||||||
void run(const float* input, float** outputs, uint32_t frames);
|
void run( float* input, float** outputs, uint32_t frames);
|
||||||
void setHpf(uint8_t mode);
|
void setHpf(uint8_t mode);
|
||||||
void setChorus(uint8_t mode);
|
void setChorus(uint8_t mode);
|
||||||
|
|
||||||
|
|
@ -47,6 +47,8 @@ class Chorus {
|
||||||
float* lpfIn;
|
float* lpfIn;
|
||||||
float *lpfOut1, *lpfOut2;
|
float *lpfOut1, *lpfOut2;
|
||||||
|
|
||||||
|
float hpdelay=0, hpcut=0, hpgain=1;
|
||||||
|
|
||||||
SVF *postFilter1l, *postFilter2l, *postFilter1r, *postFilter2r;
|
SVF *postFilter1l, *postFilter2l, *postFilter1r, *postFilter2r;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ void Module::run(Voice* voice) {
|
||||||
noise = patchRam.noise / 127.0;
|
noise = patchRam.noise / 127.0;
|
||||||
|
|
||||||
chorus->setChorus(patchRam.switch1 & 0x60);
|
chorus->setChorus(patchRam.switch1 & 0x60);
|
||||||
|
chorus->setHpf(patchRam.switch2 & 0x18);
|
||||||
|
|
||||||
if (lfoPhase & 0x4000)
|
if (lfoPhase & 0x4000)
|
||||||
lfo = 0x1fff - (lfoPhase & 0x3fff);
|
lfo = 0x1fff - (lfoPhase & 0x3fff);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue