From 225cdead96c2393d7db91438fa433629f774ce44 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Wed, 15 Nov 2023 18:21:01 +0400 Subject: [PATCH] chanOsc visibility checklist --- src/engine/engine.h | 4 ++-- src/engine/fileOps.cpp | 22 ++++++++++++++++++---- src/engine/song.h | 2 ++ src/gui/chanOsc.cpp | 4 ++-- src/gui/channels.cpp | 16 +++++++++++++--- 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/engine/engine.h b/src/engine/engine.h index 43af4127f..0a55b8550 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev187" -#define DIV_ENGINE_VERSION 187 +#define DIV_VERSION "dev189" +#define DIV_ENGINE_VERSION 189 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index c2dea0085..5db45e335 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -2182,7 +2182,13 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { if (ds.version>=39) { for (int i=0; ichanShow[i]=reader.readC(); + if (ds.version<189) { + subSong->chanShow[i]=reader.readC(); + } else { // stores 2 bools in a single char for better compat? + unsigned char tempchar=reader.readC(); + subSong->chanShow[i]=tempchar&0xf; + subSong->chanShowChanOsc[i]=(tempchar>>4); + } } for (int i=0; ichanShow[i]=reader.readC(); + if (ds.version<189) { + subSong->chanShow[i]=reader.readC(); + } else { + unsigned char tempchar=reader.readC(); + subSong->chanShow[i]=tempchar&0xf; + subSong->chanShowChanOsc[i]=(tempchar>>4); + } } for (int i=0; ichanShow[i]=true; + ds.subsong[0]->chanShowChanOsc[i]=true; ds.subsong[0]->chanName[i]=fmt::sprintf("Channel %d",i+1); ds.subsong[0]->chanShortName[i]=fmt::sprintf("C%d",i+1); } for(int i=chCount; ipat[i].effectCols=1; ds.subsong[0]->chanShow[i]=false; + ds.subsong[0]->chanShowChanOsc[i]=false; } // instrument creation @@ -5402,7 +5416,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary, bool newPatternFormat) { } for (int i=0; iwriteC(subSong->chanShow[i]); + w->writeC(subSong->chanShow[i]+(subSong->chanShowChanOsc[i]<<4)); } for (int i=0; iwriteC(subSong->chanShow[i]); + w->writeC(subSong->chanShow[i]+(subSong->chanShowChanOsc[i]<<4)); } for (int i=0; igetOscBuffer(tryAgain); } - if (buf!=NULL && e->curSubSong->chanShow[i]) { + if (buf!=NULL && e->curSubSong->chanShowChanOsc[i]) { // 30ms should be enough int displaySize=(float)(buf->rate)*0.03f; if (e->isRunning()) { @@ -376,7 +376,7 @@ void FurnaceGUI::drawChanOsc() { // fill buffers for (int i=0; igetOscBuffer(i); - if (buf!=NULL && e->curSubSong->chanShow[i]) { + if (buf!=NULL && e->curSubSong->chanShowChanOsc[i]) { oscBufs.push_back(buf); oscFFTs.push_back(&chanOscChan[i]); oscChans.push_back(i); diff --git a/src/gui/channels.cpp b/src/gui/channels.cpp index 48dad94f5..f3e79fddc 100644 --- a/src/gui/channels.cpp +++ b/src/gui/channels.cpp @@ -38,22 +38,32 @@ void FurnaceGUI::drawChannels() { //ImGui::SetNextWindowSizeConstraints(ImVec2(440.0f*dpiScale,400.0f*dpiScale),ImVec2(canvasW,canvasH)); } if (ImGui::Begin("Channels",&channelsOpen,globalWinFlags)) { - if (ImGui::BeginTable("ChannelList",3)) { + if (ImGui::BeginTable("ChannelList",4)) { ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed,0.0); ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.0); ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthFixed,48.0f*dpiScale); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextColumn(); - ImGui::Text("Visible"); + ImGui::Text("Visibility"); ImGui::TableNextColumn(); ImGui::Text("Name"); for (int i=0; igetTotalChannelCount(); i++) { ImGui::PushID(i); ImGui::TableNextRow(); ImGui::TableNextColumn(); - if (ImGui::Checkbox("##Visible",&e->curSubSong->chanShow[i])) { + if (ImGui::Checkbox("##VisiblePat",&e->curSubSong->chanShow[i])) { MARK_MODIFIED; } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Show in pattern"); + } + ImGui::SameLine(); + if (ImGui::Checkbox("##VisibleChanOsc",&e->curSubSong->chanShowChanOsc[i])) { + MARK_MODIFIED; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip("Show in per-channel oscilloscope"); + } ImGui::SameLine(); if (ImGui::Button(ICON_FA_ARROWS)) { }