--- linuxsampler/trunk/src/engines/gig/Voice.cpp 2006/07/22 14:22:53 903 +++ linuxsampler/trunk/src/engines/gig/Voice.cpp 2006/11/28 20:09:48 950 @@ -141,7 +141,7 @@ float subfragmentRate = pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE; CrossfadeSmoother.trigger(crossfadeVolume, subfragmentRate); - VolumeSmoother.trigger(pEngineChannel->GlobalVolume, subfragmentRate); + VolumeSmoother.trigger(pEngineChannel->GlobalVolume * pEngineChannel->MidiVolume, subfragmentRate); PanLeftSmoother.trigger(pEngineChannel->GlobalPanLeft, subfragmentRate); PanRightSmoother.trigger(pEngineChannel->GlobalPanRight, subfragmentRate); @@ -241,7 +241,7 @@ else #else { - float finalVolume = pEngineChannel->GlobalVolume * crossfadeVolume * EG1.getLevel(); + float finalVolume = pEngineChannel->GlobalVolume * pEngineChannel->MidiVolume * crossfadeVolume * EG1.getLevel(); finalSynthesisParameters.fFinalVolumeLeft = finalVolume * VolumeLeft * pEngineChannel->GlobalPanLeft; finalSynthesisParameters.fFinalVolumeRight = finalVolume * VolumeRight * pEngineChannel->GlobalPanRight; @@ -338,7 +338,7 @@ } if (bLFO1Enabled) { pLFO1->trigger(pDimRgn->LFO1Frequency, - start_level_max, + start_level_min, lfo1_internal_depth, pDimRgn->LFO1ControlDepth, pDimRgn->LFO1FlipPhase, @@ -719,7 +719,7 @@ CrossfadeSmoother.update(Engine::CrossfadeCurve[CrossfadeAttenuation(itEvent->Param.CC.Value)]); } if (itEvent->Param.CC.Controller == 7) { // volume - VolumeSmoother.update(Engine::VolumeCurve[itEvent->Param.CC.Value] * CONFIG_GLOBAL_ATTENUATION); + VolumeSmoother.update(Engine::VolumeCurve[itEvent->Param.CC.Value]); } else if (itEvent->Param.CC.Controller == 10) { // panpot PanLeftSmoother.update(Engine::PanCurve[128 - itEvent->Param.CC.Value]); PanRightSmoother.update(Engine::PanCurve[itEvent->Param.CC.Value]); @@ -803,8 +803,11 @@ // process transition events (note on, note off & sustain pedal) processTransitionEvents(itNoteEvent, iSubFragmentEnd); - // if the voice was killed in this subfragment switch EG1 to fade out stage - if (itKillEvent && killPos <= iSubFragmentEnd) { + // if the voice was killed in this subfragment, or if the + // filter EG is finished, switch EG1 to fade out stage + if ((itKillEvent && killPos <= iSubFragmentEnd) || + (SYNTHESIS_MODE_GET_FILTER(SynthesisMode) && + EG2.getSegmentType() == EGADSR::segment_end)) { EG1.enterFadeOutStage(); itKillEvent = Pool::Iterator(); } @@ -835,7 +838,7 @@ if (EG3.active()) finalSynthesisParameters.fFinalPitch *= EG3.render(); // process low frequency oscillators - if (bLFO1Enabled) fFinalVolume *= pLFO1->render(); + if (bLFO1Enabled) fFinalVolume *= (1.0f - pLFO1->render()); if (bLFO2Enabled) fFinalCutoff *= pLFO2->render(); if (bLFO3Enabled) finalSynthesisParameters.fFinalPitch *= RTMath::CentsToFreqRatio(pLFO3->render());