/[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 3017 by schoenebeck, Wed Oct 19 12:28:40 2016 UTC revision 3561 by schoenebeck, Fri Aug 23 11:44:00 2019 UTC
# Line 4  Line 4 
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *   Copyright (C) 2009 - 2015 Christian Schoenebeck and Grigor Iliev      *   *   Copyright (C) 2009 Christian Schoenebeck and Grigor Iliev             *
8     *   Copyright (C) 2010 - 2017 Christian Schoenebeck and Andreas Persson   *
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 58  namespace LinuxSampler { namespace gig { Line 59  namespace LinuxSampler { namespace gig {
59          si.ChannelCount     = pSample->Channels;          si.ChannelCount     = pSample->Channels;
60          si.FrameSize        = pSample->FrameSize;          si.FrameSize        = pSample->FrameSize;
61          si.BitDepth         = pSample->BitDepth;          si.BitDepth         = pSample->BitDepth;
62          si.TotalFrameCount  = pSample->SamplesTotal;          si.TotalFrameCount  = (uint)pSample->SamplesTotal;
63    
64          si.HasLoops       = pRegion->SampleLoops;          si.HasLoops       = pRegion->SampleLoops;
65          si.LoopStart      = (si.HasLoops) ? pRegion->pSampleLoops[0].LoopStart  : 0;          si.LoopStart      = (si.HasLoops) ? pRegion->pSampleLoops[0].LoopStart  : 0;
# Line 278  namespace LinuxSampler { namespace gig { Line 279  namespace LinuxSampler { namespace gig {
279                             pRegion->LFO1ControlDepth,                             pRegion->LFO1ControlDepth,
280                             pRegion->LFO1FlipPhase,                             pRegion->LFO1FlipPhase,
281                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
282              pLFO1->update(pLFO1->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO1->ExtController] : 0);              pLFO1->updateByMIDICtrlValue(pLFO1->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO1->ExtController] : 0);
283                pLFO1->setScriptDepthFactor(
284                    pNote->Override.AmpLFODepth.Value,
285                    pNote->Override.AmpLFODepth.Final
286                );
287                if (pNote->Override.AmpLFOFreq.isFinal())
288                    pLFO1->setScriptFrequencyFinal(
289                        pNote->Override.AmpLFOFreq.Value, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE
290                    );
291                else
292                    pLFO1->setScriptFrequencyFactor(
293                        pNote->Override.AmpLFOFreq.Value, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE
294                    );
295          }          }
296      }      }
297    
# Line 322  namespace LinuxSampler { namespace gig { Line 335  namespace LinuxSampler { namespace gig {
335                             pRegion->LFO2ControlDepth,                             pRegion->LFO2ControlDepth,
336                             pRegion->LFO2FlipPhase,                             pRegion->LFO2FlipPhase,
337                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
338              pLFO2->update(pLFO2->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO2->ExtController] : 0);              pLFO2->updateByMIDICtrlValue(pLFO2->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO2->ExtController] : 0);
339                pLFO2->setScriptDepthFactor(
340                    pNote->Override.CutoffLFODepth.Value,
341                    pNote->Override.CutoffLFODepth.Final
342                );
343                if (pNote->Override.CutoffLFOFreq.isFinal())
344                    pLFO2->setScriptFrequencyFinal(pNote->Override.CutoffLFOFreq.Value, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
345                else
346                    pLFO2->setScriptFrequencyFactor(pNote->Override.CutoffLFOFreq.Value, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
347          }          }
348      }      }
349    
# Line 366  namespace LinuxSampler { namespace gig { Line 387  namespace LinuxSampler { namespace gig {
387                             pRegion->LFO3ControlDepth,                             pRegion->LFO3ControlDepth,
388                             false,                             false,
389                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                             pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
390              pLFO3->update(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0);              pLFO3->updateByMIDICtrlValue(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0);
391                pLFO3->setScriptDepthFactor(
392                    pNote->Override.PitchLFODepth.Value,
393                    pNote->Override.PitchLFODepth.Final
394                );
395                if (pNote->Override.PitchLFOFreq.isFinal())
396                    pLFO3->setScriptFrequencyFinal(pNote->Override.PitchLFOFreq.Value, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
397                else
398                    pLFO3->setScriptFrequencyFactor(pNote->Override.PitchLFOFreq.Value, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
399          }          }
400      }      }
401    
# Line 461  namespace LinuxSampler { namespace gig { Line 490  namespace LinuxSampler { namespace gig {
490      }      }
491    
492      void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {      void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
493            EG1.setStateOptions(
494                pRegion->EG1Options.AttackCancel,
495                pRegion->EG1Options.AttackHoldCancel,
496                pRegion->EG1Options.Decay1Cancel,
497                pRegion->EG1Options.Decay2Cancel,
498                pRegion->EG1Options.ReleaseCancel
499            );
500          EG1.trigger(pRegion->EG1PreAttack,          EG1.trigger(pRegion->EG1PreAttack,
501                      RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack,                      RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack,
502                      pRegion->EG1Hold,                      pRegion->EG1Hold,
503                      pRegion->EG1Decay1 * egInfo.Decay * velrelease,                      pRegion->EG1Decay1 * egInfo.Decay * velrelease,
504                      pRegion->EG1Decay2 * egInfo.Decay * velrelease,                      pRegion->EG1Decay2 * egInfo.Decay * velrelease,
505                      pRegion->EG1InfiniteSustain,                      pRegion->EG1InfiniteSustain,
506                      pRegion->EG1Sustain,                      (pNote && pNote->Override.Sustain.Final) ?
507                            pNote->Override.Sustain.Value :
508                            pRegion->EG1Sustain * (pNote ? pNote->Override.Sustain.Value : 1.f),
509                      RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release,                      RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release,
510                      velocityAttenuation,                      velocityAttenuation,
511                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
512      }      }
513    
514      void Voice::TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {      void Voice::TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
515            EG2.setStateOptions(
516                pRegion->EG2Options.AttackCancel,
517                pRegion->EG2Options.AttackHoldCancel,
518                pRegion->EG2Options.Decay1Cancel,
519                pRegion->EG2Options.Decay2Cancel,
520                pRegion->EG2Options.ReleaseCancel
521            );
522          EG2.trigger(uint(RgnInfo.EG2PreAttack),          EG2.trigger(uint(RgnInfo.EG2PreAttack),
523                      RgnInfo.EG2Attack * egInfo.Attack,                      RgnInfo.EG2Attack * egInfo.Attack,
524                      false,                      false,
# Line 523  namespace LinuxSampler { namespace gig { Line 568  namespace LinuxSampler { namespace gig {
568          return p;          return p;
569      }      }
570    
571        release_trigger_t Voice::GetReleaseTriggerFlags() {
572            release_trigger_t flags =
573                (pRegion->NoNoteOffReleaseTrigger) ?
574                    release_trigger_none : release_trigger_noteoff; //HACK: currently this method is actually only called by EngineBase if it already knows that this voice requires release trigger, so I took the short way instead of checking (again) the existence of a ::gig::dimension_releasetrigger
575            switch (pRegion->SustainReleaseTrigger) {
576                case ::gig::sust_rel_trg_none:
577                    break;
578                case ::gig::sust_rel_trg_maxvelocity:
579                    flags |= release_trigger_sustain_maxvelocity;
580                    break;
581                case ::gig::sust_rel_trg_keyvelocity:
582                    flags |= release_trigger_sustain_keyvelocity;
583                    break;
584            }
585            return flags;
586        }
587    
588  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

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

  ViewVC Help
Powered by ViewVC