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

Diff of /linuxsampler/trunk/src/engines/common/SineLFO.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 88  namespace LinuxSampler { Line 88  namespace LinuxSampler {
88                  this->InternalDepth        = (InternalDepth / 1200.0f) * this->Max;                  this->InternalDepth        = (InternalDepth / 1200.0f) * this->Max;
89                  this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max;                  this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max;
90                  this->ScriptFrequencyFactor = this->ScriptDepthFactor = 1.f; // reset for new voice                  this->ScriptFrequencyFactor = this->ScriptDepthFactor = 1.f; // reset for new voice
91                    this->pFinalDepth = NULL;
92                    this->pFinalFrequency = NULL;
93    
94                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...
95                  const float freq = Frequency * this->ScriptFrequencyFactor;                  const float freq = Frequency * this->ScriptFrequencyFactor;
# Line 117  namespace LinuxSampler { Line 119  namespace LinuxSampler {
119                  c = (int) (intLimit * r);                  c = (int) (intLimit * r);
120              }              }
121    
122              void setScriptDepthFactor(float factor) {              void setScriptDepthFactor(float factor, bool isFinal) {
123                  this->ScriptDepthFactor = factor;                  this->ScriptDepthFactor = factor;
124                    // set or reset this script depth parameter to be the sole
125                    // source for the LFO depth
126                    if (isFinal && !this->pFinalDepth)
127                        this->pFinalDepth = &this->ScriptDepthFactor;
128                    else if (!isFinal && this->pFinalDepth == &this->ScriptDepthFactor)
129                        this->pFinalDepth = NULL;
130                    // recalculate upon new depth
131                  updateByMIDICtrlValue(this->ExtControlValue);                  updateByMIDICtrlValue(this->ExtControlValue);
132              }              }
133    
134              void setScriptFrequencyFactor(float factor, unsigned int SampleRate) {              void setScriptFrequencyFactor(float factor, unsigned int SampleRate) {
135                  this->ScriptFrequencyFactor = factor;                  this->ScriptFrequencyFactor = factor;
136                    // in case script frequency was set as "final" value before,
137                    // reset it so that all sources are processed from now on
138                    if (this->pFinalFrequency == &this->ScriptFrequencyFactor)
139                        this->pFinalFrequency = NULL;
140                    // recalculate upon new frequency
141                    setFrequency(this->Frequency, SampleRate);
142                }
143    
144                void setScriptFrequencyFinal(float hz, unsigned int SampleRate) {
145                    this->ScriptFrequencyFactor = hz;
146                    // assign script's given frequency as sole source for the LFO
147                    // frequency, thus ignore all other sources
148                    if (!this->pFinalFrequency)
149                        this->pFinalFrequency = &this->ScriptFrequencyFactor;
150                    // recalculate upon new frequency
151                  setFrequency(this->Frequency, SampleRate);                  setFrequency(this->Frequency, SampleRate);
152              }              }
153    

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

  ViewVC Help
Powered by ViewVC