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 0f9cce5aa84545fd86e82eedbbeabe3106340b8c
parent 30473ab9bd1525732c2d07edda19d934f414ea55
Author: Tal Aviram <me@talaviram.com>
Date:   Fri, 30 Jul 2021 08:15:43 +0300

controller - add getters for preset names.

Diffstat:
Msource/jucePlugin/VirusController.cpp | 23++++++++++++++++++++++-
Msource/jucePlugin/VirusController.h | 6+++++-
2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/source/jucePlugin/VirusController.cpp b/source/jucePlugin/VirusController.cpp @@ -130,6 +130,27 @@ namespace Virus */ } + juce::StringArray Controller::getSinglePresetNames(int bank) const + { + if (bank > 1 || bank < 0) + { + jassertfalse; + return {}; + } + + juce::StringArray bankNames; + for (auto i = 0; i < 128; i++) + bankNames.add(parseAsciiText(m_singles[0][i].data, 128 + 112)); + return bankNames; + } + juce::StringArray Controller::getMultiPresetsName() const + { + juce::StringArray bankNames; + for (auto i = 0; i < 128; i++) + bankNames.add(parseAsciiText(m_multis[i].data, 0)); + return bankNames; + } + void Controller::parseSingle(const SysEx &msg) { constexpr auto pageSize = 128; @@ -564,7 +585,7 @@ namespace Virus return sum; } - juce::String Controller::parseAsciiText(const SysEx &msg, const int start) + template <typename T> juce::String Controller::parseAsciiText(const T &msg, const int start) const { char text[kNameLength + 1]; text[kNameLength] = 0; // termination diff --git a/source/jucePlugin/VirusController.h b/source/jucePlugin/VirusController.h @@ -28,6 +28,10 @@ namespace Virus // paramIndex - [0-127] juce::Value *getParam(uint8_t ch, uint8_t bank, uint8_t paramIndex); + // bank - 0-1 (AB) + juce::StringArray getSinglePresetNames(int bank) const; + juce::StringArray getMultiPresetsName() const; + private: static constexpr size_t kDataSizeInBytes = 256; // same for multi and single @@ -74,7 +78,7 @@ namespace Virus // unchecked copy for patch data bytes static inline uint8_t copyData(const SysEx &src, int startPos, uint8_t *dst); - juce::String parseAsciiText(const SysEx &, int startPos); + template <typename T> juce::String parseAsciiText(const T &, int startPos) const; void parseMessage(const SysEx &); void parseSingle(const SysEx &); void parseMulti(const SysEx &);