mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 21:15:11 +00:00
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();
|
||||
|
|
|
@ -1094,6 +1094,7 @@ class FurnaceGUI {
|
|||
int dragMovesSelection;
|
||||
int unsignedDetune;
|
||||
int noThreadedInput;
|
||||
int clampSamples;
|
||||
unsigned int maxUndoSteps;
|
||||
String mainFontPath;
|
||||
String patFontPath;
|
||||
|
@ -1199,6 +1200,7 @@ class FurnaceGUI {
|
|||
dragMovesSelection(1),
|
||||
unsignedDetune(0),
|
||||
noThreadedInput(0),
|
||||
clampSamples(0),
|
||||
maxUndoSteps(100),
|
||||
mainFontPath(""),
|
||||
patFontPath(""),
|
||||
|
|
|
@ -659,6 +659,11 @@ void FurnaceGUI::drawSettings() {
|
|||
settings.forceMono=forceMonoB;
|
||||
}
|
||||
|
||||
bool clampSamplesB=settings.clampSamples;
|
||||
if (ImGui::Checkbox("Software clipping",&clampSamplesB)) {
|
||||
settings.clampSamples=clampSamplesB;
|
||||
}
|
||||
|
||||
TAAudioDesc& audioWant=e->getAudioDescWant();
|
||||
TAAudioDesc& audioGot=e->getAudioDescGot();
|
||||
|
||||
|
@ -2118,6 +2123,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.unsignedDetune=e->getConfInt("unsignedDetune",0);
|
||||
settings.noThreadedInput=e->getConfInt("noThreadedInput",0);
|
||||
settings.initialSysName=e->getConfString("initialSysName","");
|
||||
settings.clampSamples=e->getConfInt("clampSamples",0);
|
||||
|
||||
clampSetting(settings.mainFontSize,2,96);
|
||||
clampSetting(settings.patFontSize,2,96);
|
||||
|
@ -2205,6 +2211,7 @@ void FurnaceGUI::syncSettings() {
|
|||
clampSetting(settings.dragMovesSelection,0,2);
|
||||
clampSetting(settings.unsignedDetune,0,1);
|
||||
clampSetting(settings.noThreadedInput,0,1);
|
||||
clampSetting(settings.clampSamples,0,1);
|
||||
|
||||
settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys",""));
|
||||
if (settings.initialSys.size()<4) {
|
||||
|
@ -2343,6 +2350,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("dragMovesSelection",settings.dragMovesSelection);
|
||||
e->setConf("unsignedDetune",settings.unsignedDetune);
|
||||
e->setConf("noThreadedInput",settings.noThreadedInput);
|
||||
e->setConf("clampSamples",settings.clampSamples);
|
||||
|
||||
// colors
|
||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||
|
|
Loading…
Reference in a new issue