/[svn]/linuxsampler/trunk/src/engines/gig/Voice.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/Voice.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3561 by schoenebeck, Fri Aug 23 11:44:00 2019 UTC revision 3625 by schoenebeck, Thu Oct 3 13:37:25 2019 UTC
# Line 33  Line 33 
33    
34  namespace LinuxSampler { namespace gig {  namespace LinuxSampler { namespace gig {
35    
36        // converts ::gig::lfo_wave_t (libgig) -> LFO::wave_t (LinuxSampler)
37        inline LFO::wave_t fromGigLfoWave(::gig::lfo_wave_t wave) {
38            // simply assuming equally mapped enums on both sides
39            return static_cast<LFO::wave_t>(wave);
40        }
41    
42      Voice::Voice() {      Voice::Voice() {
43          pEngine = NULL;          pEngine = NULL;
44          pEG1 = &EG1;          pEG1 = &EG1;
# Line 273  namespace LinuxSampler { namespace gig { Line 279  namespace LinuxSampler { namespace gig {
279                  bLFO1Enabled         = false;                  bLFO1Enabled         = false;
280          }          }
281          if (bLFO1Enabled) {          if (bLFO1Enabled) {
282              pLFO1->trigger(pRegion->LFO1Frequency,              pLFO1->trigger(fromGigLfoWave(pRegion->LFO1WaveForm),
283                             start_level_min,                             pRegion->LFO1Frequency,
284                               pRegion->LFO1Phase,
285                               LFO::start_level_mid, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029
286                             lfo1_internal_depth,                             lfo1_internal_depth,
287                             pRegion->LFO1ControlDepth,                             pRegion->LFO1ControlDepth,
288                             pRegion->LFO1FlipPhase,                             pRegion->LFO1FlipPhase,
# Line 329  namespace LinuxSampler { namespace gig { Line 337  namespace LinuxSampler { namespace gig {
337                  bLFO2Enabled         = false;                  bLFO2Enabled         = false;
338          }          }
339          if (bLFO2Enabled) {          if (bLFO2Enabled) {
340              pLFO2->trigger(pRegion->LFO2Frequency,              pLFO2->trigger(fromGigLfoWave(pRegion->LFO2WaveForm),
341                             start_level_max,                             pRegion->LFO2Frequency,
342                               pRegion->LFO2Phase,
343                               LFO::start_level_mid, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029
344                             lfo2_internal_depth,                             lfo2_internal_depth,
345                             pRegion->LFO2ControlDepth,                             pRegion->LFO2ControlDepth,
346                             pRegion->LFO2FlipPhase,                             pRegion->LFO2FlipPhase,
# Line 381  namespace LinuxSampler { namespace gig { Line 391  namespace LinuxSampler { namespace gig {
391                  bLFO3Enabled         = false;                  bLFO3Enabled         = false;
392          }          }
393          if (bLFO3Enabled) {          if (bLFO3Enabled) {
394              pLFO3->trigger(pRegion->LFO3Frequency,              pLFO3->trigger(fromGigLfoWave(pRegion->LFO3WaveForm),
395                             start_level_mid,                             pRegion->LFO3Frequency,
396                               pRegion->LFO3Phase,
397                               LFO::start_level_max, // see https://sourceforge.net/p/linuxsampler/mailman/linuxsampler-devel/thread/2189307.cNP0Xbctxq%40silver/#msg36774029
398                             lfo3_internal_depth,                             lfo3_internal_depth,
399                             pRegion->LFO3ControlDepth,                             pRegion->LFO3ControlDepth,
400                             false,                             pRegion->LFO3FlipPhase,
401                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
402              pLFO3->updateByMIDICtrlValue(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0);              pLFO3->updateByMIDICtrlValue(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0);
403              pLFO3->setScriptDepthFactor(              pLFO3->setScriptDepthFactor(
# Line 498  namespace LinuxSampler { namespace gig { Line 510  namespace LinuxSampler { namespace gig {
510              pRegion->EG1Options.ReleaseCancel              pRegion->EG1Options.ReleaseCancel
511          );          );
512          EG1.trigger(pRegion->EG1PreAttack,          EG1.trigger(pRegion->EG1PreAttack,
513                      RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack,                      (pNote && pNote->Override.Attack.isFinal()) ?
514                            pNote->Override.Attack.Value :
515                            RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack,
516                      pRegion->EG1Hold,                      pRegion->EG1Hold,
517                      pRegion->EG1Decay1 * egInfo.Decay * velrelease,                      (pNote && pNote->Override.Decay.isFinal()) ?
518                      pRegion->EG1Decay2 * egInfo.Decay * velrelease,                          pNote->Override.Decay.Value :
519                            pRegion->EG1Decay1 * egInfo.Decay * velrelease,
520                        (pNote && pNote->Override.Decay.isFinal()) ?
521                            pNote->Override.Decay.Value :
522                            pRegion->EG1Decay2 * egInfo.Decay * velrelease,
523                      pRegion->EG1InfiniteSustain,                      pRegion->EG1InfiniteSustain,
524                      (pNote && pNote->Override.Sustain.Final) ?                      (pNote && pNote->Override.Sustain.Final) ?
525                          pNote->Override.Sustain.Value :                          uint(pNote->Override.Sustain.Value * 1000.f) :
526                          pRegion->EG1Sustain * (pNote ? pNote->Override.Sustain.Value : 1.f),                          pRegion->EG1Sustain * (pNote ? pNote->Override.Sustain.Value : 1.f),
527                      RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release,                      (pNote && pNote->Override.Release.isFinal()) ?
528                            pNote->Override.Release.Value :
529                            RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release,
530                      velocityAttenuation,                      velocityAttenuation,
531                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
532      }      }
# Line 520  namespace LinuxSampler { namespace gig { Line 540  namespace LinuxSampler { namespace gig {
540              pRegion->EG2Options.ReleaseCancel              pRegion->EG2Options.ReleaseCancel
541          );          );
542          EG2.trigger(uint(RgnInfo.EG2PreAttack),          EG2.trigger(uint(RgnInfo.EG2PreAttack),
543                      RgnInfo.EG2Attack * egInfo.Attack,                      (pNote && pNote->Override.CutoffAttack.isFinal()) ?
544                            pNote->Override.CutoffAttack.Value :
545                            RgnInfo.EG2Attack * egInfo.Attack,
546                      false,                      false,
547                      RgnInfo.EG2Decay1 * egInfo.Decay * velrelease,                      (pNote && pNote->Override.CutoffDecay.isFinal()) ?
548                      RgnInfo.EG2Decay2 * egInfo.Decay * velrelease,                          pNote->Override.CutoffDecay.Value :
549                            RgnInfo.EG2Decay1 * egInfo.Decay * velrelease,
550                        (pNote && pNote->Override.CutoffDecay.isFinal()) ?
551                            pNote->Override.CutoffDecay.Value :
552                            RgnInfo.EG2Decay2 * egInfo.Decay * velrelease,
553                      RgnInfo.EG2InfiniteSustain,                      RgnInfo.EG2InfiniteSustain,
554                      uint(RgnInfo.EG2Sustain),                      (pNote && pNote->Override.CutoffSustain.Final) ?
555                      RgnInfo.EG2Release * egInfo.Release * velrelease,                          uint(pNote->Override.CutoffSustain.Value * 1000.f) :
556                            uint(RgnInfo.EG2Sustain),
557                        (pNote && pNote->Override.CutoffRelease.isFinal()) ?
558                            pNote->Override.CutoffRelease.Value :
559                            RgnInfo.EG2Release * egInfo.Release * velrelease,
560                      velocityAttenuation,                      velocityAttenuation,
561                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
562      }      }

Legend:
Removed from v.3561  
changed lines
  Added in v.3625

  ViewVC Help
Powered by ViewVC