From c5259066e1d1010006fd2eba007dcf5d00aefda6 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 16 May 2022 03:09:59 -0500 Subject: [PATCH 1/6] GUI: make backupTimer atomic --- src/gui/gui.cpp | 2 +- src/gui/gui.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d2d8a9e1..e5aa78e1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3550,7 +3550,7 @@ bool FurnaceGUI::loop() { // backup trigger if (modified) { if (backupTimer>0) { - backupTimer-=ImGui::GetIO().DeltaTime; + backupTimer=(backupTimer-ImGui::GetIO().DeltaTime); if (backupTimer<=0) { backupTask=std::async(std::launch::async,[this]() -> bool { if (backupPath==curFileName) { diff --git a/src/gui/gui.h b/src/gui/gui.h index b976a7cb..6f93c9f9 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -799,7 +799,7 @@ class FurnaceGUI { double aboutScroll, aboutSin; float aboutHue; - double backupTimer; + std::atomic backupTimer; std::future backupTask; std::mutex backupLock; String backupPath; From e3d2faf4273b80711828e0fc0582612c013e7850 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 16 May 2022 05:06:26 -0500 Subject: [PATCH 2/6] OPLL: fix fixed drums freq --- src/engine/platform/opll.cpp | 8 +++++--- src/engine/platform/opll.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index 50eab344..027acb79 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -301,6 +301,7 @@ void DivPlatformOPLL::tick(bool sysTick) { for (int i=0; i<11; i++) { if (chan[i].freqChanged) { chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq),chan[i].pitch2,chipClock,CHIP_FREQBASE); + if (chan[i].fixedFreq>0) chan[i].freq=chan[i].fixedFreq; if (chan[i].freq>262143) chan[i].freq=262143; int freqt=toFreq(chan[i].freq)+chan[i].pitch2; chan[i].freqL=freqt&0xff; @@ -420,15 +421,16 @@ int DivPlatformOPLL::dispatch(DivCommand c) { if (chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) { switch (c.chan) { case 6: - chan[c.chan].baseFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9); + chan[c.chan].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9); break; case 7: case 10: - chan[c.chan].baseFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9); + chan[c.chan].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9); break; case 8: case 9: - chan[c.chan].baseFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9); + chan[c.chan].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9); break; default: + chan[c.chan].fixedFreq=0; chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); break; } diff --git a/src/engine/platform/opll.h b/src/engine/platform/opll.h index 7a06bbb7..d2d20826 100644 --- a/src/engine/platform/opll.h +++ b/src/engine/platform/opll.h @@ -33,7 +33,7 @@ class DivPlatformOPLL: public DivDispatch { DivInstrumentFM state; DivMacroInt std; unsigned char freqH, freqL; - int freq, baseFreq, pitch, pitch2, note, ins; + int freq, baseFreq, pitch, pitch2, note, ins, fixedFreq; bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnaceDac, inPorta; int vol, outVol; unsigned char pan; @@ -50,6 +50,7 @@ class DivPlatformOPLL: public DivDispatch { pitch2(0), note(0), ins(-1), + fixedFreq(0), active(false), insChanged(true), freqChanged(false), From 0851f1dffc2dd06dda5bde80341ddcbe6ad699cc Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Mon, 16 May 2022 19:16:55 +0200 Subject: [PATCH 3/6] Install more size variations on Linux --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe911868..06c6a362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,6 +557,10 @@ if (NOT ANDROID) install(DIRECTORY papers DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/furnace) install(DIRECTORY demos DESTINATION ${CMAKE_INSTALL_DATADIR}/furnace) + foreach(num 16 32 64 128 256 512) + set(res ${num}x${num}) + install(FILES res/icon.iconset/icon_${res}.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${res}/apps) + endforeach() install(FILES res/logo.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/1024x1024/apps) endif() From 864e798686dbf5d03f1301db446808b854a7a397 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Mon, 16 May 2022 19:25:15 +0200 Subject: [PATCH 4/6] Add x2 icon variations as well --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06c6a362..c34d43da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -560,6 +560,7 @@ if (NOT ANDROID) foreach(num 16 32 64 128 256 512) set(res ${num}x${num}) install(FILES res/icon.iconset/icon_${res}.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${res}/apps) + install(FILES res/icon.iconset/icon_${res}@2x.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${res}@2/apps) endforeach() install(FILES res/logo.png RENAME furnace.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/1024x1024/apps) endif() From 0ae105ded3d27ecce3b94a52e5510a43bbac0f89 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 16 May 2022 12:33:12 -0500 Subject: [PATCH 5/6] hide .ftm format --- src/gui/gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e5aa78e1..42c08cb1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1221,9 +1221,9 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) { if (!dirExists(workingDirSong)) workingDirSong=getHomeDir(); hasOpened=fileDialog->openLoad( "Open File", - {"compatible files", "*.fur *.dmf *.mod *.ftm", + {"compatible files", "*.fur *.dmf *.mod", "all files", ".*"}, - "compatible files{.fur,.dmf,.mod,.ftm},.*", + "compatible files{.fur,.dmf,.mod},.*", workingDirSong, dpiScale ); From 1675456693c6241edd9fa04f7e4ddcfbd6bfde56 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 16 May 2022 13:37:41 -0500 Subject: [PATCH 6/6] AY: fix possible hang --- src/engine/platform/ay.cpp | 1 + src/engine/platform/sound/ay8910.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 94546ed1..329af958 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -660,6 +660,7 @@ void DivPlatformAY8910::setFlags(unsigned int flags) { break; } ay->device_start(); + ay->device_reset(); stereo=(flags>>6)&1; } diff --git a/src/engine/platform/sound/ay8910.cpp b/src/engine/platform/sound/ay8910.cpp index 3dddf82c..7b38ad31 100644 --- a/src/engine/platform/sound/ay8910.cpp +++ b/src/engine/platform/sound/ay8910.cpp @@ -1063,6 +1063,7 @@ void ay8910_device::sound_stream_update(short** outputs, int outLen) tone = &m_tone[chan]; const int period = tone->period * (m_step_mul << 1); tone->count += is_expanded_mode() ? 32 : ((m_feature & PSG_HAS_EXPANDED_MODE) ? 1 : 2); + if (period==0) continue; while (tone->count >= period) { tone->duty_cycle = (tone->duty_cycle - 1) & 0x1f;