![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Diff: Distotion_Unit.cpp
- Revision:
- 0:53e66485c864
diff -r 000000000000 -r 53e66485c864 Distotion_Unit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Distotion_Unit.cpp Sun May 01 12:34:33 2011 +0000 @@ -0,0 +1,34 @@ +/*****************************************************/ +/* Distotion_Unit.cpp */ +/* */ +/*****************************************************/ + +#define DIST_MAIN +#include "Distotion_Unit.h" + +#define inputGain (1.0) +#define clipLevel (15000) +#define outputGain (1.0) + +#define LIMIT_P (32767) +#define LIMIT_N (-32768) + +int distotion(int iEffectIn) { + + int iSignal; + + // Input Gain + iSignal = iEffectIn * inputGain; + + // Clip + if (iSignal >= clipLevel)iSignal = clipLevel; + if (iSignal <= -clipLevel)iSignal = -clipLevel; + + // Output Gain + iSignal *= outputGain; + if (iSignal >= LIMIT_P)iSignal = LIMIT_P; + if (iSignal <= LIMIT_N)iSignal = LIMIT_N; + + return iSignal; + +} \ No newline at end of file