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

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

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

revision 3560 by schoenebeck, Fri Apr 21 13:33:03 2017 UTC revision 3561 by schoenebeck, Fri Aug 23 11:44:00 2019 UTC
# Line 87  namespace LinuxSampler { Line 87  namespace LinuxSampler {
87                  this->InternalDepth        = (InternalDepth / 1200.0f) * this->Max;                  this->InternalDepth        = (InternalDepth / 1200.0f) * this->Max;
88                  this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max;                  this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max;
89                  this->ScriptFrequencyFactor = this->ScriptDepthFactor = 1.f; // reset for new voice                  this->ScriptFrequencyFactor = this->ScriptDepthFactor = 1.f; // reset for new voice
90                    this->pFinalDepth = NULL;
91                    this->pFinalFrequency = NULL;
92    
93                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...
94                  const float freq = Frequency * this->ScriptFrequencyFactor;                  const float freq = Frequency * this->ScriptFrequencyFactor;
# Line 121  namespace LinuxSampler { Line 123  namespace LinuxSampler {
123                  c = (int) (intLimit * r);                  c = (int) (intLimit * r);
124              }              }
125    
126              void setScriptDepthFactor(float factor) {              void setScriptDepthFactor(float factor, bool isFinal) {
127                  this->ScriptDepthFactor = factor;                  this->ScriptDepthFactor = factor;
128                    // set or reset this script depth parameter to be the sole
129                    // source for the LFO depth
130                    if (isFinal && !this->pFinalDepth)
131                        this->pFinalDepth = &this->ScriptDepthFactor;
132                    else if (!isFinal && this->pFinalDepth == &this->ScriptDepthFactor)
133                        this->pFinalDepth = NULL;
134                    // recalculate upon new depth
135                  updateByMIDICtrlValue(this->ExtControlValue);                  updateByMIDICtrlValue(this->ExtControlValue);
136              }              }
137    
138              void setScriptFrequencyFactor(float factor, unsigned int SampleRate) {              void setScriptFrequencyFactor(float factor, unsigned int SampleRate) {
139                  this->ScriptFrequencyFactor = factor;                  this->ScriptFrequencyFactor = factor;
140                    // in case script frequency was set as "final" value before,
141                    // reset it so that all sources are processed from now on
142                    if (this->pFinalFrequency == &this->ScriptFrequencyFactor)
143                        this->pFinalFrequency = NULL;
144                    // recalculate upon new frequency
145                    setFrequency(this->Frequency, SampleRate);
146                }
147    
148                void setScriptFrequencyFinal(float hz, unsigned int SampleRate) {
149                    this->ScriptFrequencyFactor = hz;
150                    // assign script's given frequency as sole source for the LFO
151                    // frequency, thus ignore all other sources
152                    if (!this->pFinalFrequency)
153                        this->pFinalFrequency = &this->ScriptFrequencyFactor;
154                    // recalculate upon new frequency
155                  setFrequency(this->Frequency, SampleRate);                  setFrequency(this->Frequency, SampleRate);
156              }              }
157    

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

  ViewVC Help
Powered by ViewVC