feat: add clipper node
This commit is contained in:
parent
229b3eb1e2
commit
77c4851119
3 changed files with 39 additions and 1 deletions
16
core/Clipper.cpp
Normal file
16
core/Clipper.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include "Clipper.hpp"
|
||||
|
||||
Clipper::Clipper(float init_clip) : clip_(init_clip) {}
|
||||
|
||||
void Clipper::process(const float *in, float *out, uint32_t frames) {
|
||||
for (uint32_t i = 0; i < frames; ++i) {
|
||||
out[i] = in[i] > clip_ ? clip_ : in[i];
|
||||
}
|
||||
}
|
||||
void Clipper::processStereo(const float *inLeft, const float *inRight,
|
||||
float *outLeft, float *outRight, uint32_t frames) {
|
||||
for (uint32_t i = 0; i < frames; ++i) {
|
||||
outLeft[i] = inLeft[i] > clip_ ? clip_ : inLeft[i];
|
||||
outRight[i] = inRight[i] > clip_ ? clip_ : inRight[i];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue