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 3d2c3bb70d901d503440c07f5cd4432309948173
parent 31bd20ed1b2de39033fd7ed714b0cc81aa9894a3
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Mon, 24 Jan 2022 22:29:11 +0100

remove traffic that we send to the DSP when loading state

Diffstat:
Msource/virusLib/microcontroller.cpp | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/source/virusLib/microcontroller.cpp b/source/virusLib/microcontroller.cpp @@ -121,12 +121,28 @@ void Microcontroller::writeHostBitsWithWait(const char flag1, const char flag2) m_hdi08.setHostFlags(flag1, flag2); } -bool Microcontroller::sendPreset(uint8_t program, const std::vector<TWord>& preset, bool isMulti) +bool Microcontroller::sendPreset(const uint8_t program, const std::vector<TWord>& preset, const bool isMulti) { std::lock_guard lock(m_mutex); if(m_hdi08.hasDataToSend() || needsToWaitForHostBits(0,1)) { + // if we write a multi or a multi mode single, remove a pending single for single mode + // If we write a single-mode single, remove all multi-related pending writes + const auto multiRelated = isMulti || program != SINGLE; + + for (auto it = m_pendingPresetWrites.begin(); it != m_pendingPresetWrites.end();) + { + const auto& pendingPreset = *it; + + const auto pendingIsMultiRelated = pendingPreset.isMulti || pendingPreset.program != SINGLE; + + if (multiRelated != pendingIsMultiRelated) + it = m_pendingPresetWrites.erase(it); + else + ++it; + } + for(auto it = m_pendingPresetWrites.begin(); it != m_pendingPresetWrites.end();) { const auto& pendingPreset = *it;