From 8cd045b04ac6046cf5ddb8e3e74eef88928bd900 Mon Sep 17 00:00:00 2001 From: LTVA1 <87536432+LTVA1@users.noreply.github.com> Date: Fri, 2 Aug 2024 19:02:50 +0300 Subject: [PATCH] add filter matrix to UI, add arp & pitch macros --- src/engine/platform/sid3.cpp | 17 +++++++ src/gui/insEdit.cpp | 89 ++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/src/engine/platform/sid3.cpp b/src/engine/platform/sid3.cpp index 6366bccec..19151c10f 100644 --- a/src/engine/platform/sid3.cpp +++ b/src/engine/platform/sid3.cpp @@ -168,6 +168,23 @@ void DivPlatformSID3::tick(bool sysTick) chan[i].outVol=VOL_SCALE_LINEAR(chan[i].vol&255,MIN(255,chan[i].std.vol.val),255); rWrite(13 + i * SID3_REGISTERS_PER_CHANNEL, chan[i].outVol); } + if (NEW_ARP_STRAT) { + chan[i].handleArp(); + } else if (chan[i].std.arp.had) { + if (!chan[i].inPorta) { + chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val)); + } + chan[i].freqChanged=true; + } + if (chan[i].std.pitch.had) { + if (chan[i].std.pitch.mode) { + chan[i].pitch2+=chan[i].std.pitch.val; + CLAMP_VAR(chan[i].pitch2,-65535,65535); + } else { + chan[i].pitch2=chan[i].std.pitch.val; + } + chan[i].freqChanged=true; + } if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 0f1af4f71..a0d07effa 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -5665,6 +5665,11 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins) { DivInstrumentSID3::Filter* filt = &ins->sid3.filt[i]; + if(filt->enabled) + { + ImGui::Separator(); + } + bool enable=filt->enabled; snprintf(buffer, 40, _("Enable filter %d"), i + 1); if (ImGui::Checkbox(buffer,&enable)) { PARAMETER @@ -5732,6 +5737,90 @@ void FurnaceGUI::drawInsSID3(DivInstrument* ins) } } + ImGui::Separator(); + + if (ImGui::BeginTable("SID3filtmatrix",1)) + { + if (waveGenVisible) ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed,250.0f*dpiScale); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + + CENTER_TEXT(_("Filters connection matrix")); + ImGui::Text(_("Filters connection matrix")); + + if (ImGui::BeginTable("SID3checkboxesmatrix",3 + SID3_NUM_FILTERS)) + { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text(">>"); + ImGui::TableNextColumn(); + ImGui::Text(_("In")); + + for(int i = 0; i < SID3_NUM_FILTERS; i++) + { + ImGui::TableNextColumn(); + ImGui::Text("%d", i + 1); + } + + ImGui::TableNextColumn(); + ImGui::Text(_("Out")); + + ImGui::TableNextRow(); + + for(int i = 0; i < SID3_NUM_FILTERS; i++) + { + DivInstrumentSID3::Filter* filt = &ins->sid3.filt[i]; + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%d", i + 1); + + ImGui::TableNextColumn(); + + snprintf(buffer, 40, "##filtmatrixin%d", i + 1); + bool toInput=filt->mode & SID3_FILTER_CHANNEL_INPUT; + if (ImGui::Checkbox(buffer,&toInput)) { PARAMETER + filt->mode ^= SID3_FILTER_CHANNEL_INPUT; + } + if (ImGui::IsItemHovered()) + { + ImGui::SetTooltip(_("Feed signal from channel to filter %d input"), i + 1); + } + + for(int j = 0; j < SID3_NUM_FILTERS; j++) + { + ImGui::TableNextColumn(); + snprintf(buffer, 40, "##filtmatrix%d%d", i + 1, j + 1); + + bool enable=filt->filter_matrix & (1 << j); + if (ImGui::Checkbox(buffer,&enable)) { PARAMETER + filt->filter_matrix ^= (1 << j); + } + if (ImGui::IsItemHovered()) + { + ImGui::SetTooltip(_("Feed signal from filter %d output to filter %d input"), j + 1, i + 1); + } + } + + ImGui::TableNextColumn(); + + snprintf(buffer, 40, "##filtmatrixout%d", i + 1); + bool toOutput=filt->mode & SID3_FILTER_OUTPUT; + if (ImGui::Checkbox(buffer,&toOutput)) { PARAMETER + filt->mode ^= SID3_FILTER_OUTPUT; + } + if (ImGui::IsItemHovered()) + { + ImGui::SetTooltip(_("Feed signal from filter %d output to channel output"), i + 1); + } + } + + ImGui::EndTable(); + } + + ImGui::EndTable(); + } + ImGui::EndTabItem(); }