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 86f0b2bdc9381b2e7d92fdfc1554236e60a4f217
parent e4f6814b9a602f490de1025fa64614aa96ef9e5e
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 18 Apr 2024 22:03:02 +0200

focused parameter now displayed in LCD

Diffstat:
Msource/xtJucePlugin/xtEditor.cpp | 10+++++++---
Msource/xtJucePlugin/xtEditor.h | 6+++++-
Asource/xtJucePlugin/xtFocusedParameter.cpp | 22++++++++++++++++++++++
Asource/xtJucePlugin/xtFocusedParameter.h | 19+++++++++++++++++++
Msource/xtJucePlugin/xtFrontPanel.h | 5+++++
Msource/xtJucePlugin/xtLcd.cpp | 26++++++++++++++++++++++++--
Msource/xtJucePlugin/xtLcd.h | 7+++++++
7 files changed, 89 insertions(+), 6 deletions(-)

diff --git a/source/xtJucePlugin/xtEditor.cpp b/source/xtJucePlugin/xtEditor.cpp @@ -4,11 +4,10 @@ #include "PluginProcessor.h" #include "xtController.h" +#include "xtFocusedParameter.h" #include "xtFrontPanel.h" #include "xtPatchManager.h" -#include "../jucePluginEditorLib/focusedParameter.h" - namespace xtJucePlugin { Editor::Editor(jucePluginEditorLib::Processor& _processor, pluginLib::ParameterBinding& _binding, std::string _skinFolder, const std::string& _jsonFilename) @@ -17,7 +16,7 @@ namespace xtJucePlugin { create(_jsonFilename); - m_focusedParameter.reset(new jucePluginEditorLib::FocusedParameter(m_controller, _binding, *this)); + m_focusedParameter.reset(new FocusedParameter(m_controller, _binding, *this)); m_frontPanel.reset(new FrontPanel(*this, m_controller)); @@ -77,6 +76,11 @@ namespace xtJucePlugin }; } + XtLcd* Editor::getLcd() const + { + return m_frontPanel->getLcd(); + } + void Editor::mouseEnter(const juce::MouseEvent& _event) { m_focusedParameter->onMouseEnter(_event); diff --git a/source/xtJucePlugin/xtEditor.h b/source/xtJucePlugin/xtEditor.h @@ -2,6 +2,7 @@ #include "../jucePluginEditorLib/pluginEditor.h" +class XtLcd; class Controller; namespace jucePluginEditorLib @@ -17,6 +18,7 @@ namespace pluginLib namespace xtJucePlugin { + class FocusedParameter; class FrontPanel; class PatchManager; @@ -37,11 +39,13 @@ namespace xtJucePlugin Controller& getXtController() const { return m_controller; } + XtLcd* getLcd() const; private: void mouseEnter(const juce::MouseEvent& _event) override; Controller& m_controller; - std::unique_ptr<jucePluginEditorLib::FocusedParameter> m_focusedParameter; + + std::unique_ptr<FocusedParameter> m_focusedParameter; std::unique_ptr<FrontPanel> m_frontPanel; }; } diff --git a/source/xtJucePlugin/xtFocusedParameter.cpp b/source/xtJucePlugin/xtFocusedParameter.cpp @@ -0,0 +1,22 @@ +#include "xtFocusedParameter.h" + +#include "xtEditor.h" +#include "xtLcd.h" + +namespace xtJucePlugin +{ + FocusedParameter::FocusedParameter(const pluginLib::Controller& _controller, const pluginLib::ParameterBinding& _parameterBinding, const Editor& _editor) + : jucePluginEditorLib::FocusedParameter(_controller, _parameterBinding, _editor) + , m_editor(_editor) + { + } + + void FocusedParameter::updateParameter(const std::string& _name, const std::string& _value) + { + auto* lcd = m_editor.getLcd(); + if(!lcd) + return; + + lcd->setCurrentParameter(_name, _value); + } +} diff --git a/source/xtJucePlugin/xtFocusedParameter.h b/source/xtJucePlugin/xtFocusedParameter.h @@ -0,0 +1,18 @@ +#pragma once + +#include "../jucePluginEditorLib/focusedParameter.h" + +namespace xtJucePlugin +{ + class Editor; + + class FocusedParameter : public jucePluginEditorLib::FocusedParameter + { + public: + FocusedParameter(const pluginLib::Controller& _controller, const pluginLib::ParameterBinding& _parameterBinding, const Editor& _editor); + + void updateParameter(const std::string& _name, const std::string& _value) override; + private: + const Editor& m_editor; + }; +} +\ No newline at end of file diff --git a/source/xtJucePlugin/xtFrontPanel.h b/source/xtJucePlugin/xtFrontPanel.h @@ -20,6 +20,11 @@ namespace xtJucePlugin void processSysex(const std::vector<uint8_t>& _msg) const; + XtLcd* getLcd() const + { + return m_lcd.get(); + } + private: void processLCDUpdate(const std::vector<uint8_t>& _msg) const; void processLedUpdate(const std::vector<uint8_t>& _msg) const; diff --git a/source/xtJucePlugin/xtLcd.cpp b/source/xtJucePlugin/xtLcd.cpp @@ -9,19 +9,33 @@ XtLcd::XtLcd(Component& _parent) : Lcd(_parent, 40, 2) { postConstruct(); + + m_currentText.fill(' '); } XtLcd::~XtLcd() = default; void XtLcd::setText(const std::array<uint8_t, 80>& _text) { - const std::vector<uint8_t> text{_text.begin(), _text.end()}; + m_currentText = _text; + + std::vector<uint8_t> text{_text.begin(), _text.end()}; + + if(!m_paramName.empty() && !m_paramValue.empty()) + { + const auto param = '[' + m_paramName + " = " + m_paramValue + ']'; + if(param.size() <= 40) + { + memcpy(text.data() + 40 - param.size(), param.c_str(), param.size()); + } + } + Lcd::setText(text); } bool XtLcd::getOverrideText(std::vector<std::vector<uint8_t>>& _lines) { - const std::string lineA(std::string("Vavra v") + g_pluginVersionString); + const std::string lineA(std::string("Xenia v") + g_pluginVersionString); const std::string lineB = __DATE__ " " __TIME__; _lines = @@ -37,3 +51,11 @@ const uint8_t* XtLcd::getCharacterData(const uint8_t _character) const { return wLib::getCharacterData(_character); } + +void XtLcd::setCurrentParameter(const std::string& _name, const std::string& _value) +{ + m_paramName = _name; + m_paramValue = _value; + + setText(m_currentText); +} diff --git a/source/xtJucePlugin/xtLcd.h b/source/xtJucePlugin/xtLcd.h @@ -14,4 +14,11 @@ public: bool getOverrideText(std::vector<std::vector<uint8_t>>& _lines) override; const uint8_t* getCharacterData(uint8_t _character) const override; + + void setCurrentParameter(const std::string& _name, const std::string& _value); + +private: + std::array<uint8_t, 80> m_currentText; + std::string m_paramName; + std::string m_paramValue; };