gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 314559327e13d1dc2b09df3a3ede19006e33a6e3
parent f92083526a22f59b30f6feaf5a7b33ca43e9497d
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat,  8 Mar 2025 04:16:30 +0100

better user wave slot selection sub menu

Diffstat:
Msource/xtJucePlugin/xtWaveEditor.cpp | 24+++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/source/xtJucePlugin/xtWaveEditor.cpp b/source/xtJucePlugin/xtWaveEditor.cpp @@ -205,18 +205,28 @@ namespace xtJucePlugin { juce::PopupMenu subMenu; - uint16_t count = 0; - for (uint16_t i = xt::wave::g_firstRamWaveIndex; i < xt::wave::g_firstRamWaveIndex + xt::wave::g_ramWaveCount; ++i) + constexpr auto totalCount = (xt::wave::g_ramWaveCount - xt::wave::g_firstRamWaveIndex); + + constexpr auto divide = 25; + static_assert(totalCount / divide * divide == totalCount); + + for (uint16_t i = xt::wave::g_firstRamWaveIndex; i < xt::wave::g_firstRamWaveIndex + xt::wave::g_ramWaveCount; i += divide) { - const auto id = xt::WaveId(i); - subMenu.addItem(WaveTreeItem::getWaveName(id), true, false, [id, _callback] + juce::PopupMenu subSubMenu; + + const auto idMin = xt::WaveId(i); + const auto idMax = xt::WaveId(i+divide-1); + + for (uint16_t j=i; j<i+divide; ++j) + { + const auto id = xt::WaveId(j); + subSubMenu.addItem(WaveTreeItem::getWaveName(id), true, false, [id, _callback] { _callback(id); }); + } - ++count; - if ((count % 25) == 0) - subMenu.addColumnBreak(); + subMenu.addSubMenu(WaveTreeItem::getWaveName(idMin) + " - " + WaveTreeItem::getWaveName(idMax), subSubMenu); } return subMenu;