--- linuxsampler/trunk/src/engines/gig/Voice.cpp 2019/08/23 11:44:00 3561 +++ linuxsampler/trunk/src/engines/gig/Voice.cpp 2019/10/03 13:37:25 3625 @@ -33,6 +33,12 @@ namespace LinuxSampler { namespace gig { + // converts ::gig::lfo_wave_t (libgig) -> LFO::wave_t (LinuxSampler) + inline LFO::wave_t fromGigLfoWave(::gig::lfo_wave_t wave) { + // simply assuming equally mapped enums on both sides + return static_cast(wave); + } + Voice::Voice() { pEngine = NULL; pEG1 = &EG1; @@ -273,8 +279,10 @@ bLFO1Enabled = false; } if (bLFO1Enabled) { - pLFO1->trigger(pRegion->LFO1Frequency, - start_level_min, + pLFO1->trigger(fromGigLfoWave(pRegion->LFO1WaveForm), + pRegion->LFO1Frequency, + pRegion->LFO1Phase, + LFO::start_level_mid, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 lfo1_internal_depth, pRegion->LFO1ControlDepth, pRegion->LFO1FlipPhase, @@ -329,8 +337,10 @@ bLFO2Enabled = false; } if (bLFO2Enabled) { - pLFO2->trigger(pRegion->LFO2Frequency, - start_level_max, + pLFO2->trigger(fromGigLfoWave(pRegion->LFO2WaveForm), + pRegion->LFO2Frequency, + pRegion->LFO2Phase, + LFO::start_level_mid, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 lfo2_internal_depth, pRegion->LFO2ControlDepth, pRegion->LFO2FlipPhase, @@ -381,11 +391,13 @@ bLFO3Enabled = false; } if (bLFO3Enabled) { - pLFO3->trigger(pRegion->LFO3Frequency, - start_level_mid, + pLFO3->trigger(fromGigLfoWave(pRegion->LFO3WaveForm), + pRegion->LFO3Frequency, + pRegion->LFO3Phase, + LFO::start_level_max, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 lfo3_internal_depth, pRegion->LFO3ControlDepth, - false, + pRegion->LFO3FlipPhase, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); pLFO3->updateByMIDICtrlValue(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0); pLFO3->setScriptDepthFactor( @@ -498,15 +510,23 @@ pRegion->EG1Options.ReleaseCancel ); EG1.trigger(pRegion->EG1PreAttack, - RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack, + (pNote && pNote->Override.Attack.isFinal()) ? + pNote->Override.Attack.Value : + RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack, pRegion->EG1Hold, - pRegion->EG1Decay1 * egInfo.Decay * velrelease, - pRegion->EG1Decay2 * egInfo.Decay * velrelease, + (pNote && pNote->Override.Decay.isFinal()) ? + pNote->Override.Decay.Value : + pRegion->EG1Decay1 * egInfo.Decay * velrelease, + (pNote && pNote->Override.Decay.isFinal()) ? + pNote->Override.Decay.Value : + pRegion->EG1Decay2 * egInfo.Decay * velrelease, pRegion->EG1InfiniteSustain, (pNote && pNote->Override.Sustain.Final) ? - pNote->Override.Sustain.Value : + uint(pNote->Override.Sustain.Value * 1000.f) : pRegion->EG1Sustain * (pNote ? pNote->Override.Sustain.Value : 1.f), - RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release, + (pNote && pNote->Override.Release.isFinal()) ? + pNote->Override.Release.Value : + RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release, velocityAttenuation, sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); } @@ -520,13 +540,23 @@ pRegion->EG2Options.ReleaseCancel ); EG2.trigger(uint(RgnInfo.EG2PreAttack), - RgnInfo.EG2Attack * egInfo.Attack, + (pNote && pNote->Override.CutoffAttack.isFinal()) ? + pNote->Override.CutoffAttack.Value : + RgnInfo.EG2Attack * egInfo.Attack, false, - RgnInfo.EG2Decay1 * egInfo.Decay * velrelease, - RgnInfo.EG2Decay2 * egInfo.Decay * velrelease, + (pNote && pNote->Override.CutoffDecay.isFinal()) ? + pNote->Override.CutoffDecay.Value : + RgnInfo.EG2Decay1 * egInfo.Decay * velrelease, + (pNote && pNote->Override.CutoffDecay.isFinal()) ? + pNote->Override.CutoffDecay.Value : + RgnInfo.EG2Decay2 * egInfo.Decay * velrelease, RgnInfo.EG2InfiniteSustain, - uint(RgnInfo.EG2Sustain), - RgnInfo.EG2Release * egInfo.Release * velrelease, + (pNote && pNote->Override.CutoffSustain.Final) ? + uint(pNote->Override.CutoffSustain.Value * 1000.f) : + uint(RgnInfo.EG2Sustain), + (pNote && pNote->Override.CutoffRelease.isFinal()) ? + pNote->Override.CutoffRelease.Value : + RgnInfo.EG2Release * egInfo.Release * velrelease, velocityAttenuation, sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); }