Merge remote-tracking branch 'Eknous-P/haptic-two'

This commit is contained in:
tildearrow 2024-04-10 12:28:31 -05:00
commit c8661648c5
4 changed files with 35 additions and 11 deletions

View file

@ -509,16 +509,6 @@ void FurnaceGUI::drawMobileControls() {
doAction(GUI_ACTION_SAVE_AS); 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")) { if (ImGui::Button("Export")) {
doAction(GUI_ACTION_EXPORT); doAction(GUI_ACTION_EXPORT);
} }

View file

@ -56,7 +56,7 @@
// for now // for now
#define NOTIFY_LONG_HOLD \ #define NOTIFY_LONG_HOLD \
if (vibrator && vibratorAvailable) { \ 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()); \ logV("could not vibrate: %s!",SDL_GetError()); \
} \ } \
} else { \ } else { \
@ -1844,6 +1844,8 @@ class FurnaceGUI {
int frameRateLimit; int frameRateLimit;
int displayRenderTime; int displayRenderTime;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
float vibrationStrength;
int vibrationLength;
String mainFontPath; String mainFontPath;
String headFontPath; String headFontPath;
String patFontPath; String patFontPath;
@ -2076,6 +2078,8 @@ class FurnaceGUI {
frameRateLimit(60), frameRateLimit(60),
displayRenderTime(0), displayRenderTime(0),
maxUndoSteps(100), maxUndoSteps(100),
vibrationStrength(0.5f),
vibrationLength(100),
mainFontPath(""), mainFontPath(""),
headFontPath(""), headFontPath(""),
patFontPath(""), patFontPath(""),

View file

@ -563,6 +563,24 @@ void FurnaceGUI::drawSettings() {
} }
ImGui::Unindent(); ImGui::Unindent();
#ifdef IS_MOBILE
// SUBSECTION VIBRATION
CONFIG_SUBSECTION("Vibration");
ImGui::Indent();
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
// SUBSECTION FILE // SUBSECTION FILE
CONFIG_SUBSECTION("File"); CONFIG_SUBSECTION("File");
@ -4049,6 +4067,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.newSongBehavior=conf.getInt("newSongBehavior",0); settings.newSongBehavior=conf.getInt("newSongBehavior",0);
settings.playOnLoad=conf.getInt("playOnLoad",0); settings.playOnLoad=conf.getInt("playOnLoad",0);
settings.centerPopup=conf.getInt("centerPopup",1); settings.centerPopup=conf.getInt("centerPopup",1);
settings.vibrationStrength=conf.getFloat("vibrationStrength",0.5f);
settings.vibrationLength=conf.getInt("vibrationLength",100);
} }
if (groups&GUI_SETTINGS_AUDIO) { if (groups&GUI_SETTINGS_AUDIO) {
@ -4520,6 +4541,8 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.vsync,0,4); clampSetting(settings.vsync,0,4);
clampSetting(settings.frameRateLimit,0,1000); clampSetting(settings.frameRateLimit,0,1000);
clampSetting(settings.displayRenderTime,0,1); clampSetting(settings.displayRenderTime,0,1);
clampSetting(settings.vibrationStrength,0.0f,1.0f);
clampSetting(settings.vibrationLength,10,500);
if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportLoops<0.0) settings.exportLoops=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
@ -4582,6 +4605,9 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("newSongBehavior",settings.newSongBehavior); conf.set("newSongBehavior",settings.newSongBehavior);
conf.set("playOnLoad",settings.playOnLoad); conf.set("playOnLoad",settings.playOnLoad);
conf.set("centerPopup",settings.centerPopup); conf.set("centerPopup",settings.centerPopup);
conf.set("vibrationStrength",settings.vibrationStrength);
conf.set("vibrationLength",settings.vibrationLength);
} }
// audio // audio

View file

@ -222,6 +222,10 @@ void FurnaceGUI::drawXYOsc() {
if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
xyOscOptions=true; xyOscOptions=true;
} }
if (ImGui::IsItemHovered() && CHECK_LONG_HOLD) {
NOTIFY_LONG_HOLD;
xyOscOptions=true;
}
} }
} }
if (noPadding) { if (noPadding) {