494 |
if (VCFCutoffCtrl.controller) { |
if (VCFCutoffCtrl.controller) { |
495 |
cvalue = pEngineChannel->ControllerTable[VCFCutoffCtrl.controller]; |
cvalue = pEngineChannel->ControllerTable[VCFCutoffCtrl.controller]; |
496 |
if (pDimRgn->VCFCutoffControllerInvert) cvalue = 127 - cvalue; |
if (pDimRgn->VCFCutoffControllerInvert) cvalue = 127 - cvalue; |
497 |
|
// VCFVelocityScale in this case means Minimum cutoff |
498 |
if (cvalue < pDimRgn->VCFVelocityScale) cvalue = pDimRgn->VCFVelocityScale; |
if (cvalue < pDimRgn->VCFVelocityScale) cvalue = pDimRgn->VCFVelocityScale; |
499 |
} |
} |
500 |
else { |
else { |
502 |
} |
} |
503 |
cutoff *= float(cvalue) * 0.00787402f; // (1 / 127) |
cutoff *= float(cvalue) * 0.00787402f; // (1 / 127) |
504 |
if (cutoff > 1.0) cutoff = 1.0; |
if (cutoff > 1.0) cutoff = 1.0; |
505 |
cutoff = exp(cutoff * FILTER_CUTOFF_COEFF) * CONFIG_FILTER_CUTOFF_MIN; |
cutoff = (cutoff < 0.5 ? cutoff * 4826 - 1 : cutoff * 5715 - 449); |
506 |
|
if (cutoff < 1.0) cutoff = 1.0; |
507 |
|
|
508 |
// calculate resonance |
// calculate resonance |
509 |
float resonance = (float) VCFResonanceCtrl.value * 0.00787f; // 0.0..1.0 |
float resonance = (float) (VCFResonanceCtrl.controller ? VCFResonanceCtrl.value : pDimRgn->VCFResonance) * 0.00787f; // 0.0..1.0 |
|
if (pDimRgn->VCFKeyboardTracking) { |
|
|
resonance += (float) (itNoteOnEvent->Param.Note.Key - pDimRgn->VCFKeyboardTrackingBreakpoint) * 0.00787f; |
|
|
} |
|
|
Constrain(resonance, 0.0, 1.0); // correct resonance if outside allowed value range (0.0..1.0) |
|
510 |
|
|
511 |
VCFCutoffCtrl.fvalue = cutoff - CONFIG_FILTER_CUTOFF_MIN; |
VCFCutoffCtrl.fvalue = cutoff - 1.0; |
512 |
VCFResonanceCtrl.fvalue = resonance; |
VCFResonanceCtrl.fvalue = resonance; |
513 |
} |
} |
514 |
else { |
else { |
712 |
if (ccvalue < pDimRgn->VCFVelocityScale) ccvalue = pDimRgn->VCFVelocityScale; |
if (ccvalue < pDimRgn->VCFVelocityScale) ccvalue = pDimRgn->VCFVelocityScale; |
713 |
float cutoff = CutoffBase * float(ccvalue) * 0.00787402f; // (1 / 127) |
float cutoff = CutoffBase * float(ccvalue) * 0.00787402f; // (1 / 127) |
714 |
if (cutoff > 1.0) cutoff = 1.0; |
if (cutoff > 1.0) cutoff = 1.0; |
715 |
cutoff = exp(cutoff * FILTER_CUTOFF_COEFF) * CONFIG_FILTER_CUTOFF_MIN - CONFIG_FILTER_CUTOFF_MIN; |
cutoff = (cutoff < 0.5 ? cutoff * 4826 - 1 : cutoff * 5715 - 449); |
716 |
VCFCutoffCtrl.fvalue = cutoff; // needed for initialization of fFinalCutoff next time |
if (cutoff < 1.0) cutoff = 1.0; |
717 |
|
|
718 |
|
VCFCutoffCtrl.fvalue = cutoff - 1.0; // needed for initialization of fFinalCutoff next time |
719 |
fFinalCutoff = cutoff; |
fFinalCutoff = cutoff; |
720 |
} |
} |
721 |
|
|
802 |
|
|
803 |
// if filter enabled then update filter coefficients |
// if filter enabled then update filter coefficients |
804 |
if (SYNTHESIS_MODE_GET_FILTER(SynthesisMode)) { |
if (SYNTHESIS_MODE_GET_FILTER(SynthesisMode)) { |
805 |
finalSynthesisParameters.filterLeft.SetParameters(fFinalCutoff, fFinalResonance, pEngine->SampleRate); |
finalSynthesisParameters.filterLeft.SetParameters(fFinalCutoff + 1.0, fFinalResonance, pEngine->SampleRate); |
806 |
finalSynthesisParameters.filterRight.SetParameters(fFinalCutoff, fFinalResonance, pEngine->SampleRate); |
finalSynthesisParameters.filterRight.SetParameters(fFinalCutoff + 1.0, fFinalResonance, pEngine->SampleRate); |
807 |
} |
} |
808 |
|
|
809 |
// do we need resampling? |
// do we need resampling? |