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 76d33a0f4e84aea26f129110707333222bc281db
parent b331fa7adb52f4bb164dbe1f485b06729541ab03
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu,  7 Apr 2022 21:51:39 +0200

fix assert when saving preset

Diffstat:
Msource/jucePlugin/VirusController.cpp | 14++++++++++----
Msource/jucePlugin/VirusController.h | 7++++++-
2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/source/jucePlugin/VirusController.cpp b/source/jucePlugin/VirusController.cpp @@ -232,7 +232,6 @@ namespace Virus if (params.empty()) { // unregistered param? - jassertfalse; return nullptr; } return &params.front()->getValueObject(); @@ -337,8 +336,11 @@ namespace Virus void Controller::setSinglePresetName(uint8_t part, juce::String _name) { constexpr uint8_t asciiStart = 112; _name = _name.substring(0,kNameLength).paddedRight(' ', kNameLength); - for (int i = 0; i < kNameLength; i++) { - getParamValue(part, 1, asciiStart+i)->setValue(static_cast<uint8_t>(_name[i])); + for (int i = 0; i < kNameLength; i++) + { + auto* value = getParamValue(part, 1, asciiStart+i); + jassert(value); + value->setValue(static_cast<uint8_t>(_name[i])); } } juce::String Controller::getCurrentPartPresetName(uint8_t part) @@ -348,7 +350,11 @@ namespace Virus char text[kNameLength + 1]; text[kNameLength] = 0; // termination for (auto pos = 0; pos < kNameLength; ++pos) - text[pos] = static_cast<int>(getParamValue(part, 1, asciiStart + pos)->getValue()); + { + auto* value = getParamValue(part, 1, asciiStart + pos); + jassert(value); + text[pos] = static_cast<int>(value->getValue()); + } return {text}; } diff --git a/source/jucePlugin/VirusController.h b/source/jucePlugin/VirusController.h @@ -75,7 +75,12 @@ namespace Virus juce::StringArray getMultiPresetsName() const; void setSinglePresetName(uint8_t part, juce::String _name); - bool isMultiMode() { return getParamValue(0, 2, 0x7a)->getValue(); } + bool isMultiMode() + { + auto* value = getParamValue(0, 2, 0x7a); + jassert(value); + return value->getValue(); + } // part 0 - 15 (ignored when single! 0x40...) void setCurrentPartPreset(uint8_t _part, virusLib::BankNumber _bank, uint8_t _prg); virusLib::BankNumber getCurrentPartBank(uint8_t part) const;