From 6297c4ce521b1d308cc199c5e97013baf15f90ce Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 27 Oct 2025 20:52:01 +0400 Subject: [PATCH 1/3] groove calculator --- src/gui/gui.cpp | 3 ++- src/gui/gui.h | 2 ++ src/gui/speed.cpp | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6a726d4fe..797b94cdd 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -9121,7 +9121,8 @@ FurnaceGUI::FurnaceGUI(): romMultiFile(false), romExportSave(false), pendingExport(NULL), - romExportExists(false) { + romExportExists(false), + desBpm(150.0) { // value keys valueKeys[SDLK_0]=0; valueKeys[SDLK_1]=1; diff --git a/src/gui/gui.h b/src/gui/gui.h index 6aaaf741e..db558b4c5 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2835,6 +2835,8 @@ class FurnaceGUI { std::vector randomDemoSong; + double desBpm; + void commandExportOptions(); void drawExportAudio(bool onWindow=false); diff --git a/src/gui/speed.cpp b/src/gui/speed.cpp index 02e04481a..56d6871d3 100644 --- a/src/gui/speed.cpp +++ b/src/gui/speed.cpp @@ -21,6 +21,7 @@ #include "imgui.h" #include "misc/cpp/imgui_stdlib.h" #include "intConst.h" +#include "IconsFontAwesome4.h" void FurnaceGUI::drawSpeed(bool asChild) { if (nextWindow==GUI_WINDOW_SPEED) { @@ -49,7 +50,7 @@ void FurnaceGUI::drawSpeed(bool asChild) { } } ImGui::TableNextColumn(); - float avail=ImGui::GetContentRegionAvail().x; + float avail=ImGui::GetContentRegionAvail().x-ImGui::GetStyle().ItemSpacing.x*2-ImGui::GetFontSize(); float halfAvail=(avail-ImGui::GetStyle().ItemSpacing.x)*0.5; ImGui::SetNextItemWidth(halfAvail); float setHz=tempoView?e->curSubSong->hz*2.5:e->curSubSong->hz; @@ -161,6 +162,37 @@ void FurnaceGUI::drawSpeed(bool asChild) { } } } + ImGui::SameLine(); + ImGui::Button(ICON_FA_CALCULATOR "##grooveCalc"); + if (ImGui::BeginPopupContextItem("##grooveCalc", ImGuiPopupFlags_MouseButtonLeft)) { + ImGui::InputDouble("Desired BPM", &desBpm); + if (ImGui::Button("OK")) {; + e->lockEngine([this]() { + unsigned char* out=e->curSubSong->speeds.val; + memset(out, 0, 16*sizeof(char)); + double calcBpm=0, tickTrack=0; + int len=0; + while (len<16) { + if (fabs(desBpm-calcBpm)<2.2204460492503130808472633361816e-12) break; + double noteTime=(1.0/(desBpm/60.0))/e->curSubSong->hilightA; + double noteTick=noteTime*e->curSubSong->hz; + tickTrack+=noteTick; + int totalNum=0; + for (int i=0; icurSubSong->hz)*e->curSubSong->hilightA); + } + e->curSubSong->speeds.len=len; + }); + if (e->isPlaying()) play(); + MARK_MODIFIED; + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); + } + avail=ImGui::GetContentRegionAvail().x; + halfAvail=(avail-ImGui::GetStyle().ItemSpacing.x)*0.5; ImGui::TableNextRow(); ImGui::TableNextColumn(); From 76dc7dfb011a68da24ba144161b9a6c5a8f81b66 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Mon, 27 Oct 2025 21:15:11 +0400 Subject: [PATCH 2/3] Revert "groove calculator" This reverts commit 6297c4ce521b1d308cc199c5e97013baf15f90ce. --- src/gui/gui.cpp | 3 +-- src/gui/gui.h | 2 -- src/gui/speed.cpp | 34 +--------------------------------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 797b94cdd..6a726d4fe 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -9121,8 +9121,7 @@ FurnaceGUI::FurnaceGUI(): romMultiFile(false), romExportSave(false), pendingExport(NULL), - romExportExists(false), - desBpm(150.0) { + romExportExists(false) { // value keys valueKeys[SDLK_0]=0; valueKeys[SDLK_1]=1; diff --git a/src/gui/gui.h b/src/gui/gui.h index db558b4c5..6aaaf741e 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2835,8 +2835,6 @@ class FurnaceGUI { std::vector randomDemoSong; - double desBpm; - void commandExportOptions(); void drawExportAudio(bool onWindow=false); diff --git a/src/gui/speed.cpp b/src/gui/speed.cpp index 56d6871d3..02e04481a 100644 --- a/src/gui/speed.cpp +++ b/src/gui/speed.cpp @@ -21,7 +21,6 @@ #include "imgui.h" #include "misc/cpp/imgui_stdlib.h" #include "intConst.h" -#include "IconsFontAwesome4.h" void FurnaceGUI::drawSpeed(bool asChild) { if (nextWindow==GUI_WINDOW_SPEED) { @@ -50,7 +49,7 @@ void FurnaceGUI::drawSpeed(bool asChild) { } } ImGui::TableNextColumn(); - float avail=ImGui::GetContentRegionAvail().x-ImGui::GetStyle().ItemSpacing.x*2-ImGui::GetFontSize(); + float avail=ImGui::GetContentRegionAvail().x; float halfAvail=(avail-ImGui::GetStyle().ItemSpacing.x)*0.5; ImGui::SetNextItemWidth(halfAvail); float setHz=tempoView?e->curSubSong->hz*2.5:e->curSubSong->hz; @@ -162,37 +161,6 @@ void FurnaceGUI::drawSpeed(bool asChild) { } } } - ImGui::SameLine(); - ImGui::Button(ICON_FA_CALCULATOR "##grooveCalc"); - if (ImGui::BeginPopupContextItem("##grooveCalc", ImGuiPopupFlags_MouseButtonLeft)) { - ImGui::InputDouble("Desired BPM", &desBpm); - if (ImGui::Button("OK")) {; - e->lockEngine([this]() { - unsigned char* out=e->curSubSong->speeds.val; - memset(out, 0, 16*sizeof(char)); - double calcBpm=0, tickTrack=0; - int len=0; - while (len<16) { - if (fabs(desBpm-calcBpm)<2.2204460492503130808472633361816e-12) break; - double noteTime=(1.0/(desBpm/60.0))/e->curSubSong->hilightA; - double noteTick=noteTime*e->curSubSong->hz; - tickTrack+=noteTick; - int totalNum=0; - for (int i=0; icurSubSong->hz)*e->curSubSong->hilightA); - } - e->curSubSong->speeds.len=len; - }); - if (e->isPlaying()) play(); - MARK_MODIFIED; - ImGui::CloseCurrentPopup(); - } - ImGui::EndPopup(); - } - avail=ImGui::GetContentRegionAvail().x; - halfAvail=(avail-ImGui::GetStyle().ItemSpacing.x)*0.5; ImGui::TableNextRow(); ImGui::TableNextColumn(); From 3e270a38b553b7e3a3be547facc06ffe063fd8cf Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 29 Oct 2025 02:44:45 -0500 Subject: [PATCH 3/3] fix crash when chip output count changes --- src/engine/playback.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 72f09b431..bfd74f1f0 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -3351,6 +3351,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi DivDispatch* disp=disCont[i].dispatch; if (disp==NULL) continue; for (int j=0; jgetOutputCount(); j++) { + if (disCont[i].bbOut[j]==NULL) continue; chipPeak[i][j]*=1.0-decay; float peak=chipPeak[i][j]; for (unsigned int k=0; k