33 |
|
|
34 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
35 |
|
|
36 |
|
// sanity checks: fromGigLfoWave() assumes equally mapped enums |
37 |
|
static_assert(::gig::lfo_wave_sine == LFO::wave_sine); |
38 |
|
static_assert(::gig::lfo_wave_triangle == LFO::wave_triangle); |
39 |
|
static_assert(::gig::lfo_wave_saw == LFO::wave_saw); |
40 |
|
static_assert(::gig::lfo_wave_square == LFO::wave_square); |
41 |
|
|
42 |
|
// converts ::gig::lfo_wave_t (libgig) -> LFO::wave_t (LinuxSampler) |
43 |
|
inline LFO::wave_t fromGigLfoWave(::gig::lfo_wave_t wave) { |
44 |
|
// simply assuming equally mapped enums on both sides |
45 |
|
return static_cast<LFO::wave_t>(wave); |
46 |
|
} |
47 |
|
|
48 |
Voice::Voice() { |
Voice::Voice() { |
49 |
pEngine = NULL; |
pEngine = NULL; |
50 |
pEG1 = &EG1; |
pEG1 = &EG1; |
285 |
bLFO1Enabled = false; |
bLFO1Enabled = false; |
286 |
} |
} |
287 |
if (bLFO1Enabled) { |
if (bLFO1Enabled) { |
288 |
pLFO1->trigger(pRegion->LFO1Frequency, |
pLFO1->trigger(fromGigLfoWave(pRegion->LFO1WaveForm), |
289 |
start_level_min, |
pRegion->LFO1Frequency, |
290 |
|
pRegion->LFO1Phase, |
291 |
|
LFO::start_level_mid, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 |
292 |
lfo1_internal_depth, |
lfo1_internal_depth, |
293 |
pRegion->LFO1ControlDepth, |
pRegion->LFO1ControlDepth, |
294 |
pRegion->LFO1FlipPhase, |
pRegion->LFO1FlipPhase, |
343 |
bLFO2Enabled = false; |
bLFO2Enabled = false; |
344 |
} |
} |
345 |
if (bLFO2Enabled) { |
if (bLFO2Enabled) { |
346 |
pLFO2->trigger(pRegion->LFO2Frequency, |
pLFO2->trigger(fromGigLfoWave(pRegion->LFO2WaveForm), |
347 |
start_level_max, |
pRegion->LFO2Frequency, |
348 |
|
pRegion->LFO2Phase, |
349 |
|
LFO::start_level_mid, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 |
350 |
lfo2_internal_depth, |
lfo2_internal_depth, |
351 |
pRegion->LFO2ControlDepth, |
pRegion->LFO2ControlDepth, |
352 |
pRegion->LFO2FlipPhase, |
pRegion->LFO2FlipPhase, |
397 |
bLFO3Enabled = false; |
bLFO3Enabled = false; |
398 |
} |
} |
399 |
if (bLFO3Enabled) { |
if (bLFO3Enabled) { |
400 |
pLFO3->trigger(pRegion->LFO3Frequency, |
pLFO3->trigger(fromGigLfoWave(pRegion->LFO3WaveForm), |
401 |
start_level_mid, |
pRegion->LFO3Frequency, |
402 |
|
pRegion->LFO3Phase, |
403 |
|
LFO::start_level_max, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029 |
404 |
lfo3_internal_depth, |
lfo3_internal_depth, |
405 |
pRegion->LFO3ControlDepth, |
pRegion->LFO3ControlDepth, |
406 |
false, |
pRegion->LFO3FlipPhase, |
407 |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
408 |
pLFO3->updateByMIDICtrlValue(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0); |
pLFO3->updateByMIDICtrlValue(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0); |
409 |
pLFO3->setScriptDepthFactor( |
pLFO3->setScriptDepthFactor( |
516 |
pRegion->EG1Options.ReleaseCancel |
pRegion->EG1Options.ReleaseCancel |
517 |
); |
); |
518 |
EG1.trigger(pRegion->EG1PreAttack, |
EG1.trigger(pRegion->EG1PreAttack, |
519 |
RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack, |
(pNote && pNote->Override.Attack.isFinal()) ? |
520 |
|
pNote->Override.Attack.Value : |
521 |
|
RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack, |
522 |
pRegion->EG1Hold, |
pRegion->EG1Hold, |
523 |
pRegion->EG1Decay1 * egInfo.Decay * velrelease, |
(pNote && pNote->Override.Decay.isFinal()) ? |
524 |
pRegion->EG1Decay2 * egInfo.Decay * velrelease, |
pNote->Override.Decay.Value : |
525 |
|
pRegion->EG1Decay1 * egInfo.Decay * velrelease, |
526 |
|
(pNote && pNote->Override.Decay.isFinal()) ? |
527 |
|
pNote->Override.Decay.Value : |
528 |
|
pRegion->EG1Decay2 * egInfo.Decay * velrelease, |
529 |
pRegion->EG1InfiniteSustain, |
pRegion->EG1InfiniteSustain, |
530 |
(pNote && pNote->Override.Sustain.Final) ? |
(pNote && pNote->Override.Sustain.Final) ? |
531 |
pNote->Override.Sustain.Value : |
uint(pNote->Override.Sustain.Value * 1000.f) : |
532 |
pRegion->EG1Sustain * (pNote ? pNote->Override.Sustain.Value : 1.f), |
pRegion->EG1Sustain * (pNote ? pNote->Override.Sustain.Value : 1.f), |
533 |
RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release, |
(pNote && pNote->Override.Release.isFinal()) ? |
534 |
|
pNote->Override.Release.Value : |
535 |
|
RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release, |
536 |
velocityAttenuation, |
velocityAttenuation, |
537 |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
538 |
} |
} |
546 |
pRegion->EG2Options.ReleaseCancel |
pRegion->EG2Options.ReleaseCancel |
547 |
); |
); |
548 |
EG2.trigger(uint(RgnInfo.EG2PreAttack), |
EG2.trigger(uint(RgnInfo.EG2PreAttack), |
549 |
RgnInfo.EG2Attack * egInfo.Attack, |
(pNote && pNote->Override.CutoffAttack.isFinal()) ? |
550 |
|
pNote->Override.CutoffAttack.Value : |
551 |
|
RgnInfo.EG2Attack * egInfo.Attack, |
552 |
false, |
false, |
553 |
RgnInfo.EG2Decay1 * egInfo.Decay * velrelease, |
(pNote && pNote->Override.CutoffDecay.isFinal()) ? |
554 |
RgnInfo.EG2Decay2 * egInfo.Decay * velrelease, |
pNote->Override.CutoffDecay.Value : |
555 |
|
RgnInfo.EG2Decay1 * egInfo.Decay * velrelease, |
556 |
|
(pNote && pNote->Override.CutoffDecay.isFinal()) ? |
557 |
|
pNote->Override.CutoffDecay.Value : |
558 |
|
RgnInfo.EG2Decay2 * egInfo.Decay * velrelease, |
559 |
RgnInfo.EG2InfiniteSustain, |
RgnInfo.EG2InfiniteSustain, |
560 |
uint(RgnInfo.EG2Sustain), |
(pNote && pNote->Override.CutoffSustain.Final) ? |
561 |
RgnInfo.EG2Release * egInfo.Release * velrelease, |
uint(pNote->Override.CutoffSustain.Value * 1000.f) : |
562 |
|
uint(RgnInfo.EG2Sustain), |
563 |
|
(pNote && pNote->Override.CutoffRelease.isFinal()) ? |
564 |
|
pNote->Override.CutoffRelease.Value : |
565 |
|
RgnInfo.EG2Release * egInfo.Release * velrelease, |
566 |
velocityAttenuation, |
velocityAttenuation, |
567 |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
568 |
} |
} |