commit 820176092ac14a4f83cac142e0444ad29529bf8d
parent f6704a0712cfb876d951de1f75e092e6fa190b25
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sun, 4 Aug 2024 23:34:01 +0200
implement preset prev/next switches
Diffstat:
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp b/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp
@@ -77,14 +77,30 @@ namespace n2xJucePlugin
m_parameterBinding.setPart(_part);
});
- if(auto* btSave = findComponentT<juce::Button>("button_store"))
+ if(auto* bt = findComponentT<juce::Button>("button_store"))
{
- btSave->onClick = [this]
+ bt->onClick = [this]
{
onBtSave();
};
}
+ if(auto* bt = findComponentT<juce::Button>("PresetPrev"))
+ {
+ bt->onClick = [this]
+ {
+ onBtPrev();
+ };
+ }
+
+ if(auto* bt = findComponentT<juce::Button>("PresetNext"))
+ {
+ bt->onClick = [this]
+ {
+ onBtNext();
+ };
+ }
+
m_onSelectedPatchChanged.set(getPatchManager()->onSelectedPatchChanged, [this](const uint32_t& _part, const pluginLib::patchDB::PatchKey& _patchKey)
{
onSelectedPatchChanged(static_cast<uint8_t>(_part), _patchKey);
@@ -177,6 +193,16 @@ namespace n2xJucePlugin
menu.showMenuAsync({});
}
+ void Editor::onBtPrev() const
+ {
+ getPatchManager()->selectPrevPreset(m_controller.getCurrentPart());
+ }
+
+ void Editor::onBtNext() const
+ {
+ getPatchManager()->selectNextPreset(m_controller.getCurrentPart());
+ }
+
void Editor::setCurrentPatchName(uint8_t _part, const std::string& _name)
{
if(m_activePatchNames[_part] == _name)
diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.h b/source/nord/n2x/n2xJucePlugin/n2xEditor.h
@@ -47,6 +47,8 @@ namespace n2xJucePlugin
private:
void onBtSave() const;
+ void onBtPrev() const;
+ void onBtNext() const;
void setCurrentPatchName(uint8_t _part, const std::string& _name);
void onSelectedPatchChanged(uint8_t _part, const pluginLib::patchDB::PatchKey& _patchKey);