GUI: add setting to remove ins/vol val on OFF/REL

This commit is contained in:
tildearrow 2023-08-05 03:37:03 -05:00
parent 1983529bdb
commit 2b78ea7abe
3 changed files with 32 additions and 0 deletions

View File

@ -1128,18 +1128,22 @@ void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
void FurnaceGUI::noteInput(int num, int key, int vol) {
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],true);
bool removeIns=false;
prepareUndo(GUI_UNDO_PATTERN_EDIT);
if (key==GUI_NOTE_OFF) { // note off
pat->data[cursor.y][0]=100;
pat->data[cursor.y][1]=0;
removeIns=true;
} else if (key==GUI_NOTE_OFF_RELEASE) { // note off + env release
pat->data[cursor.y][0]=101;
pat->data[cursor.y][1]=0;
removeIns=true;
} else if (key==GUI_NOTE_RELEASE) { // env release only
pat->data[cursor.y][0]=102;
pat->data[cursor.y][1]=0;
removeIns=true;
} else {
pat->data[cursor.y][0]=num%12;
pat->data[cursor.y][1]=num/12;
@ -1165,6 +1169,14 @@ void FurnaceGUI::noteInput(int num, int key, int vol) {
if (latchEffect!=-1) pat->data[cursor.y][4]=latchEffect;
if (latchEffectVal!=-1) pat->data[cursor.y][5]=latchEffectVal;
}
if (removeIns) {
if (settings.removeInsOff) {
pat->data[cursor.y][2]=-1;
}
if (settings.removeVolOff) {
pat->data[cursor.y][3]=-1;
}
}
makeUndo(GUI_UNDO_PATTERN_EDIT);
editAdvance();
curNibble=false;

View File

@ -1545,6 +1545,8 @@ class FurnaceGUI {
int memUsageUnit;
int cursorFollowsWheel;
int noDMFCompat;
int removeInsOff;
int removeVolOff;
unsigned int maxUndoSteps;
String mainFontPath;
String headFontPath;
@ -1704,6 +1706,8 @@ class FurnaceGUI {
memUsageUnit(1),
cursorFollowsWheel(0),
noDMFCompat(0),
removeInsOff(0),
removeVolOff(0),
maxUndoSteps(100),
mainFontPath(""),
headFontPath(""),

View File

@ -1738,6 +1738,16 @@ void FurnaceGUI::drawSettings() {
settings.absorbInsInput=absorbInsInputB;
}
bool removeInsOffB=settings.removeInsOff;
if (ImGui::Checkbox("Remove instrument value when inserting note off/release",&removeInsOffB)) {
settings.removeInsOff=removeInsOffB;
}
bool removeVolOffB=settings.removeVolOff;
if (ImGui::Checkbox("Remove volume value when inserting note off/release",&removeVolOffB)) {
settings.removeVolOff=removeVolOffB;
}
// SUBSECTION CURSOR MOVEMENT
CONFIG_SUBSECTION("Cursor movement");
@ -2923,6 +2933,8 @@ void FurnaceGUI::syncSettings() {
settings.memUsageUnit=e->getConfInt("memUsageUnit",1);
settings.cursorFollowsWheel=e->getConfInt("cursorFollowsWheel",0);
settings.noDMFCompat=e->getConfInt("noDMFCompat",0);
settings.removeInsOff=e->getConfInt("removeInsOff",0);
settings.removeVolOff=e->getConfInt("removeVolOff",0);
clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.headFontSize,2,96);
@ -3054,6 +3066,8 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.memUsageUnit,0,1);
clampSetting(settings.cursorFollowsWheel,0,1);
clampSetting(settings.noDMFCompat,0,1);
clampSetting(settings.removeInsOff,0,1);
clampSetting(settings.removeVolOff,0,1);
if (settings.exportLoops<0.0) settings.exportLoops=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
@ -3285,6 +3299,8 @@ void FurnaceGUI::commitSettings() {
e->setConf("memUsageUnit",settings.memUsageUnit);
e->setConf("cursorFollowsWheel",settings.cursorFollowsWheel);
e->setConf("noDMFCompat",settings.noDMFCompat);
e->setConf("removeInsOff",settings.removeInsOff);
e->setConf("removeVolOff",settings.removeVolOff);
// colors
for (int i=0; i<GUI_COLOR_MAX; i++) {