add option for soft-clipping
This commit is contained in:
parent
b0c2b10135
commit
09e457003b
5 changed files with 20 additions and 0 deletions
|
|
@ -2996,6 +2996,7 @@ bool DivEngine::initAudioBackend() {
|
|||
|
||||
lowQuality=getConfInt("audioQuality",0);
|
||||
forceMono=getConfInt("forceMono",0);
|
||||
clampSamples=getConfInt("clampSamples",0);
|
||||
lowLatency=getConfInt("lowLatency",0);
|
||||
metroVol=(float)(getConfInt("metroVol",100))/100.0f;
|
||||
if (metroVol<0.0f) metroVol=0.0f;
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ class DivEngine {
|
|||
bool stopExport;
|
||||
bool halted;
|
||||
bool forceMono;
|
||||
bool clampSamples;
|
||||
bool cmdStreamEnabled;
|
||||
bool softLocked;
|
||||
bool firstTick;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue