From 3dbcbf73e53e8fe8c889e9192c479142069b4692 Mon Sep 17 00:00:00 2001 From: Roland Rabien Date: Fri, 25 Aug 2023 09:47:50 -0700 Subject: [PATCH] More UI --- .gitmodules | 3 +++ CMakeLists.txt | 6 ++++++ modules/gin | 2 +- modules/melatonin_inspector | 1 + plugin/Resources/layout.json | 9 ++++++++- plugin/Source/Editor.cpp | 30 +++++++++--------------------- plugin/Source/Panels.h | 10 +++++----- plugin/Source/PluginEditor.cpp | 17 +++++++++++++++++ plugin/Source/PluginEditor.h | 6 ++++++ plugin/Source/WavetableVoice.cpp | 5 ++++- 10 files changed, 60 insertions(+), 29 deletions(-) create mode 160000 modules/melatonin_inspector diff --git a/.gitmodules b/.gitmodules index c7cb361..227274c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "modules/plugin_sdk"] path = modules/plugin_sdk url = git@github.com:TurnipHat/plugin_sdk.git +[submodule "modules/melatonin_inspector"] + path = modules/melatonin_inspector + url = git@github.com:sudara/melatonin_inspector.git diff --git a/CMakeLists.txt b/CMakeLists.txt index ff9ec5d..cabbeea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,10 @@ foreach(module_name IN ITEMS gin gin_dsp gin_graphics gin_gui gin_metadata gin_n set_property (TARGET "${module_name}" APPEND PROPERTY LABELS Gin) endforeach() +# melatonin +juce_add_module ("${CMAKE_CURRENT_LIST_DIR}/modules/melatonin_inspector") +set_property (TARGET melatonin_inspector APPEND PROPERTY LABELS melatonin) + # Binary Data set_property (DIRECTORY APPEND PROPERTY LABELS Assets) @@ -242,6 +246,8 @@ target_link_libraries (${PLUGIN_NAME} PRIVATE gin_gui gin_plugin + melatonin_inspector + juce::juce_audio_basics juce::juce_audio_devices juce::juce_audio_formats diff --git a/modules/gin b/modules/gin index 15facfa..3e758af 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit 15facfa3eaa9648244202df0e29067d30b36f33c +Subproject commit 3e758affdb87d98b1699982262082c7b4c755392 diff --git a/modules/melatonin_inspector b/modules/melatonin_inspector new file mode 160000 index 0000000..177bf13 --- /dev/null +++ b/modules/melatonin_inspector @@ -0,0 +1 @@ +Subproject commit 177bf1318757fb78f76c4ea20356fc73168d8db5 diff --git a/plugin/Resources/layout.json b/plugin/Resources/layout.json index 0a9b8b7..b0930ca 100644 --- a/plugin/Resources/layout.json +++ b/plugin/Resources/layout.json @@ -5,6 +5,13 @@ { "id": "flt", "x": "0", "y": "prevB()+1", "w": 175, "h": 163 }, { "id": "fltAdsr", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, { "id": "lfo[1..3]", "x": "0,prevR()+1", "y": "prevB()+1,prevY()", "w": 175, "h": 163 }, - { "id": "scope", "x": "0", "y": "prevB()+1", "w": 175, "h": 163 } + { "id": "gate", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, + { "id": "gatePattern", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, + { "id": "scope", "x": "0", "y": "prevB()+1", "w": 175, "h": 163 }, + { "id": "reverb", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, + { "id": "delay", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, + { "id": "distort", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, + { "id": "chorus", "x": "prevR()+1", "y": "prevY()", "w": 175, "h": 163 }, + { "id": "lfoArea[1..3]", "x": 0, "y": 0, "w": 0, "h": 0 } ] } \ No newline at end of file diff --git a/plugin/Source/Editor.cpp b/plugin/Source/Editor.cpp index b78df2a..31a51c9 100644 --- a/plugin/Source/Editor.cpp +++ b/plugin/Source/Editor.cpp @@ -10,31 +10,19 @@ Editor::Editor (WavetableAudioProcessor& proc_) addAndMakeVisible (filter); addAndMakeVisible (fltADSR); - for (auto& i : modItems) - modHeader.addItem (i); - - addAndMakeVisible (modHeader); - for (int i = 0; i < Cfg::numLFOs; i++) { - lfoBox.addBox (i, &lfos[i]); - lfoBox.addBox (i, &lfoGraphs[i]); + addAndMakeVisible (&lfos[i]); + addAndMakeVisible (&lfoGraphs[i]); } - addAndMakeVisible (lfoBox); - lfoBox.setPage (0); - for (auto& i : fxItems) - fxHeader.addItem (i); - - addAndMakeVisible (fxHeader); - - effects.addBox (&gate); - effects.addBox (&pattern); - effects.addBox (&chorus); - effects.addBox (&distort); - effects.addBox (&delay); - effects.addBox (&reverb); - effects.addBox (&scope); + addAndMakeVisible (gate); + addAndMakeVisible (pattern); + addAndMakeVisible (chorus); + addAndMakeVisible (distort); + addAndMakeVisible (delay); + addAndMakeVisible (reverb); + addAndMakeVisible (scope); addAndMakeVisible (effects); diff --git a/plugin/Source/Panels.h b/plugin/Source/Panels.h index 3772255..86cd52f 100644 --- a/plugin/Source/Panels.h +++ b/plugin/Source/Panels.h @@ -112,7 +112,7 @@ public: FilterADSRArea (WavetableAudioProcessor& proc_) : proc (proc_) { - setName ( "fltAdsr" ); + setName ("fltAdsr"); auto& flt = proc.filterParams; @@ -152,7 +152,7 @@ public: LFOBox (const juce::String& name, WavetableAudioProcessor& proc_, int idx_) : gin::ParamBox (name), proc (proc_), idx (idx_) { - setName ( "lfo" + juce::String ( idx + 1 ) ); + setName ("lfo" + juce::String (idx + 1)); auto& lfo = proc.lfoParams[idx]; @@ -190,7 +190,7 @@ public: LFOArea (WavetableAudioProcessor& proc_, int idx_) : proc (proc_), idx (idx_) { - setName ( "lfoArea" + juce::String ( idx + 1 ) ); + setName ("lfoArea" + juce::String (idx + 1)); auto& lfo = proc.lfoParams[idx]; @@ -222,7 +222,7 @@ public: GateBox (WavetableAudioProcessor& proc_) : gin::ParamBox ("Gate"), proc (proc_) { - setName ( "gate" ); + setName ("gate"); addControl (new gin::Select (proc.gateParams.beat), 0, 0); addControl (new gin::Knob (proc.gateParams.length), 1, 0); @@ -242,7 +242,7 @@ public: GateArea (WavetableAudioProcessor& proc_) : gin::ParamArea ("Pattern"), proc (proc_) { - setName ( "gatePattern" ); + setName ("gatePattern"); g = new gin::GateEffectComponent(); g->setParams (proc.gateParams.length, proc.gateParams.l, proc.gateParams.r, proc.gateParams.enable); diff --git a/plugin/Source/PluginEditor.cpp b/plugin/Source/PluginEditor.cpp index 0e37624..aebcf17 100644 --- a/plugin/Source/PluginEditor.cpp +++ b/plugin/Source/PluginEditor.cpp @@ -15,6 +15,23 @@ WavetableAudioProcessorEditor::~WavetableAudioProcessorEditor() } //============================================================================== +void WavetableAudioProcessorEditor::showAboutInfo() +{ + #if JUCE_DEBUG + if (inspector == nullptr) + { + inspector = std::make_unique (*this); + inspector->setVisible(true); + } + else + { + inspector = nullptr; + } + #else + ProcessorEditor::showAboutInfo(); + #endif +} + void WavetableAudioProcessorEditor::paint (juce::Graphics& g) { ProcessorEditor::paint (g); diff --git a/plugin/Source/PluginEditor.h b/plugin/Source/PluginEditor.h index 39a24fa..eba4b01 100644 --- a/plugin/Source/PluginEditor.h +++ b/plugin/Source/PluginEditor.h @@ -16,10 +16,16 @@ public: void paint (juce::Graphics&) override; void resized() override; + void showAboutInfo() override; + private: WavetableAudioProcessor& vaProc; Editor editor { vaProc }; + #if JUCE_DEBUG + std::unique_ptr inspector; + #endif + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavetableAudioProcessorEditor) }; diff --git a/plugin/Source/WavetableVoice.cpp b/plugin/Source/WavetableVoice.cpp index 7c3187e..e15c5ed 100644 --- a/plugin/Source/WavetableVoice.cpp +++ b/plugin/Source/WavetableVoice.cpp @@ -10,6 +10,9 @@ WavetableVoice::WavetableVoice (WavetableAudioProcessor& p) void WavetableVoice::noteStarted() { + oscillators[0].setWavetable (proc.osc1Tables); + oscillators[1].setWavetable (proc.osc2Tables); + fastKill = false; startVoice(); @@ -156,7 +159,7 @@ void WavetableVoice::renderNextBlock (juce::AudioBuffer& outputBuffer, in float velocity = currentlyPlayingNote.noteOnVelocity.asUnsignedFloat(); buffer.applyGain (gin::velocityToGain (velocity, ampKeyTrack)); - // Apply filters + // Apply filter if (proc.filterParams.enable->isOn()) filter.process (buffer);