Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Clipper.h
- Committer:
- vaifreak
- Date:
- 2015-09-01
- Revision:
- 1:bfbfd6fede05
- Child:
- 2:25adc1277b3e
File content as of revision 1:bfbfd6fede05:
//============================================================================= // //============================================================================= #pragma once //--------------------------------------------- // Clipper, Base class. //--------------------------------------------- class Clipper { public: virtual float process( float samp ) = 0; }; //--------------------------------------------- // Simple clipper. //--------------------------------------------- class SimpleClipper : public Clipper { private: float clip; public: SimpleClipper( float c = 0.2f ) { clip = c; } virtual float process( float samp ) { if( samp > clip ) { return clip; } else { return samp; } } }; //--------------------------------------------- // Simple clipper. //--------------------------------------------- class SoftClipper : public Clipper { private: float clip; float comp_k; public: SoftClipper( float c = 0.05f, float k = 0.01f ) { clip = c; comp_k = k; } virtual float process( float samp ) { if( samp > clip ) { return clip + (samp-clip)*comp_k; } else { return samp; } } };