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

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

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

revision 2045 by persson, Sun Jan 10 13:22:19 2010 UTC revision 2055 by persson, Sat Jan 30 10:30:02 2010 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-2008 Christian Schoenebeck                         *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *   Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev        *   *   Copyright (C) 2009 - 2010 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 76  namespace LinuxSampler { namespace sfz { Line 76  namespace LinuxSampler { namespace sfz {
76          ri.EG1Hold             = pRegion->ampeg_hold;          ri.EG1Hold             = pRegion->ampeg_hold;
77          ri.EG1Decay1           = pRegion->ampeg_decay;          ri.EG1Decay1           = pRegion->ampeg_decay;
78          ri.EG1Decay2           = pRegion->ampeg_decay;          ri.EG1Decay2           = pRegion->ampeg_decay;
79          ri.EG1Sustain          = pRegion->ampeg_sustain;          ri.EG1Sustain          = pRegion->ampeg_sustain * 10;
80          ri.EG1InfiniteSustain  = true;          ri.EG1InfiniteSustain  = true;
81          ri.EG1Release          = pRegion->ampeg_release;          ri.EG1Release          = pRegion->ampeg_release;
82    
83          ri.EG2PreAttack        = pRegion->fileg_start;          ri.EG2PreAttack        = pRegion->fileg_start * 10;
84          ri.EG2Attack           = pRegion->fileg_attack;          ri.EG2Attack           = pRegion->fileg_attack;
85          //ri.EG2Hold             = pRegion->fileg_hold; // TODO:          //ri.EG2Hold             = pRegion->fileg_hold; // TODO:
86          ri.EG2Decay1           = pRegion->fileg_decay;          ri.EG2Decay1           = pRegion->fileg_decay;
87          ri.EG2Decay2           = pRegion->fileg_decay;          ri.EG2Decay2           = pRegion->fileg_decay;
88          ri.EG2Sustain          = pRegion->fileg_sustain;          ri.EG2Sustain          = pRegion->fileg_sustain * 10;
89          ri.EG2InfiniteSustain  = true;          ri.EG2InfiniteSustain  = true;
90          ri.EG2Release          = pRegion->fileg_release;          ri.EG2Release          = pRegion->fileg_release;
91    
# Line 202  namespace LinuxSampler { namespace sfz { Line 202  namespace LinuxSampler { namespace sfz {
202          return eg;          return eg;
203      }      }
204    
205      double Voice::GetEG2ControllerValue(uint8_t MIDIKeyVelocity) {      void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
206    
207            // TODO: controller modulation
208    
209            // first check if there is a v2 EG for amplitude
210            for (int i = 0 ; i < pRegion->eg.size() ; i++) {
211                if (pRegion->eg[i].amplitude > 0) {
212                    // TODO: actually use the value of the amplitude parameter
213                    pEG1 = &EG1;
214                    EG1.trigger(pRegion->eg[i], sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE, velocity);
215                    return;
216                }
217            }
218    
219            // otherwise use the v1 EGADSR
220            pEG1 = &EGADSR1;
221            EGADSR1.trigger(uint(RgnInfo.EG1PreAttack),
222                            RgnInfo.EG1Attack,
223                            RgnInfo.EG1Hold,
224                            RgnInfo.EG1Decay1,
225                            uint(RgnInfo.EG1Sustain),
226                            RgnInfo.EG1Release,
227                            sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
228         }
229    
230         double Voice::GetEG2ControllerValue(uint8_t MIDIKeyVelocity) {
231          /*double eg2controllervalue = 0;          /*double eg2controllervalue = 0;
232          switch (pRegion->EG2Controller.type) {          switch (pRegion->EG2Controller.type) {
233              case ::gig::eg2_ctrl_t::type_none: // no controller defined              case ::gig::eg2_ctrl_t::type_none: // no controller defined

Legend:
Removed from v.2045  
changed lines
  Added in v.2055

  ViewVC Help
Powered by ViewVC