From 0c79280aae24b3668602366b59a113c2ba7f8803 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 2 Oct 2022 01:32:12 -0500 Subject: [PATCH] GUI: fix loop not updating samples on SNES --- src/engine/engine.cpp | 12 ++++++++++++ src/engine/engine.h | 3 +++ src/engine/playback.cpp | 2 +- src/gui/sampleEdit.cpp | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 4a166739..f3a300e7 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -985,6 +985,16 @@ int DivEngine::loadSampleROM(String path, ssize_t expectedSize, unsigned char*& return 0; } +unsigned int DivEngine::getSampleFormatMask() { + unsigned int formatMask=1U<<16; // 16-bit is always on + for (int i=0; isampleFormatMask; + } + return formatMask; +} + int DivEngine::loadSampleROMs() { if (yrw801ROM!=NULL) { delete[] yrw801ROM; @@ -1016,6 +1026,8 @@ void DivEngine::renderSamples() { sPreview.pos=0; sPreview.dir=false; + logD("rendering samples..."); + // step 0: make sample format mask unsigned int formatMask=1U<<16; // 16-bit is always on for (int i=0; iloopEnd=sample->samples; } updateSampleTex=true; + if (e->getSampleFormatMask()&(1U<renderSamplesP(); + } } if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) { ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!"); @@ -156,6 +159,9 @@ void FurnaceGUI::drawSampleEdit() { sample->loopStart=sample->loopEnd; } updateSampleTex=true; + if (e->getSampleFormatMask()&(1U<renderSamplesP(); + } } if (ImGui::IsItemActive()) { keepLoopAlive=true; @@ -175,6 +181,9 @@ void FurnaceGUI::drawSampleEdit() { sample->loopEnd=sample->samples; } updateSampleTex=true; + if (e->getSampleFormatMask()&(1U<renderSamplesP(); + } } if (ImGui::IsItemActive()) { keepLoopAlive=true; @@ -693,6 +702,9 @@ void FurnaceGUI::drawSampleEdit() { sample->loopEnd=sample->samples; } updateSampleTex=true; + if (e->getSampleFormatMask()&(1U<renderSamplesP(); + } } if (ImGui::IsItemHovered() && sample->depth==DIV_SAMPLE_DEPTH_BRR) { ImGui::SetTooltip("changing the loop in a BRR sample may result in glitches!"); @@ -729,6 +741,9 @@ void FurnaceGUI::drawSampleEdit() { if (sample->loopStart>sample->loopEnd) { sample->loopStart=sample->loopEnd; } + if (e->getSampleFormatMask()&(1U<renderSamplesP(); + } updateSampleTex=true; } if (ImGui::IsItemActive()) { @@ -748,6 +763,9 @@ void FurnaceGUI::drawSampleEdit() { if (sample->loopEnd>=(int)sample->samples) { sample->loopEnd=sample->samples; } + if (e->getSampleFormatMask()&(1U<renderSamplesP(); + } updateSampleTex=true; } if (ImGui::IsItemActive()) {