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

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

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

revision 2027 by iliev, Tue Nov 3 19:27:42 2009 UTC revision 2175 by persson, Mon Apr 25 08:12:36 2011 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
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 - 2009 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *   Copyright (C) 2009 Grigor Iliev                                       *   *   Copyright (C) 2009 - 2011 Christian Schoenebeck and Grigor Iliev      *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
10   *   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 30  Line 30 
30  namespace LinuxSampler { namespace sf2 {  namespace LinuxSampler { namespace sf2 {
31    
32      Voice::Voice() {      Voice::Voice() {
33          pEngine     = NULL;          pEngine = NULL;
34            pEG1 = &EG1;
35            pEG2 = &EG2;
36      }      }
37    
38      Voice::~Voice() {      Voice::~Voice() {
# Line 105  namespace LinuxSampler { namespace sf2 { Line 107  namespace LinuxSampler { namespace sf2 {
107          ri.EG3Attack     = 0; // TODO:          ri.EG3Attack     = 0; // TODO:
108          ri.EG3Depth      = 0; // TODO:          ri.EG3Depth      = 0; // TODO:
109          ri.VCFEnabled    = false; // TODO:          ri.VCFEnabled    = false; // TODO:
110          ri.VCFType       = ::gig::vcf_type_lowpass; // TODO:          ri.VCFType       = Filter::vcf_type_2p_lowpass; // TODO:
111          ri.VCFResonance  = 0; // TODO:          ri.VCFResonance  = 0; // TODO:
112    
113          ri.ReleaseTriggerDecay = 0; // TODO:          ri.ReleaseTriggerDecay = 0; // TODO:
# Line 215  namespace LinuxSampler { namespace sf2 { Line 217  namespace LinuxSampler { namespace sf2 {
217          return eg;          return eg;
218      }      }
219    
220        void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
221            EG1.trigger(uint(RgnInfo.EG1PreAttack),
222                        RgnInfo.EG1Attack * egInfo.Attack,
223                        RgnInfo.EG1Hold,
224                        RgnInfo.EG1Decay1 * egInfo.Decay * velrelease,
225                        RgnInfo.EG1Decay2 * egInfo.Decay * velrelease,
226                        RgnInfo.EG1InfiniteSustain,
227                        uint(RgnInfo.EG1Sustain),
228                        RgnInfo.EG1Release * egInfo.Release * velrelease,
229                        velocityAttenuation,
230                        sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
231        }
232    
233      double Voice::GetEG2ControllerValue(uint8_t MIDIKeyVelocity) {      double Voice::GetEG2ControllerValue(uint8_t MIDIKeyVelocity) {
234          /*double eg2controllervalue = 0;          /*double eg2controllervalue = 0;
235          switch (pRegion->EG2Controller.type) {          switch (pRegion->EG2Controller.type) {
# Line 251  namespace LinuxSampler { namespace sf2 { Line 266  namespace LinuxSampler { namespace sf2 {
266          return eg;          return eg;
267      }      }
268    
269        void Voice::TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
270            EG2.trigger(uint(RgnInfo.EG2PreAttack),
271                        RgnInfo.EG2Attack * egInfo.Attack,
272                        false,
273                        RgnInfo.EG2Decay1 * egInfo.Decay * velrelease,
274                        RgnInfo.EG2Decay2 * egInfo.Decay * velrelease,
275                        RgnInfo.EG2InfiniteSustain,
276                        uint(RgnInfo.EG2Sustain),
277                        RgnInfo.EG2Release * egInfo.Release * velrelease,
278                        velocityAttenuation,
279                        sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
280        }
281    
282      void Voice::InitLFO1() {      void Voice::InitLFO1() {
283          /*uint16_t lfo1_internal_depth;          /*uint16_t lfo1_internal_depth;
284          switch (pRegion->LFO1Controller) {          switch (pRegion->LFO1Controller) {
# Line 389  namespace LinuxSampler { namespace sf2 { Line 417  namespace LinuxSampler { namespace sf2 {
417      float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) {      float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) {
418          /*float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity);          /*float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity);
419          if (pRegion->VCFKeyboardTracking) {          if (pRegion->VCFKeyboardTracking) {
420              cutoff *= exp((MIDIKeyVelocity - pRegion->VCFKeyboardTrackingBreakpoint) * 0.057762265f); // (ln(2) / 12)              cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey - pRegion->VCFKeyboardTrackingBreakpoint) * 100);
421          }          }
422          return cutoff;*/ // TODO: ^^^          return cutoff;*/ // TODO: ^^^
423          return 1.0f;          return 1.0f;
# Line 480  namespace LinuxSampler { namespace sf2 { Line 508  namespace LinuxSampler { namespace sf2 {
508          return 0;          return 0;
509      }      }
510    
511        void Voice::ProcessGroupEvent(RTList<Event>::Iterator& itEvent) {
512            if (itEvent->Param.Note.Key != MIDIKey) {
513                // kill the voice fast
514                pEG1->enterFadeOutStage();
515            }
516        }
517    
518  }} // namespace LinuxSampler::sf2  }} // namespace LinuxSampler::sf2

Legend:
Removed from v.2027  
changed lines
  Added in v.2175

  ViewVC Help
Powered by ViewVC