diff --git a/src/gui/gui.h b/src/gui/gui.h index 66a135df9..00c7d8d09 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1995,6 +1995,7 @@ class FurnaceGUI { int backupMaxCopies; int autoFillSave; int autoMacroStepSize; + int backgroundPlay; unsigned int maxUndoSteps; float vibrationStrength; int vibrationLength; @@ -2254,6 +2255,7 @@ class FurnaceGUI { backupMaxCopies(5), autoFillSave(0), autoMacroStepSize(0), + backgroundPlay(0), maxUndoSteps(100), vibrationStrength(0.5f), vibrationLength(20), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index b9006af5f..806273909 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1260,6 +1260,16 @@ void FurnaceGUI::drawSettings() { settingsChanged=true; } +#ifdef ANDROID + // SUBSECTION ANDROID + CONFIG_SUBSECTION(_("Android")); + bool backgroundPlayB=settings.backgroundPlay; + if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) { + settings.backgroundPlay=backgroundPlayB; + settingsChanged=true; + } +#endif + END_SECTION; } CONFIG_SECTION(_("Audio")) { @@ -4850,6 +4860,8 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { settings.autoFillSave=conf.getInt("autoFillSave",0); settings.locale=conf.getString("locale",""); + + settings.backgroundPlay=conf.getInt("backgroundPlay",0); } if (groups&GUI_SETTINGS_AUDIO) { @@ -5371,6 +5383,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.autoFillSave,0,1); clampSetting(settings.autoMacroStepSize,0,2); clampSetting(settings.s3mOPL3,0,1); + clampSetting(settings.backgroundPlay,0,1); if (settings.exportLoops<0.0) settings.exportLoops=0.0; if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; @@ -5453,6 +5466,8 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { conf.set("autoFillSave",settings.autoFillSave); conf.set("locale",settings.locale); + + conf.set("backgroundPlay",settings.backgroundPlay); } // audio diff --git a/src/gui/subSongs.cpp b/src/gui/subSongs.cpp index cc69dbcd5..f67a85089 100644 --- a/src/gui/subSongs.cpp +++ b/src/gui/subSongs.cpp @@ -132,7 +132,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) { MARK_MODIFIED; } - if (!asChild && ImGui::GetContentRegionAvail().y>(10.0f*dpiScale)) { + if (ImGui::GetContentRegionAvail().y>(10.0f*dpiScale)) { if (ImGui::InputTextMultiline("##SubSongNotes",&e->curSubSong->notes,ImGui::GetContentRegionAvail(),ImGuiInputTextFlags_UndoRedo)) { MARK_MODIFIED; } diff --git a/src/main.cpp b/src/main.cpp index b1e2afd18..34cb46d75 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -510,13 +510,6 @@ static void handleTermGUI(int) { // TODO: CoInitializeEx on Windows? // TODO: add crash log int main(int argc, char** argv) { - // uncomment these if you want Furnace to play in the background on Android. - // not recommended. it lags. -#if defined(HAVE_SDL2) && defined(ANDROID) - //SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE,"0"); - //SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO,"0"); -#endif - // Windows console thing - thanks dj.tuBIG/MaliceX #ifdef _WIN32 #ifndef TA_SUBSYSTEM_CONSOLE @@ -751,6 +744,14 @@ int main(int argc, char** argv) { e.setAudio(DIV_AUDIO_DUMMY); } +#if defined(HAVE_SDL2) && defined(ANDROID) + if (e.getConfInt("backgroundPlay",0)!=0) { + SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE,"0"); + SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO,"0"); + } +#endif + + if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",TUT_INTRO_PLAYED)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || cmdOutName!="")) { logI("loading module..."); FILE* f=ps_fopen(fileName.c_str(),"rb");