add option for soft-clipping

This commit is contained in:
tildearrow 2022-07-25 18:41:47 -05:00
parent b0c2b10135
commit 09e457003b
5 changed files with 20 additions and 0 deletions

View file

@ -1413,6 +1413,14 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
out[1][i]=out[0][i];
}
}
if (clampSamples) {
for (size_t i=0; i<size; i++) {
if (out[0][i]<-1.0) out[0][i]=-1.0;
if (out[0][i]>1.0) out[0][i]=1.0;
if (out[1][i]<-1.0) out[1][i]=-1.0;
if (out[1][i]>1.0) out[1][i]=1.0;
}
}
isBusy.unlock();
std::chrono::steady_clock::time_point ts_processEnd=std::chrono::steady_clock::now();