/[svn]/linuxsampler/trunk/src/engines/common/LFOTriangleIntMath.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/LFOTriangleIntMath.h

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

revision 3118 by schoenebeck, Fri Apr 21 13:33:03 2017 UTC revision 3561 by schoenebeck, Fri Aug 23 11:44:00 2019 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2005 - 2017 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2019 Christian Schoenebeck                       *
4   *                                                                         *   *                                                                         *
5   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
6   *   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 98  namespace LinuxSampler { Line 98  namespace LinuxSampler {
98                      this->InternalDepth        *= 2.0f;                      this->InternalDepth        *= 2.0f;
99                      this->ExtControlDepthCoeff *= 2.0f;                      this->ExtControlDepthCoeff *= 2.0f;
100                  }                  }
101                    this->pFinalDepth = NULL;
102                    this->pFinalFrequency = NULL;
103    
104                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...
105                  const float freq = Frequency * this->ScriptFrequencyFactor;                  const float freq = Frequency * this->ScriptFrequencyFactor;
# Line 140  namespace LinuxSampler { Line 142  namespace LinuxSampler {
142                  c = (int) (intLimit * r);                  c = (int) (intLimit * r);
143              }              }
144    
145              void setScriptDepthFactor(float factor) {              void setScriptDepthFactor(float factor, bool isFinal) {
146                  this->ScriptDepthFactor = factor;                  this->ScriptDepthFactor = factor;
147                    // set or reset this script depth parameter to be the sole
148                    // source for the LFO depth
149                    if (isFinal && !this->pFinalDepth)
150                        this->pFinalDepth = &this->ScriptDepthFactor;
151                    else if (!isFinal && this->pFinalDepth == &this->ScriptDepthFactor)
152                        this->pFinalDepth = NULL;
153                    // recalculate upon new depth
154                  updateByMIDICtrlValue(this->ExtControlValue);                  updateByMIDICtrlValue(this->ExtControlValue);
155              }              }
156    
157              void setScriptFrequencyFactor(float factor, unsigned int SampleRate) {              void setScriptFrequencyFactor(float factor, unsigned int SampleRate) {
158                  this->ScriptFrequencyFactor = factor;                  this->ScriptFrequencyFactor = factor;
159                    // in case script frequency was set as "final" value before,
160                    // reset it so that all sources are processed from now on
161                    if (this->pFinalFrequency == &this->ScriptFrequencyFactor)
162                        this->pFinalFrequency = NULL;
163                    // recalculate upon new frequency
164                    setFrequency(this->Frequency, SampleRate);
165                }
166    
167                void setScriptFrequencyFinal(float hz, unsigned int SampleRate) {
168                    this->ScriptFrequencyFactor = hz;
169                    // assign script's given frequency as sole source for the LFO
170                    // frequency, thus ignore all other sources
171                    if (!this->pFinalFrequency)
172                        this->pFinalFrequency = &this->ScriptFrequencyFactor;
173                    // recalculate upon new frequency
174                  setFrequency(this->Frequency, SampleRate);                  setFrequency(this->Frequency, SampleRate);
175              }              }
176    

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

  ViewVC Help
Powered by ViewVC