From 997de907bcd740652eb867e778d1933a8a09e30c Mon Sep 17 00:00:00 2001 From: James H Ball Date: Thu, 22 Aug 2024 14:42:54 +0100 Subject: [PATCH] Save visualiser fullscreen state to project --- Source/MainComponent.cpp | 12 ++++++------ Source/PluginEditor.cpp | 2 +- Source/PluginEditor.h | 1 - Source/PluginProcessor.cpp | 1 + Source/PluginProcessor.h | 2 ++ osci-render.jucer | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index b1af041..3f6cad4 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -124,19 +124,19 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess createFile.triggerClick(); }; - if (!pluginEditor.visualiserFullScreen) { + if (!audioProcessor.visualiserFullScreen->getBoolValue()) { addAndMakeVisible(pluginEditor.visualiser); } pluginEditor.visualiser.setFullScreenCallback([this](FullScreenMode mode) { if (mode == FullScreenMode::TOGGLE) { - pluginEditor.visualiserFullScreen = !pluginEditor.visualiserFullScreen; + audioProcessor.visualiserFullScreen->setBoolValueNotifyingHost(!audioProcessor.visualiserFullScreen->getBoolValue()); } else if (mode == FullScreenMode::FULL_SCREEN) { - pluginEditor.visualiserFullScreen = true; + audioProcessor.visualiserFullScreen->setBoolValueNotifyingHost(true); } else if (mode == FullScreenMode::MAIN_COMPONENT) { - pluginEditor.visualiserFullScreen = false; + audioProcessor.visualiserFullScreen->setBoolValueNotifyingHost(false); } - pluginEditor.visualiser.setFullScreen(pluginEditor.visualiserFullScreen); + pluginEditor.visualiser.setFullScreen(audioProcessor.visualiserFullScreen->getBoolValue()); pluginEditor.resized(); pluginEditor.repaint(); @@ -234,7 +234,7 @@ void MainComponent::resized() { frequencyLabel.setBounds(bounds.removeFromTop(20)); bounds.removeFromTop(padding); - if (!pluginEditor.visualiserFullScreen) { + if (!audioProcessor.visualiserFullScreen->getBoolValue()) { auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight()); juce::Point localTopLeft = {bounds.getX(), bounds.getY()}; juce::Point topLeft = pluginEditor.getLocalPoint(this, localTopLeft); diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 9661f4d..7f1769b 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -143,7 +143,7 @@ void OscirenderAudioProcessorEditor::paint(juce::Graphics& g) { void OscirenderAudioProcessorEditor::resized() { auto area = getLocalBounds(); - if (visualiserFullScreen) { + if (audioProcessor.visualiserFullScreen->getBoolValue()) { visualiser.setBounds(area); return; } diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 2d43787..8f367e6 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -49,7 +49,6 @@ public: std::atomic editingCustomFunction = false; VisualiserComponent visualiser{audioProcessor, nullptr, audioProcessor.legacyVisualiserEnabled->getBoolValue()}; - std::atomic visualiserFullScreen = false; SettingsComponent settings{audioProcessor, *this}; juce::ComponentAnimator codeEditorAnimator; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index ce9baaf..6e44d0a 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -179,6 +179,7 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() booleanParameters.push_back(smudgesEnabled); booleanParameters.push_back(upsamplingEnabled); booleanParameters.push_back(legacyVisualiserEnabled); + booleanParameters.push_back(visualiserFullScreen); for (auto parameter : booleanParameters) { addParameter(parameter); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 55ddf32..3cbe9ca 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -162,6 +162,8 @@ public: BooleanParameter* smudgesEnabled = new BooleanParameter("Show Smudges", "smudgesEnabled", VERSION_HINT, true, "Adds a subtle layer of dirt/smudges to the oscilloscope display to make it look more realistic."); BooleanParameter* upsamplingEnabled = new BooleanParameter("Upsample Audio", "upsamplingEnabled", VERSION_HINT, false, "Upsamples the audio before visualising it to make it appear more realistic, at the expense of performance."); BooleanParameter* legacyVisualiserEnabled = new BooleanParameter("Use Legacy Visualiser", "legacyVisualiserEnabled", VERSION_HINT, false, "Replaces the realistic oscilloscope visualiser with the legacy visualiser. This may improve performance."); + BooleanParameter* visualiserFullScreen = new BooleanParameter("Visualiser Fullscreen", "visualiserFullScreen", VERSION_HINT, false, "Makes the software visualiser fullscreen."); + std::shared_ptr persistenceEffect = std::make_shared( new EffectParameter( "Persistence", diff --git a/osci-render.jucer b/osci-render.jucer index 48c3f14..59e19f7 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -654,9 +654,9 @@ - + + debugInformationFormat="ProgramDatabase"/>