workingish highpass filter
This commit is contained in:
parent
1c8f451c3a
commit
cdca13f412
@ -159,6 +159,27 @@ void Chassis::run(const float **, float **outputs, uint32_t frames, const MidiEv
|
|||||||
s.blockLeft -= sizeThisTime;
|
s.blockLeft -= sizeThisTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// highpass filter
|
||||||
|
|
||||||
|
float tmp = s.hptmp;
|
||||||
|
float smp, flt=0;
|
||||||
|
float cut_tbl[4] = {0.91245, 0.97097, 1, 0.99088};
|
||||||
|
float cut = cut_tbl[(s.patchRam.switch2 & 0x18) >> 3];
|
||||||
|
float gain_tbl[4] = {-1, -1, 0, 4};
|
||||||
|
float gain = gain_tbl[(s.patchRam.switch2 & 0x18) >> 3];
|
||||||
|
|
||||||
|
// printf("hp= %02x\n", (s.patchRam.switch2 & 0x18)>>3);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < frames; i++) {
|
||||||
|
smp = outputs[0][i];
|
||||||
|
|
||||||
|
flt = ((tmp - smp) * cut) + smp;
|
||||||
|
tmp = flt;
|
||||||
|
outputs[0][i] = ((flt * gain) + smp);
|
||||||
|
}
|
||||||
|
s.hptmp = flt;
|
||||||
|
|
||||||
|
|
||||||
// copy left to right
|
// copy left to right
|
||||||
memmove(outputs[1], outputs[0], sizeof(float) * frames);
|
memmove(outputs[1], outputs[0], sizeof(float) * frames);
|
||||||
// outputs[1][1]=1;
|
// outputs[1][1]=1;
|
||||||
|
@ -149,7 +149,7 @@ void Chassis::initParameter(uint32_t index, Parameter& parameter) {
|
|||||||
parameter.name = "HPF";
|
parameter.name = "HPF";
|
||||||
parameter.symbol = "ch_hpf";
|
parameter.symbol = "ch_hpf";
|
||||||
parameter.ranges.min = 0.0f;
|
parameter.ranges.min = 0.0f;
|
||||||
parameter.ranges.max = 3.0f;
|
parameter.ranges.max = 3.9f;
|
||||||
parameter.ranges.def = 0.0f;
|
parameter.ranges.def = 0.0f;
|
||||||
parameter.midiCC = 20;
|
parameter.midiCC = 20;
|
||||||
break;
|
break;
|
||||||
@ -397,9 +397,10 @@ void Chassis::setParameterValue(uint32_t index, float value) {
|
|||||||
|
|
||||||
case paramHPF: // bits 3-4 of switch 2
|
case paramHPF: // bits 3-4 of switch 2
|
||||||
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
// doesn't look great in Carla because of odd behaviour with small integer knobs
|
||||||
|
printf("setPV %d %f\n", index, value);
|
||||||
if (value > 3) value = 3;
|
if (value > 3) value = 3;
|
||||||
s.patchRam.switch2 &= 0xf3;
|
s.patchRam.switch2 &= 0xe7;
|
||||||
s.patchRam.switch2 |= (int)value << 3;
|
s.patchRam.switch2 |= (3-(int)value )<< 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case paramModWheel:
|
case paramModWheel:
|
||||||
@ -452,7 +453,7 @@ float Chassis::getParameterValue(uint32_t index) const {
|
|||||||
return s.patchRam.noise;
|
return s.patchRam.noise;
|
||||||
break;
|
break;
|
||||||
case paramHPF:
|
case paramHPF:
|
||||||
return (s.patchRam.switch2 & 0x18) >> 3;
|
return 3-((s.patchRam.switch2 & 0x18) >> 3);
|
||||||
break;
|
break;
|
||||||
case paramVCFFreq:
|
case paramVCFFreq:
|
||||||
return s.patchRam.vcfFreq;
|
return s.patchRam.vcfFreq;
|
||||||
|
@ -133,6 +133,7 @@ class Synth {
|
|||||||
} patchRam;
|
} patchRam;
|
||||||
|
|
||||||
float pitchCV[104];
|
float pitchCV[104];
|
||||||
|
float hptmp;
|
||||||
|
|
||||||
void runLFO();
|
void runLFO();
|
||||||
void lfoDelay();
|
void lfoDelay();
|
||||||
|
Loading…
Reference in New Issue
Block a user