plugin cutoff range

This commit is contained in:
Gordon JC Pearce 2023-06-20 14:40:11 +01:00
parent f0bc568030
commit bb5e064e1a
3 changed files with 406 additions and 393 deletions

View File

@ -164,13 +164,13 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.midiCC = 75;
break;
case paramCutoff:
parameter.hints = kParameterIsAutomatable; // modified x2.5
parameter.hints = kParameterIsAutomatable;
parameter.name = "Cutoff";
parameter.symbol = "cutoff";
parameter.unit = "%";
parameter.ranges.def = 25.0f;
parameter.ranges.def = 63.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 100.0f;
parameter.ranges.max = 127.0f;
parameter.midiCC = 74;
break;
case paramResonance:
@ -270,8 +270,8 @@ void DistrhoPluginNekobi::setParameterValue(uint32_t index, float value)
break;
case paramCutoff:
fParams.cutoff = value;
fSynth.cutoff = value/2.5f;
DISTRHO_SAFE_ASSERT(fSynth.cutoff >= 0.0f && fSynth.cutoff <= 40.0f);
fSynth.cutoff = value;
DISTRHO_SAFE_ASSERT(fSynth.cutoff >= 0.0f && fSynth.cutoff <= 127.0f);
break;
case paramResonance:
fParams.resonance = value;

View File

@ -63,9 +63,9 @@ DistrhoUINekobi::DistrhoUINekobi()
fKnobCutoff = new ImageKnob(this, knobImage, ImageKnob::Vertical);
fKnobCutoff->setId(DistrhoPluginNekobi::paramCutoff);
fKnobCutoff->setAbsolutePos(185, 43);
fKnobCutoff->setRange(0.0f, 100.0f);
fKnobCutoff->setDefault(25.0f);
fKnobCutoff->setValue(25.0f);
fKnobCutoff->setRange(0.0f, 127.0f);
fKnobCutoff->setDefault(50.0f);
fKnobCutoff->setValue(50.0f);
fKnobCutoff->setRotationAngle(305);
fKnobCutoff->setCallback(this);

View File

@ -96,17 +96,30 @@ void vco(nekobee_synth_t *synth, uint32_t count) {
osc->delay = delay;
}
void vcf(nekobee_synth_t *synth, uint32_t count) {
// run a 4-pole ladder filter over a block
// this is a crude implementation that only approximates the complex
// behaviour of the "real" ladder filter
nekobee_voice_t *voice = synth->voice;
printf("cutoff set to %f\n", synth->cutoff);
(void)voice;
(void)count;
}
void nekobee_voice_render(nekobee_synth_t *synth, float *out, uint32_t count) {
// generate "count" samples into the buffer at out
vco(synth, count);
vcf(synth, count);
for(uint32_t i=0; i<count; i++) {
out[i] = synth->voice->osc_audio[i];
}
return;
(void)synth;
(void)out;
(void)count;
}