diff options
| author | Chris Kiefer <chrisk13fer@gmail.com> | 2011-12-21 15:03:52 +0000 |
|---|---|---|
| committer | Chris Kiefer <chrisk13fer@gmail.com> | 2011-12-21 15:03:52 +0000 |
| commit | b3d027d27f077ea1ccb92afd3c44612d94dae6ba (patch) | |
| tree | 9c789a64930b18b13b7b04c81207fa534ae2ea94 | |
| parent | fe8d571fd5a4d273c8245aea37f92a5e2626af84 (diff) | |
Fixed the triangle oscillator
| -rw-r--r-- | ofxMaxim/ofxMaxim/libs/maximilian.cpp | 4 | ||||
| -rwxr-xr-x | ofxMaxim/ofxMaxim/libs/maximilian.h | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ofxMaxim/ofxMaxim/libs/maximilian.cpp b/ofxMaxim/ofxMaxim/libs/maximilian.cpp index 3099f6f..f19303a 100644 --- a/ofxMaxim/ofxMaxim/libs/maximilian.cpp +++ b/ofxMaxim/ofxMaxim/libs/maximilian.cpp @@ -173,9 +173,9 @@ double maxiOsc::triangle(double frequency) { if ( phase >= 1.0 ) phase -= 1.0; phase += (1./(maxiSettings::sampleRate/(frequency))); if (phase <= 0.5 ) { - output =((phase)*4)-1; + output =(phase - 0.25) * 4; } else { - output =((0.5-phase)*4)-1; + output =((1.0-phase) - 0.25) * 4; } return(output); diff --git a/ofxMaxim/ofxMaxim/libs/maximilian.h b/ofxMaxim/ofxMaxim/libs/maximilian.h index 9c9608c..d5234d1 100755 --- a/ofxMaxim/ofxMaxim/libs/maximilian.h +++ b/ofxMaxim/ofxMaxim/libs/maximilian.h @@ -139,6 +139,7 @@ class maxiFilter { double y;//pos double z;//pole double c;//filter coefficient + public: maxiFilter():x(0.0), y(0.0), z(0.0), c(0.0){}; double cutoff; @@ -409,7 +410,8 @@ public: inline double maxiDelayEffect::chorus(const double input, const unsigned int delay, const double feedback, const double speed, const double depth) { double output; - output = dl.dl(input, delay + (lfo.triangle(speed) * depth * delay) + 1, feedback) + input; + double lfoVal = lfo.triangle(speed); + output = dl.dl(input, delay + (lfoVal * depth * delay) + 1, feedback) + input; return output; } |
