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 92d587e0eba6a0dab053e4c7236b1029df8ac95b
parent bea35f149bf9e5834795b2c56373c305cf9853da
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Thu, 15 Aug 2024 14:23:44 +0200

implement output mode selection

Diffstat:
Msource/nord/n2x/n2xJucePlugin/CMakeLists.txt | 1+
Msource/nord/n2x/n2xJucePlugin/n2xEditor.cpp | 3+++
Msource/nord/n2x/n2xJucePlugin/n2xEditor.h | 2++
Asource/nord/n2x/n2xJucePlugin/n2xOutputMode.cpp | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asource/nord/n2x/n2xJucePlugin/n2xOutputMode.h | 30++++++++++++++++++++++++++++++
Msource/nord/n2x/n2xJucePlugin/parameterDescriptions_n2x.json | 2+-
Msource/nord/n2x/n2xJucePlugin/skins/n2xTrancy/n2xTrancy.json | 4++--
7 files changed, 117 insertions(+), 3 deletions(-)

diff --git a/source/nord/n2x/n2xJucePlugin/CMakeLists.txt b/source/nord/n2x/n2xJucePlugin/CMakeLists.txt @@ -9,6 +9,7 @@ set(SOURCES n2xFocusedParameter.cpp n2xFocusedParameter.h n2xMasterVolume.cpp n2xMasterVolume.h n2xOctLed.cpp n2xOctLed.h + n2xOutputMode.cpp n2xOutputMode.h n2xParameterDrivenLed.cpp n2xParameterDrivenLed.h n2xLcd.cpp n2xLcd.h n2xLfo.cpp n2xLfo.h diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp b/source/nord/n2x/n2xJucePlugin/n2xEditor.cpp @@ -9,6 +9,7 @@ #include "n2xLfo.h" #include "n2xMasterVolume.h" #include "n2xOctLed.h" +#include "n2xOutputMode.h" #include "n2xPart.h" #include "n2xParts.h" #include "n2xPatchManager.h" @@ -81,6 +82,7 @@ namespace n2xJucePlugin m_lfos[i].reset(new Lfo(*this, i)); m_masterVolume.reset(new MasterVolume(*this)); m_octLed.reset(new OctLed(*this)); + m_outputMode.reset(new OutputMode(*this)); m_parts.reset(new Parts(*this)); m_vmMap.reset(new VmMap(*this, m_parameterBinding)); m_midiPorts.reset(new jucePluginEditorLib::MidiPorts(*this, getProcessor())); @@ -130,6 +132,7 @@ namespace n2xJucePlugin lfo.reset(); m_masterVolume.reset(); m_octLed.reset(); + m_outputMode.reset(); m_parts.reset(); m_vmMap.reset(); m_midiPorts.reset(); diff --git a/source/nord/n2x/n2xJucePlugin/n2xEditor.h b/source/nord/n2x/n2xJucePlugin/n2xEditor.h @@ -17,6 +17,7 @@ namespace pluginLib namespace n2xJucePlugin { + class OutputMode; class Lfo; class FocusedParameter; class PatchManager; @@ -77,6 +78,7 @@ namespace n2xJucePlugin std::array<std::unique_ptr<Lfo>, 2> m_lfos; std::unique_ptr<MasterVolume> m_masterVolume; std::unique_ptr<OctLed> m_octLed; + std::unique_ptr<OutputMode> m_outputMode; std::unique_ptr<Parts> m_parts; std::unique_ptr<VmMap> m_vmMap; std::unique_ptr<jucePluginEditorLib::MidiPorts> m_midiPorts; diff --git a/source/nord/n2x/n2xJucePlugin/n2xOutputMode.cpp b/source/nord/n2x/n2xJucePlugin/n2xOutputMode.cpp @@ -0,0 +1,78 @@ +#include "n2xOutputMode.h" + +#include "n2xController.h" +#include "n2xEditor.h" + +namespace n2xJucePlugin +{ + static constexpr const char* g_outModesAB[] = + { + "A & B Mono/Stereo", + "A & B Mono", + "A & B Alternating", + "A to A / B to B" + }; + + static constexpr const char* g_outModesCD[] = + { + "Same as A & B", + "C & D Mono/Stereo", + "C & D Mono", + "C & D Alternating", + "C to C / D to D" + }; + + OutputMode::OutputMode(const Editor& _editor) + : m_outAB(_editor.findComponentT<juce::ComboBox>("PerfOutModeAB")) + , m_outCD(_editor.findComponentT<juce::ComboBox>("PerfOutModeCD")) + , m_parameter(_editor.getN2xController().getParameter("PerfOutModeABCD", 0)) + { + int id = 1; + for (const auto* mode : g_outModesAB) + m_outAB->addItem(mode, id++); + + id = 1; + for (const auto* mode : g_outModesCD) + m_outCD->addItem(mode, id++); + + m_outAB->onChange = [this] + { + setOutModeAB(static_cast<uint8_t>(m_outAB->getSelectedItemIndex())); + }; + + m_outCD->onChange = [this] + { + setOutModeCD(static_cast<uint8_t>(m_outCD->getSelectedItemIndex())); + }; + + m_onOutputModeChanged.set(m_parameter, [this](pluginLib::Parameter* const& _parameter) + { + onOutModeChanged(_parameter->getUnnormalizedValue()); + }); + } + + void OutputMode::setOutModeAB(const uint8_t _mode) + { + auto v = m_parameter->getUnnormalizedValue(); + v &= 0xf0; + v |= _mode; + m_parameter->setUnnormalizedValueNotifyingHost(v, pluginLib::Parameter::Origin::Ui); + } + + void OutputMode::setOutModeCD(const uint8_t _mode) + { + auto v = m_parameter->getUnnormalizedValue(); + v &= 0x0f; + v |= _mode<<4; + m_parameter->setUnnormalizedValueNotifyingHost(v, pluginLib::Parameter::Origin::Ui); + } + + void OutputMode::onOutModeChanged(pluginLib::ParamValue _paramValue) + { + const auto ab = _paramValue & 0xf; + const auto cd = (_paramValue >> 4) & 0xf; + + m_outAB->setSelectedItemIndex(ab, juce::dontSendNotification); + m_outCD->setSelectedItemIndex(cd, juce::dontSendNotification); + } +} diff --git a/source/nord/n2x/n2xJucePlugin/n2xOutputMode.h b/source/nord/n2x/n2xJucePlugin/n2xOutputMode.h @@ -0,0 +1,30 @@ +#pragma once +#include "n2xFocusedParameter.h" +#include "jucePluginLib/types.h" + +namespace juce +{ + class ComboBox; +} + +namespace n2xJucePlugin +{ + class Editor; + + class OutputMode + { + public: + OutputMode(const Editor& _editor); + + private: + void setOutModeAB(uint8_t _mode); + void setOutModeCD(uint8_t _mode); + void onOutModeChanged(pluginLib::ParamValue _paramValue); + + juce::ComboBox* m_outAB; + juce::ComboBox* m_outCD; + pluginLib::Parameter* const m_parameter; + + pluginLib::ParameterListener m_onOutputModeChanged; + }; +} diff --git a/source/nord/n2x/n2xJucePlugin/parameterDescriptions_n2x.json b/source/nord/n2x/n2xJucePlugin/parameterDescriptions_n2x.json @@ -138,7 +138,7 @@ {"class":"NonPartSensitive", "page":10, "index":311, "name":"PerfMorfTriggerNoteNumberD", "displayName":"MorfTrg Note D", "min":23, "max":127, "isDiscrete":true, "toText":"noteNumber"}, {"class":"NonPartSensitive", "page":10, "index":312, "name":"PerfBendRange", "min":0, "max":8, "isDiscrete":true}, {"class":"NonPartSensitive", "page":10, "index":313, "name":"PerfUnisonDetune", "min":0, "max":8, "isDiscrete":true}, - {"class":"NonPartSensitive", "page":10, "index":314, "name":"PerfOutModeABCD", "min":0, "max":8, "isDiscrete":true}, + {"class":"NonPartSensitive", "page":10, "index":314, "name":"PerfOutModeABCD", "min":0, "max":127, "isDiscrete":true}, {"class":"NonPartSensitive", "page":10, "index":315, "name":"PerfGlobalMidiChannel", "min":0, "max":15, "isDiscrete":true}, {"class":"NonPartSensitive", "page":10, "index":316, "name":"PerfProgramChange", "min":0, "max":1, "isBool":true}, {"class":"NonPartSensitive", "page":10, "index":317, "name":"PerfMidiControl", "min":0, "max":1, "isBool":true}, diff --git a/source/nord/n2x/n2xJucePlugin/skins/n2xTrancy/n2xTrancy.json b/source/nord/n2x/n2xJucePlugin/skins/n2xTrancy/n2xTrancy.json @@ -273,8 +273,8 @@ { "name" : "PerfKeyboardSplit", "parameterAttachment" : { "parameter" : "PerfKeyboardSplit"}, "button" : { "isToggle" : "1", "normalImage" : "0", "overImage" : "0", "downImage" : "0", "normalImageOn" : "1", "overImageOn" : "1", "downImageOn" : "1", "x" : "1668", "y" : "254", "width" : "70", "height" : "70", "texture" : "button_round", "tileSizeX" : "70", "tileSizeY" : "70", "hitOffsetT":20, "hitOffsetB":-20, "hitOffsetR":350 } }, { "name" : "PerfSplitPoint", "parameterAttachment" : { "parameter" : "PerfSplitPoint" }, "combobox" : { "text" : "MIDI", "textHeight" : "32", "alignH" : "L", "alignV" : "C","x" : "1700", "y" : "346", "width" : "300", "height" : "35", "offsetR" : "-60" } }, - { "name" : "PerfOutModeAB", "parameterAttachment" : { "parameter" : "PerfOutModeABCD" }, "combobox" : { "text" : "MIDI", "textHeight" : "32", "alignH" : "L", "alignV" : "C","x" : "1700", "y" : "423", "width" : "300", "height" : "35", "offsetR" : "-60" } }, - { "name" : "PerfOutModeCD", "parameterAttachment" : { "parameter" : "PerfOutModeABCD" }, "combobox" : { "text" : "MIDI", "textHeight" : "32", "alignH" : "L", "alignV" : "C","x" : "1700", "y" : "483", "width" : "300", "height" : "35", "offsetR" : "-60" } }, + { "name" : "PerfOutModeAB", "combobox" : { "text" : "MIDI", "textHeight" : "32", "alignH" : "L", "alignV" : "C","x" : "1700", "y" : "423", "width" : "300", "height" : "35", "offsetR" : "-60" } }, + { "name" : "PerfOutModeCD", "combobox" : { "text" : "MIDI", "textHeight" : "32", "alignH" : "L", "alignV" : "C","x" : "1700", "y" : "483", "width" : "300", "height" : "35", "offsetR" : "-60" } }, { "name" : "MidiIn", "combobox" : { "text" : "Wave 42", "textHeight" : "32", "alignH" : "L", "alignV" : "C", "x" : "1700", "y" : "552", "width" : "320", "height" : "45", "offsetR" : "-60" } }, { "name" : "MidiOut", "combobox" : { "text" : "Wave 42", "textHeight" : "32", "alignH" : "L", "alignV" : "C", "x" : "1700", "y" : "613", "width" : "320", "height" : "45", "offsetR" : "-60" } }