223 |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
224 |
} |
} |
225 |
|
|
226 |
|
// setup initial volume in synthesis parameters |
227 |
|
fFinalVolume = getVolume() * EG1.getLevel(); |
228 |
|
finalSynthesisParameters.fFinalVolumeLeft = fFinalVolume * PanLeft; |
229 |
|
finalSynthesisParameters.fFinalVolumeRight = fFinalVolume * PanRight; |
230 |
|
|
231 |
|
|
232 |
// setup EG 2 (VCF Cutoff EG) |
// setup EG 2 (VCF Cutoff EG) |
233 |
{ |
{ |
703 |
|
|
704 |
void Voice::processCrossFadeEvent(RTList<Event>::Iterator& itEvent) { |
void Voice::processCrossFadeEvent(RTList<Event>::Iterator& itEvent) { |
705 |
CrossfadeVolume = CrossfadeAttenuation(itEvent->Param.CC.Value); |
CrossfadeVolume = CrossfadeAttenuation(itEvent->Param.CC.Value); |
706 |
|
fFinalVolume = getVolume(); |
707 |
|
} |
708 |
|
|
709 |
|
float Voice::getVolume() { |
710 |
#if CONFIG_PROCESS_MUTED_CHANNELS |
#if CONFIG_PROCESS_MUTED_CHANNELS |
711 |
const float effectiveVolume = CrossfadeVolume * Volume * (pEngineChannel->GetMute() ? 0 : pEngineChannel->GlobalVolume); |
return pEngineChannel->GetMute() ? 0 : (Volume * CrossfadeVolume * pEngineChannel->GlobalVolume); |
712 |
#else |
#else |
713 |
const float effectiveVolume = CrossfadeVolume * Volume * pEngineChannel->GlobalVolume; |
return Volume * CrossfadeVolume * pEngineChannel->GlobalVolume; |
714 |
#endif |
#endif |
|
fFinalVolume = effectiveVolume; |
|
715 |
} |
} |
716 |
|
|
717 |
void Voice::processCutoffEvent(RTList<Event>::Iterator& itEvent) { |
void Voice::processCutoffEvent(RTList<Event>::Iterator& itEvent) { |
769 |
|
|
770 |
// initialize all final synthesis parameters |
// initialize all final synthesis parameters |
771 |
finalSynthesisParameters.fFinalPitch = PitchBase * PitchBend; |
finalSynthesisParameters.fFinalPitch = PitchBase * PitchBend; |
772 |
#if CONFIG_PROCESS_MUTED_CHANNELS |
fFinalVolume = getVolume(); |
|
fFinalVolume = this->Volume * this->CrossfadeVolume * (pEngineChannel->GetMute() ? 0 : pEngineChannel->GlobalVolume); |
|
|
#else |
|
|
fFinalVolume = this->Volume * this->CrossfadeVolume * pEngineChannel->GlobalVolume; |
|
|
#endif |
|
773 |
fFinalCutoff = VCFCutoffCtrl.fvalue; |
fFinalCutoff = VCFCutoffCtrl.fvalue; |
774 |
fFinalResonance = VCFResonanceCtrl.fvalue; |
fFinalResonance = VCFResonanceCtrl.fvalue; |
775 |
|
|
829 |
SYNTHESIS_MODE_SET_INTERPOLATE(SynthesisMode, bResamplingRequired); |
SYNTHESIS_MODE_SET_INTERPOLATE(SynthesisMode, bResamplingRequired); |
830 |
|
|
831 |
// prepare final synthesis parameters structure |
// prepare final synthesis parameters structure |
832 |
|
finalSynthesisParameters.uiToGo = iSubFragmentEnd - i; |
833 |
|
#ifdef CONFIG_INTERPOLATE_VOLUME |
834 |
|
finalSynthesisParameters.fFinalVolumeDeltaLeft = |
835 |
|
(fFinalVolume * PanLeft - finalSynthesisParameters.fFinalVolumeLeft) / finalSynthesisParameters.uiToGo; |
836 |
|
finalSynthesisParameters.fFinalVolumeDeltaRight = |
837 |
|
(fFinalVolume * PanRight - finalSynthesisParameters.fFinalVolumeRight) / finalSynthesisParameters.uiToGo; |
838 |
|
#else |
839 |
finalSynthesisParameters.fFinalVolumeLeft = fFinalVolume * PanLeft; |
finalSynthesisParameters.fFinalVolumeLeft = fFinalVolume * PanLeft; |
840 |
finalSynthesisParameters.fFinalVolumeRight = fFinalVolume * PanRight; |
finalSynthesisParameters.fFinalVolumeRight = fFinalVolume * PanRight; |
841 |
finalSynthesisParameters.uiToGo = iSubFragmentEnd - i; |
#endif |
|
|
|
842 |
// render audio for one subfragment |
// render audio for one subfragment |
843 |
RunSynthesisFunction(SynthesisMode, &finalSynthesisParameters, &loop); |
RunSynthesisFunction(SynthesisMode, &finalSynthesisParameters, &loop); |
844 |
|
|
845 |
|
// stop the rendering if volume EG is finished |
846 |
|
if (EG1.getSegmentType() == EGADSR::segment_end) break; |
847 |
|
|
848 |
const double newPos = Pos + (iSubFragmentEnd - i) * finalSynthesisParameters.fFinalPitch; |
const double newPos = Pos + (iSubFragmentEnd - i) * finalSynthesisParameters.fFinalPitch; |
849 |
|
|
850 |
// increment envelopes' positions |
// increment envelopes' positions |