commit 5ed054ba4c5b361ac167f3a75eac85f30d8bbdb1
parent 3f0ba0d8800148629cfd2f53205704fbc2360b86
Author: Tal Aviram <me@talaviram.com>
Date: Tue, 17 Aug 2021 19:33:21 +0300
controller - getter for presetname from parameter data
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/source/jucePlugin/VirusController.cpp b/source/jucePlugin/VirusController.cpp
@@ -185,6 +185,17 @@ namespace Virus
return bankNames;
}
+ juce::String Controller::getCurrentPartPresetName(uint8_t part)
+ {
+ // expensive but fresh!
+ constexpr uint8_t asciiStart = 112;
+ char text[kNameLength + 1];
+ text[kNameLength] = 0; // termination
+ for (auto pos = 0; pos < kNameLength; ++pos)
+ text[pos] = static_cast<int>(getParam(part, 1, asciiStart + pos)->getValue());
+ return juce::String(text);
+ }
+
void Controller::setCurrentPartPreset(uint8_t part, uint8_t bank, uint8_t prg)
{
if (bank < 0 || bank > 1 || prg < 0 || prg > 127)
diff --git a/source/jucePlugin/VirusController.h b/source/jucePlugin/VirusController.h
@@ -34,6 +34,7 @@ namespace Virus
bool isMultiMode() { return getParam(0, 2, 0x7a)->getValue(); }
// part 0 - 15 (ignored when single! 0x40...)
void setCurrentPartPreset(uint8_t part, uint8_t bank, uint8_t prg);
+ juce::String getCurrentPartPresetName(uint8_t part);
private:
void timerCallback() override;