SquidgeDSP/core/Clipper.hpp

33 lines
No EOL
807 B
C++

#ifndef CLIPPER_HPP_INCLUDED
#define CLIPPER_HPP_INCLUDED
#include <cstdint>
class Clipper {
public:
enum ClipperMode {
kClipperModeSoft,
kClipperModeHard,
kClipperModeFold,
kClipperModeCount
};
Clipper(float init_clip = 1.0f, ClipperMode mode = kClipperModeSoft);
void process(const float *in, float *out, uint32_t frames);
void processStereo(const float *inLeft, const float *inRight, float *outLeft,
float *outRight, uint32_t frames);
private:
float threshold_;
float clip(const float in);
ClipperMode mode_;
public:
void setThreshold(float c) { threshold_ = c; }
float getThreshold() const { return threshold_; }
void setMode(ClipperMode m) { mode_ = m; }
ClipperMode getMode() const { return mode_; }
};
#endif // CLIPPER_HPP_INCLUDED