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 13da6dea67a653a1b3cbbd070c3236fa46128294
parent a48705bbc4118319eef20edb5245bb5f4dbe4c51
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 15 May 2022 02:43:04 +0200

completely remove parameter type enum

Diffstat:
Msource/jucePlugin/CMakeLists.txt | 2+-
Asource/jucePlugin/ParameterNames.h | 10++++++++++
Msource/jucePlugin/PluginProcessor.cpp | 6+++++-
Msource/jucePlugin/PluginProcessor.h | 3++-
Msource/jucePlugin/VirusController.h | 1-
Msource/jucePlugin/VirusParameterBinding.h | 1-
Dsource/jucePlugin/VirusParameterType.h | 378-------------------------------------------------------------------------------
Msource/jucePlugin/ui3/FxPage.cpp | 10+++++++---
Msource/jucePlugin/ui3/Parts.cpp | 14++++++++++----
Msource/jucePlugin/ui3/VirusEditor.cpp | 6++++--
10 files changed, 39 insertions(+), 392 deletions(-)

diff --git a/source/jucePlugin/CMakeLists.txt b/source/jucePlugin/CMakeLists.txt @@ -14,6 +14,7 @@ endif() set(SOURCES parameterDescriptions_C.json + ParameterNames.h PluginEditor.cpp PluginEditor.h PluginProcessor.cpp @@ -24,7 +25,6 @@ set(SOURCES VirusParameter.h VirusParameterBinding.cpp VirusParameterBinding.h - VirusParameterType.h version.h ) diff --git a/source/jucePlugin/ParameterNames.h b/source/jucePlugin/ParameterNames.h @@ -0,0 +1,10 @@ +#pragma once + +namespace Virus +{ + static constexpr char g_paramDelayReverbMode[] = "Delay/Reverb Mode"; + static constexpr char g_paramPartVolume[] = "Part Volume"; + static constexpr char g_paramPartPanorama[] = "Panorama"; + static constexpr char g_paramPlayMode[] = "Play Mode"; + static constexpr char g_paramClockTempo[] = "Clock Tempo"; +} diff --git a/source/jucePlugin/PluginProcessor.cpp b/source/jucePlugin/PluginProcessor.cpp @@ -1,7 +1,10 @@ #include "PluginProcessor.h" #include "PluginEditor.h" +#include "ParameterNames.h" + #include <juce_audio_processors/juce_audio_processors.h> #include <juce_audio_devices/juce_audio_devices.h> + #include "../synthLib/os.h" //============================================================================== @@ -12,6 +15,7 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() : MidiInputCallback(), m_romName(synthLib::findROM()), m_device(synthLib::findROM()), m_plugin(&m_device) { getController(); // init controller + m_clockTempoParam = getController().getParameterIndexByName(Virus::g_paramClockTempo); } AudioPluginAudioProcessor::~AudioPluginAudioProcessor() = default; @@ -208,7 +212,7 @@ void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, if(pos.bpm > 0) { // sync virus interal clock to host const uint8_t bpmValue = juce::jmin(127, juce::jmax(0, (int)pos.bpm-63)); // clamp to virus range, 63-190 - auto clockParam = getController().getParameter(Virus::Param_ClockTempo, 0); + const auto clockParam = getController().getParameter(m_clockTempoParam, 0); if (clockParam != nullptr && (int)clockParam->getValueObject().getValue() != bpmValue) { clockParam->getValueObject().setValue(bpmValue); } diff --git a/source/jucePlugin/PluginProcessor.h b/source/jucePlugin/PluginProcessor.h @@ -77,5 +77,6 @@ private: virusLib::Device m_device; synthLib::Plugin m_plugin; std::vector<synthLib::SMidiEvent> m_midiOut; - std::string m_romName; + std::string m_romName; + uint32_t m_clockTempoParam = 0xffffffff; }; diff --git a/source/jucePlugin/VirusController.h b/source/jucePlugin/VirusController.h @@ -1,7 +1,6 @@ #pragma once #include "VirusParameter.h" -#include "VirusParameterType.h" #include "../jucePluginLib/parameterdescriptions.h" #include "../jucePluginLib/controller.h" diff --git a/source/jucePlugin/VirusParameterBinding.h b/source/jucePlugin/VirusParameterBinding.h @@ -1,7 +1,6 @@ #pragma once #include "VirusParameter.h" -#include "VirusParameterType.h" namespace juce { class Value; diff --git a/source/jucePlugin/VirusParameterType.h b/source/jucePlugin/VirusParameterType.h @@ -1,377 +0,0 @@ -#pragma once - -namespace Virus -{ - enum ParameterType - { - Param_Invalid = -1, - - Param_BankSelect, - Param_ModWheel, - Param_BreathControl, - Param_Control3, - Param_FootControl, - Param_PortamentoTime, - Param_Data, - Param_ChannelVolume, - Param_Balance, - Param_Control9, - Param_Panorama, - Param_Expression, - Param_Control12, - Param_Control13, - Param_Control14, - Param_Control15, - Param_Control16, - Param_Osc1Shape, - Param_Osc1PW, - Param_Osc1Wave, - Param_Osc1Semitone, - Param_Osc1Keyfollow, - Param_Osc2Shape, - Param_Osc2PW, - Param_Osc2Wave, - Param_Osc2Semitone, - Param_Osc2Detune, - Param_Osc2FMAmount, - Param_Osc2Sync, - Param_Osc2FltEnvAmt, - Param_FMFiltEnvAmt, - Param_Osc2Keyfollow, - Param_PerfControl_BankSelect, - Param_OscBalance, - Param_SubOscVolume, - Param_SubOscShape, - Param_OscMainVolume, - Param_NoiseVolume, - Param_RingModMVolume, - Param_NoiseColor, - Param_FilterCutA, - Param_FilterCutB, - Param_FilterResA, - Param_FilterResB, - Param_FilterEnvAmtA, - Param_FilterEnvAmtB, - Param_FilterKeyFollowA, - Param_FilterKeyFollowB, - Param_FilterBalance, - Param_SaturationCurve, - Param_FilterModeA, - Param_FilterModeB, - Param_FilterRouting, - Param_FilterEnvAttack, - Param_FilterEnvDecay, - Param_FilterEnvSustain, - Param_FilterEnvSustainTime, - Param_FilterEnvRelease, - Param_AmpEnvAttack, - Param_AmpEnvDecay, - Param_AmpEnvSustain, - Param_AmpEnvSustainTime, - Param_AmpEnvRelease, - Param_HoldPedal, - Param_PortamentoPedal, - Param_SostenutoPedal, - Param_Lfo1Rate, - Param_Lfo1Shape, - Param_Lfo1EnvMode, - Param_Lfo1Mode, - Param_Lfo1Symmetry, - Param_Lfo1Keyfollow, - Param_Lfo1KeyTrigger, - Param_Osc1Lfo1Amount, - Param_Osc2Lfo1Amount, - Param_PWLfo1Amount, - Param_ResoLfo1Amount, - Param_FltGainLfo1Amount, - Param_Lfo2Rate, - Param_Lfo2Shape, - Param_Lfo2EnvMode, - Param_Lfo2Mode, - Param_Lfo2Symmetry, - Param_Lfo2Keyfollow, - Param_Lfo2Keytrigger, - Param_OscShapeLfo2Amount, - Param_FmAmountLfo2Amount, - Param_Cutoff1Lfo2Amount, - Param_Cutoff2Lfo2Amount, - Param_PanoramaLfo2Amount, - Param_PatchVolume, - Param_Transpose, - Param_KeyMode, - Param_UnisonMode, - Param_UnisonDetune, - Param_UnisonPanSpread, - Param_UnisonLfoPhase, - Param_InputMode, - Param_InputSelect, - Param_ChorusMix, - Param_ChorusRate, - Param_ChorusDepth, - Param_ChorusDelay, - Param_ChorusFeedback, - Param_ChorusLfoShape, - Param_DelayReverbMode, - Param_EffectSend, - Param_DelayTime, - Param_DelayFeedback, - Param_DelayRateReverbDecayTime, - Param_DelayDepth, - Param_ReverbRoomSize, - Param_DelayLfoShape, - Param_ReverbDamping, - Param_DelayColor, - Param_KeybLocal, - Param_AllNotesOff, - - Param_ArpMode, - Param_ArpPatternSelect, - Param_ArpOctaveRange, - Param_ArpHoldEnable, - Param_ArpNoteLength, - Param_ArpSwing, - - Param_Lfo3Rate, - Param_Lfo3Shape, - Param_Lfo3Mode, - Param_Lfo3Keyfollow, - Param_Lfo3Destination, - Param_OscLfo3Amount, - Param_Lfo3FadeInTime, - Param_ClockTempo, - Param_ArpClock, - Param_Lfo1Clock, - Param_Lfo2Clock, - Param_DelayClock, - Param_Lfo3Clock, - Param_ControlSmoothMode, - Param_BenderRangeUp, - Param_BenderRangeDown, - Param_BenderScale, - Param_Filter1EnvPolarity, - Param_Filter2EnvPolarity, - Param_Filter2CutoffLink, - Param_FilterKeytrackBase, - Param_OscFMMode, - Param_OscInitPhase, - Param_PunchIntensity, - Param_InputFollowMode, - Param_VocoderMode, - Param_Osc3Mode, - Param_Osc3Volume, - Param_Osc3Semitone, - Param_Osc3Detune, - Param_LowEqFreq, - Param_HighEqFreq, - Param_Osc1ShapeVelocity, - Param_Osc2ShapeVelocity, - Param_PulseWidthVelocity, - Param_FmAmountVelocity, - Param_SoftKnob1ShortName, - Param_SoftKnob2ShortName, - Param_Filter1EnvAmtVelocity, - Param_Filter2EnvAmtVelocity, - Param_Resonance1Velocity, - Param_Resonance2Velocity, - Param_SecondOutputBalance, - Param_AmpVelocity, - Param_PanoramaVelocity, - Param_SoftKnob1Single, - Param_SoftKnob2Single, - Param_Assign1Source, - Param_Assign1Destination, - Param_Assign1Amount, - Param_Assign2Source, - Param_Assign2Destination1, - Param_Assign2Amount1, - Param_Assign2Destination2, - Param_Assign2Amount2, - Param_Assign3Source, - Param_Assign3Destination1, - Param_Assign3Amount1, - Param_Assign3Destination2, - Param_Assign3Amount2, - Param_Assign2Destination3, - Param_Assign2Amount3, - Param_Lfo1AssignDest, - Param_Lfo1AssignAmount, - Param_Lfo2AssignDest, - Param_Lfo2AssignAmount, - Param_PhaserMode, - Param_PhaserMix, - Param_PhaserRate, - Param_PhaserDepth, - Param_PhaserFreq, - Param_PhaserFeedback, - Param_PhaserSpread, - Param_MidEqGain, - Param_MidEqFreq, - Param_MidEqQFactor, - Param_LowEqGain, - Param_HighEqGain, - Param_BassIntensity, - Param_BassTune, - Param_InputRingMod, - Param_DistortionCurve, - Param_DistortionIntensity, - Param_Assign4Source, - Param_Assign4Destination, - Param_Assign4Amount, - Param_Assign5Source, - Param_Assign5Destination, - Param_Assign5Amount, - Param_Assign6Source, - Param_Assign6Destination, - Param_Assign6Amount, - Param_FilterSelect, - Param_Category1, - Param_Category2, - Param_DelayOutputSelect, - Param_PartBankSelect, - Param_PartBankChange, - Param_PartProgramChange, - Param_PartMidiChannel, - Param_PartLowKey, - Param_PartHighKey, - Param_PartTranspose, - Param_PartDetune, - Param_PartVolume, - Param_PartMidiVolumeInit, - Param_PartOutputSelect, - Param_GlobalSecondOutputSelect, - Param_GlobalKeybTransposeButtons, - Param_GlobalKeybLocal, - Param_GlobalKeybMode, - Param_GlobalKeybTranspose, - Param_GlobalKeyModWheelControl, - Param_GlobalKeybPedal1Control, - Param_GlobalKeybPedal2Control, - Param_GlobalKeybPressureSensitive, - Param_PartEnable, - Param_PartMidiVolumeEnable, - Param_PartHoldPedalEnable, - Param_KeybToMidi, - Param_NoteStealPriority, - Param_PartProgChangeEnable, - Param_GlobalProgChangeEnable, - Param_MultiProgChangeEnable, - Param_GlobalMidiVolumeEnable, - Param_InputThruLevel, - Param_InputBoost, - Param_MasterTune, - Param_DeviceID, - Param_MidiControlLowPage, - Param_MidiControlHighPage, - Param_MidiArpSend, - Param_KnobDisplay, - Param_MidiDumpTX, - Param_MidiDumpRX, - Param_MultiProgramChange, - Param_MidiClockRX, - Param_SoftKnob1Mode, - Param_SoftKnob2Mode, - Param_SoftKnob1Global, - Param_SoftKnob2Global, - Param_SoftKnob1Midi, - Param_SoftKnob2Midi, - Param_ExpertMode, - Param_KnobMode, - Param_MemoryProtect, - Param_SoftThru, - Param_PanelDestination, - Param_PlayMode, - Param_PartNumber, - Param_GlobalChannel, - Param_LedMode, - Param_LcdContrast, - Param_MasterVolume, - - // UNDEFINED / UNUSED / STUBS - Param_PageA_Undefined92, - Param_PageA_Undefined95, - Param_PageA_Undefined96, - Param_PageA_Undefined111, - Param_PageA_Undefined120, - Param_PageA_Undefined121, - Param_PageA_Undefined124, - Param_PageA_Undefined125, - Param_PageA_Undefined126, - Param_PageA_Undefined127, - Param_PageB_Undefined0, - Param_PageB_Undefined14, - Param_PageB_Undefined15, - Param_PageB_Undefined22, - Param_PageB_Undefined23, - Param_PageB_Undefined24, - Param_PageB_Undefined29, - Param_PageB_Undefined37, - Param_PageB_Undefined40, - Param_PageB_Undefined53, - Param_PageB_Undefined69, - Param_PageB_Undefined83, - Param_PageB_Undefined91, - Param_PageB_Undefined111, - Param_PageB_Undefined123, - Param_PageB_Undefined124, - Param_PageC_Undefined0, - Param_PageC_Undefined1, - Param_PageC_Undefined2, - Param_PageC_Undefined3, - Param_PageC_Undefined4, - Param_PageC_Undefined15, - Param_PageC_Undefined16, - Param_PageC_Undefined17, - Param_PageC_Undefined18, - Param_PageC_Undefined19, - Param_PageC_Undefined20, - Param_PageC_Undefined21, - Param_PageC_Undefined23, - Param_PageC_Undefined24, - Param_PageC_Undefined25, - Param_PageC_Undefined26, - Param_PageC_Undefined27, - Param_PageC_Undefined28, - Param_PageC_Undefined29, - Param_PageC_Undefined30, - Param_PageC_Undefined76, - Param_PageC_Undefined79, - Param_PageC_Undefined80, - Param_PageC_Undefined81, - Param_PageC_Undefined82, - Param_PageC_Undefined83, - Param_PageC_Undefined84, - Param_PageC_Undefined88, - Param_PageC_Undefined89, - Param_PageC_Undefined100, - Param_PageC_Undefined101, - Param_PageC_Undefined102, - Param_PageC_Undefined103, - Param_PageC_Undefined104, - Param_PageC_Undefined119, - // Text Chars / Unused - Param_PageB_Undefined110, - Param_PageB_Undefined111_, - Param_PageB_Undefined112, - Param_PageB_Undefined113, - Param_PageB_Undefined114, - Param_PageB_Undefined115, - Param_PageB_Undefined116, - Param_PageB_Undefined117, - Param_PageB_Undefined118, - Param_PageB_Undefined119, - Param_PageB_Undefined120, - Param_PageB_Undefined121, - Param_PageC_Undefined5, - Param_PageC_Undefined6, - Param_PageC_Undefined7, - Param_PageC_Undefined8, - Param_PageC_Undefined9, - Param_PageC_Undefined10, - Param_PageC_Undefined11, - Param_PageC_Undefined12, - Param_PageC_Undefined13, - Param_PageC_Undefined14, - - Param_Count - }; -} -\ No newline at end of file diff --git a/source/jucePlugin/ui3/FxPage.cpp b/source/jucePlugin/ui3/FxPage.cpp @@ -2,6 +2,7 @@ #include "VirusEditor.h" +#include "../ParameterNames.h" #include "../VirusController.h" namespace genericVirusUI @@ -11,7 +12,8 @@ namespace genericVirusUI m_reverbContainer = _editor.findComponent("ContainerReverb"); m_delayContainer = _editor.findComponent("ContainerDelay"); - const auto p = m_editor.getController().getParameter(Virus::Param_DelayReverbMode, 0); + const auto delayReverbMode = m_editor.getController().getParameterIndexByName(Virus::g_paramDelayReverbMode); + const auto p = m_editor.getController().getParameter(delayReverbMode, 0); if (p) { @@ -23,7 +25,8 @@ namespace genericVirusUI FxPage::~FxPage() { - const auto p = m_editor.getController().getParameter(Virus::Param_DelayReverbMode, 0); + const auto delayReverbMode = m_editor.getController().getParameterIndexByName(Virus::g_paramDelayReverbMode); + const auto p = m_editor.getController().getParameter(delayReverbMode, 0); if(p) p->getValueObject().removeListener(this); } @@ -35,7 +38,8 @@ namespace genericVirusUI void FxPage::updateReverbDelay() const { - const auto p = m_editor.getController().getParameter(Virus::Param_DelayReverbMode, 0); + const auto delayReverbMode = m_editor.getController().getParameterIndexByName(Virus::g_paramDelayReverbMode); + const auto p = m_editor.getController().getParameter(delayReverbMode, 0); if (!p) return; diff --git a/source/jucePlugin/ui3/Parts.cpp b/source/jucePlugin/ui3/Parts.cpp @@ -1,8 +1,11 @@ #include "Parts.h" #include "VirusEditor.h" + #include "../VirusController.h" #include "../VirusParameterBinding.h" +#include "../ParameterNames.h" + #include "dsp56kEmu/logging.h" namespace genericVirusUI @@ -29,11 +32,14 @@ namespace genericVirusUI m_presetName[i]->onClick = [this, i]{ selectPreset(i); }; - _editor.getParameterBinding().bind(*m_partVolume[i], Virus::Param_PartVolume, static_cast<uint8_t>(i)); - _editor.getParameterBinding().bind(*m_partPan[i], Virus::Param_Panorama, static_cast<uint8_t>(i)); + const auto partVolume = _editor.getController().getParameterIndexByName(Virus::g_paramPartVolume); + const auto partPanorama = _editor.getController().getParameterIndexByName(Virus::g_paramPartPanorama); + + _editor.getParameterBinding().bind(*m_partVolume[i], partVolume, static_cast<uint8_t>(i)); + _editor.getParameterBinding().bind(*m_partPan[i], partPanorama, static_cast<uint8_t>(i)); - m_partVolume[i]->getProperties().set("parameter", (int)Virus::Param_PartVolume); - m_partPan[i]->getProperties().set("parameter", (int)Virus::Param_Panorama); + m_partVolume[i]->getProperties().set("parameter", static_cast<int>(partVolume)); + m_partPan[i]->getProperties().set("parameter", static_cast<int>(partPanorama)); m_partVolume[i]->getProperties().set("part", static_cast<int>(i)); m_partPan[i]->getProperties().set("part", static_cast<int>(i)); diff --git a/source/jucePlugin/ui3/VirusEditor.cpp b/source/jucePlugin/ui3/VirusEditor.cpp @@ -2,6 +2,7 @@ #include "BinaryData.h" +#include "../ParameterNames.h" #include "../PluginProcessor.h" #include "../VirusController.h" #include "../VirusParameterBinding.h" @@ -303,7 +304,7 @@ namespace genericVirusUI const int part = props.contains("part") ? static_cast<int>(props["part"]) : static_cast<int>(getController().getCurrentPart()); - const auto* p = getController().getParameter(static_cast<Virus::ParameterType>(v), part); + const auto* p = getController().getParameter(v, part); if(!p) { @@ -475,7 +476,8 @@ namespace genericVirusUI void VirusEditor::setPlayMode(uint8_t _playMode) { - getController().getParameter(Virus::Param_PlayMode)->setValue(_playMode); + const auto playMode = getController().getParameterIndexByName(Virus::g_paramPlayMode); + getController().getParameter(playMode)->setValue(_playMode); if (_playMode == virusLib::PlayModeSingle && getController().getCurrentPart() != 0) m_parameterBinding.setPart(0);