commit 172a4da2eb4428d7e3c63493b85e7f7b51ae6a36
parent e010e0138b3c92f0b714bd35be1a2cf2d1a38845
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Tue, 6 Aug 2024 22:58:33 +0200
implement focused parameter via LCD, but commented because it doesn't look nice
Diffstat:
5 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/source/nord/n2x/n2xJucePlugin/CMakeLists.txt b/source/nord/n2x/n2xJucePlugin/CMakeLists.txt
@@ -6,6 +6,7 @@ set(SOURCES
n2xArp.cpp n2xArp.h
n2xController.cpp n2xController.h
n2xEditor.cpp n2xEditor.h
+ n2xFocusedParameter.cpp n2xFocusedParameter.h
n2xMasterVolume.cpp n2xMasterVolume.h
n2xOctLed.cpp n2xOctLed.h
n2xLcd.cpp n2xLcd.h
diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp b/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp
@@ -4,6 +4,7 @@
#include "n2xArp.h"
#include "n2xController.h"
+#include "n2xFocusedParameter.h"
#include "n2xLcd.h"
#include "n2xMasterVolume.h"
#include "n2xOctLed.h"
@@ -71,6 +72,7 @@ namespace n2xJucePlugin
}
m_arp.reset(new Arp(*this));
+ m_focusedParameter.reset(new FocusedParameter(*this));
m_lcd.reset(new Lcd(*this));
m_masterVolume.reset(new MasterVolume(*this));
m_octLed.reset(new OctLed(*this));
@@ -116,6 +118,7 @@ namespace n2xJucePlugin
Editor::~Editor()
{
m_arp.reset();
+ m_focusedParameter.reset();
m_lcd.reset();
m_masterVolume.reset();
m_octLed.reset();
diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.h b/source/nord/n2x/n2xJucePlugin/n2xEditor.h
@@ -16,6 +16,7 @@ namespace pluginLib
namespace n2xJucePlugin
{
+ class FocusedParameter;
class PatchManager;
class Controller;
@@ -49,6 +50,14 @@ namespace n2xJucePlugin
void onPatchActivated(const pluginLib::patchDB::PatchPtr& _patch, uint32_t _part);
+ pluginLib::ParameterBinding& getParameterBinding() const { return m_parameterBinding; }
+
+ Lcd& getLCD() const
+ {
+ assert(m_lcd);
+ return *m_lcd.get();
+ }
+
private:
void onBtSave() const;
void onBtPrev() const;
@@ -60,6 +69,7 @@ namespace n2xJucePlugin
pluginLib::ParameterBinding& m_parameterBinding;
std::unique_ptr<Arp> m_arp;
+ std::unique_ptr<FocusedParameter> m_focusedParameter;
std::unique_ptr<Lcd> m_lcd;
std::unique_ptr<MasterVolume> m_masterVolume;
std::unique_ptr<OctLed> m_octLed;
diff --git a/source/nord/n2x/n2xJucePlugin/n2xFocusedParameter.cpp b/source/nord/n2x/n2xJucePlugin/n2xFocusedParameter.cpp
@@ -0,0 +1,20 @@
+#include "n2xFocusedParameter.h"
+
+#include "n2xEditor.h"
+#include "n2xController.h"
+
+namespace n2xJucePlugin
+{
+ FocusedParameter::FocusedParameter(const Editor& _editor)
+ : jucePluginEditorLib::FocusedParameter(_editor.getN2xController(), _editor.getParameterBinding(), _editor)
+ , m_editor(_editor)
+ {
+ }
+
+ void FocusedParameter::updateParameter(const std::string& _name, const std::string& _value)
+ {
+ // we only have 3 digits but some parameters have values <= -100, doesn't look nice at all
+// m_editor.getLCD().setOverrideText(_value);
+ jucePluginEditorLib::FocusedParameter::updateParameter(_name, _value);
+ }
+}
diff --git a/source/nord/n2x/n2xJucePlugin/n2xFocusedParameter.h b/source/nord/n2x/n2xJucePlugin/n2xFocusedParameter.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "jucePluginEditorLib/focusedParameter.h"
+
+namespace n2xJucePlugin
+{
+ class Editor;
+
+ class FocusedParameter : public jucePluginEditorLib::FocusedParameter
+ {
+ public:
+ explicit FocusedParameter(const Editor& _editor);
+ void updateParameter(const std::string& _name, const std::string& _value) override;
+
+ private:
+ const Editor& m_editor;
+ };
+}