commit c856a9255e121f74c9c8b1b788500362a998c194 parent 1842b8fdebfa9846bfbd9d4c91a98edd0756189b Author: dsp56300 <dsp56300@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:54:21 +0200 fix preset prev/next buttons do not work before a preset is selected via dropdown menu, fixes #98 Diffstat:
M | source/jucePlugin/VirusController.cpp | | | 27 | ++++++++++++++++++++++++++- |
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/source/jucePlugin/VirusController.cpp b/source/jucePlugin/VirusController.cpp @@ -371,7 +371,32 @@ namespace Virus linkedParam->setValueFromSynth(it->second, true); } - if (onProgramChange) + bool found = false; + for(size_t b=0; b<m_singles.size() && !found; ++b) + { + const auto& singlePatches = m_singles[b]; + + for(size_t s=0; s<singlePatches.size(); ++s) + { + const auto& singlePatch = singlePatches[s]; + + if(singlePatch.name == patch.name) + { + m_currentBank[ch] = virusLib::fromArrayIndex(static_cast<uint8_t>(b)); + m_currentProgram[ch] = static_cast<uint8_t>(s); + found = true; + break; + } + } + } + + if(!found) + { + m_currentProgram[ch] = 0; + m_currentBank[ch] = virusLib::BankNumber::EditBuffer; + } + + if (onProgramChange) onProgramChange(); } else