![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Distotion_Unit.cpp
- Committer:
- faker
- Date:
- 2011-05-01
- Revision:
- 0:53e66485c864
File content as of revision 0:53e66485c864:
/*****************************************************/ /* 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; }