feat: add soft clipping mode
This commit is contained in:
parent
556519a750
commit
e7ff4fcc18
5 changed files with 45 additions and 13 deletions
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
class Clipper {
|
||||
public:
|
||||
Clipper(float init_clip = 1.0f);
|
||||
enum ClipperMode { kClipperModeSoft, kClipperModeHard, 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,
|
||||
|
|
@ -14,10 +16,13 @@ public:
|
|||
private:
|
||||
float clip_;
|
||||
float clip(const float in);
|
||||
ClipperMode mode_;
|
||||
|
||||
public:
|
||||
void setGain(float c) { clip_ = c; }
|
||||
float getGain() const { return clip_; }
|
||||
void setMode(ClipperMode m) { mode_ = m; }
|
||||
ClipperMode getMode() const { return mode_; }
|
||||
};
|
||||
|
||||
#endif // CLIPPER_HPP_INCLUDED
|
||||
Loading…
Add table
Add a link
Reference in a new issue