From 9affcc7fc2ade6ecbf10d32edc70cfeb3c8ce7bc Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 7 Apr 2024 01:14:56 +0400 Subject: [PATCH 1/4] vibrator settings --- src/gui/gui.h | 6 +++++- src/gui/settings.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index 46d1a5713..e25808439 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -56,7 +56,7 @@ // for now #define NOTIFY_LONG_HOLD \ if (vibrator && vibratorAvailable) { \ - if (SDL_HapticRumblePlay(vibrator,0.5f,20)!=0) { \ + if (SDL_HapticRumblePlay(vibrator,settings.vibrationStrength,settings.vibrationLength)!=0) { \ logV("could not vibrate: %s!",SDL_GetError()); \ } \ } else { \ @@ -1823,6 +1823,8 @@ class FurnaceGUI { int vsync; int frameRateLimit; unsigned int maxUndoSteps; + float vibrationStrength; + int vibrationLength; String mainFontPath; String headFontPath; String patFontPath; @@ -2054,6 +2056,8 @@ class FurnaceGUI { vsync(1), frameRateLimit(60), maxUndoSteps(100), + vibrationStrength(0.5f), + vibrationLength(100), mainFontPath(""), headFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index c40b7ed45..8de1b341e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -530,6 +530,16 @@ void FurnaceGUI::drawSettings() { } ImGui::Unindent(); +#ifdef IS_MOBILE + // SUBSECTION HAPTIC + CONFIG_SUBSECTION("Vibration"); + + ImGui::Indent(); + if (ImGui::SliderFloat("Strength",&settings.vibrationStrength,0.0f,1.0f)) settingsChanged=true; + if (ImGui::SliderInt("Length",&settings.vibrationLength,50,500)) settingsChanged=true; + ImGui::Unindent(); +#endif + // SUBSECTION FILE CONFIG_SUBSECTION("File"); @@ -4015,6 +4025,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { settings.newSongBehavior=conf.getInt("newSongBehavior",0); settings.playOnLoad=conf.getInt("playOnLoad",0); settings.centerPopup=conf.getInt("centerPopup",1); + + settings.vibrationStrength=conf.getFloat("vibrationStrength",0.5f); + settings.vibrationLength=conf.getInt("vibrationLength",100); } if (groups&GUI_SETTINGS_AUDIO) { @@ -4485,6 +4498,8 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.cursorWheelStep,0,1); clampSetting(settings.vsync,0,4); clampSetting(settings.frameRateLimit,0,1000); + clampSetting(settings.vibrationStrength,0.0f,1.0f); + clampSetting(settings.vibrationLength,50,500); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -4546,6 +4561,9 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { conf.set("newSongBehavior",settings.newSongBehavior); conf.set("playOnLoad",settings.playOnLoad); conf.set("centerPopup",settings.centerPopup); + + conf.set("vibrationStrength",settings.vibrationStrength); + conf.set("vibrationLength",settings.vibrationLength); } // audio From f9056326ad795518e0b6c6360eb7b32ce9c17f0a Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 7 Apr 2024 01:21:31 +0400 Subject: [PATCH 2/4] missing? --- src/gui/xyOsc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/xyOsc.cpp b/src/gui/xyOsc.cpp index 930ed5d60..5a727127d 100644 --- a/src/gui/xyOsc.cpp +++ b/src/gui/xyOsc.cpp @@ -222,6 +222,10 @@ void FurnaceGUI::drawXYOsc() { if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { xyOscOptions=true; } + if (ImGui::IsItemHovered() && CHECK_LONG_HOLD) { + NOTIFY_LONG_HOLD; + xyOscOptions=true; + } } } if (noPadding) { From 6b18f73c879a0b29309ad640d7b6b270a4a6fb93 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 7 Apr 2024 01:23:42 +0400 Subject: [PATCH 3/4] i guess not needed --- src/gui/editControls.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp index e17061d37..1753849a1 100644 --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -509,16 +509,6 @@ void FurnaceGUI::drawMobileControls() { doAction(GUI_ACTION_SAVE_AS); } - if (ImGui::Button("1.1+ .dmf")) { - mobileMenuOpen=false; - openFileDialog(GUI_FILE_SAVE_DMF); - } - ImGui::SameLine(); - if (ImGui::Button("Legacy .dmf")) { - mobileMenuOpen=false; - openFileDialog(GUI_FILE_SAVE_DMF_LEGACY); - } - ImGui::SameLine(); if (ImGui::Button("Export")) { doAction(GUI_ACTION_EXPORT); } From 2346e21df7cbb997bb084a60ce7a81f0fbb02728 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Tue, 9 Apr 2024 22:46:53 +0400 Subject: [PATCH 4/4] requested changes --- src/gui/settings.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 8de1b341e..fb743924c 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -531,12 +531,20 @@ void FurnaceGUI::drawSettings() { ImGui::Unindent(); #ifdef IS_MOBILE - // SUBSECTION HAPTIC + // SUBSECTION VIBRATION CONFIG_SUBSECTION("Vibration"); ImGui::Indent(); - if (ImGui::SliderFloat("Strength",&settings.vibrationStrength,0.0f,1.0f)) settingsChanged=true; - if (ImGui::SliderInt("Length",&settings.vibrationLength,50,500)) settingsChanged=true; + if (ImGui::SliderFloat("Strength",&settings.vibrationStrength,0.0f,1.0f)) { + if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f; + if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f; + settingsChanged=true; + } + + if (ImGui::SliderInt("Length",&settings.vibrationLength,10,500)) { + if (settings.vibrationLength<10) settings.vibrationLength=10; + if (settings.vibrationLength>500) settings.vibrationLength=500; + settingsChanged=true; ImGui::Unindent(); #endif @@ -4499,7 +4507,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.vsync,0,4); clampSetting(settings.frameRateLimit,0,1000); clampSetting(settings.vibrationStrength,0.0f,1.0f); - clampSetting(settings.vibrationLength,50,500); + clampSetting(settings.vibrationLength,10,500); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;