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

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

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

revision 3611 by schoenebeck, Fri Aug 23 11:44:00 2019 UTC revision 3612 by schoenebeck, Mon Sep 30 18:03:43 2019 UTC
# Line 31  namespace LinuxSampler { Line 31  namespace LinuxSampler {
31       * This is a saw Low Frequency Oscillator which uses pure integer       * This is a saw Low Frequency Oscillator which uses pure integer
32       * math (without branches) to synthesize the saw wave.       * math (without branches) to synthesize the saw wave.
33       */       */
34      template<range_type_t RANGE, bool SAWUP>      template<LFO::range_type_t RANGE, bool SAWUP>
35      class SawLFO : public LFOBase<RANGE> {      class SawLFO : public LFOBase<RANGE> {
36          public:          public:
37    
# Line 52  namespace LinuxSampler { Line 52  namespace LinuxSampler {
52                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...
53                                    
54                  uiLevel += c;                  uiLevel += c;
55                  if (RANGE == range_unsigned)                  if (RANGE == LFO::range_unsigned)
56                      return normalizer * (float) (SAWUP ? uiLevel : intLimit - uiLevel);                      return normalizer * (float) (SAWUP ? uiLevel : intLimit - uiLevel);
57                  else /* signed range */                  else /* signed range */
58                      return normalizer * (float) (SAWUP ? uiLevel : intLimit - uiLevel) + offset;                      return normalizer * (float) (SAWUP ? uiLevel : intLimit - uiLevel) + offset;
# Line 68  namespace LinuxSampler { Line 68  namespace LinuxSampler {
68    
69                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...                  const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF...
70                  const float max = (this->InternalDepth + ExtControlValue * this->ExtControlDepthCoeff) * this->ScriptDepthFactor;                  const float max = (this->InternalDepth + ExtControlValue * this->ExtControlDepthCoeff) * this->ScriptDepthFactor;
71                  if (RANGE == range_unsigned) {                  if (RANGE == LFO::range_unsigned) {
72                      normalizer = max / (float) intLimit;                      normalizer = max / (float) intLimit;
73                  } else { // signed range                  } else { // signed range
74                      normalizer = max / (float) intLimit * 2.0f;                      normalizer = max / (float) intLimit * 2.0f;
# Line 89  namespace LinuxSampler { Line 89  namespace LinuxSampler {
89               * @param SampleRate      - current sample rate of the engines               * @param SampleRate      - current sample rate of the engines
90               *                          audio output signal               *                          audio output signal
91               */               */
92              virtual void trigger(float Frequency, start_level_t StartLevel, uint16_t InternalDepth, uint16_t ExtControlDepth, bool FlipPhase, unsigned int SampleRate) {              virtual void trigger(float Frequency, LFO::start_level_t StartLevel, uint16_t InternalDepth, uint16_t ExtControlDepth, bool FlipPhase, unsigned int SampleRate) {
93                  this->Frequency            = Frequency;                  this->Frequency            = Frequency;
94                  this->InternalDepth        = (InternalDepth / 1200.0f) * this->Max;                  this->InternalDepth        = (InternalDepth / 1200.0f) * this->Max;
95                  this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max;                  this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max;
# Line 165  namespace LinuxSampler { Line 165  namespace LinuxSampler {
165      };      };
166            
167            
168      template<range_type_t RANGE>      template<LFO::range_type_t RANGE>
169      class SawUpLFO : public SawLFO<RANGE, true> {      class SawUpLFO : public SawLFO<RANGE, true> {
170          public:          public:
171              SawUpLFO(float Max) : SawLFO<RANGE, true>::SawLFO(Max) { }              SawUpLFO(float Max) : SawLFO<RANGE, true>::SawLFO(Max) { }
172      };      };
173            
174      template<range_type_t RANGE>      template<LFO::range_type_t RANGE>
175      class SawDownLFO : public SawLFO<RANGE, false> {      class SawDownLFO : public SawLFO<RANGE, false> {
176          public:          public:
177              SawDownLFO(float Max) : SawLFO<RANGE, false>::SawLFO(Max) { }              SawDownLFO(float Max) : SawLFO<RANGE, false>::SawLFO(Max) { }

Legend:
Removed from v.3611  
changed lines
  Added in v.3612

  ViewVC Help
Powered by ViewVC