Merge visualiser fixes

pull/251/head
James H Ball 2024-08-23 10:53:52 +01:00
commit e9351f7852
6 zmienionych plików z 36 dodań i 23 usunięć

Wyświetl plik

@ -102,6 +102,22 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
addAndMakeVisible(lua);
addAndMakeVisible(luaResizerBar);
addAndMakeVisible(visualiser);
visualiser.openSettings = [this] {
visualiserSettingsWindow.setVisible(true);
visualiserSettingsWindow.toFront(true);
};
visualiser.closeSettings = [this] {
visualiserSettingsWindow.setVisible(false);
};
visualiserSettingsWindow.setResizable(false, false);
visualiserSettingsWindow.setUsingNativeTitleBar(true);
visualiserSettings.setLookAndFeel(&getLookAndFeel());
visualiserSettings.setSize(550, 230);
visualiserSettingsWindow.setContentNonOwned(&visualiserSettings, true);
visualiserSettingsWindow.centreWithSize(550, 230);
tooltipDropShadow.setOwner(&tooltipWindow);
}

Wyświetl plik

@ -9,6 +9,7 @@
#include "LookAndFeel.h"
#include "components/ErrorCodeEditorComponent.h"
#include "components/LuaConsole.h"
#include "components/VisualiserSettings.h"
class OscirenderAudioProcessorEditor : public juce::AudioProcessorEditor, private juce::CodeDocument::Listener, public juce::AsyncUpdater, public juce::ChangeListener {
public:
@ -48,7 +49,10 @@ public:
std::atomic<bool> editingCustomFunction = false;
VisualiserComponent visualiser{audioProcessor, nullptr, audioProcessor.legacyVisualiserEnabled->getBoolValue()};
VisualiserSettings visualiserSettings = VisualiserSettings(audioProcessor);
SettingsWindow visualiserSettingsWindow = SettingsWindow("Visualiser Settings");
VisualiserComponent visualiser{audioProcessor, visualiserSettings, nullptr, audioProcessor.legacyVisualiserEnabled->getBoolValue()};
SettingsComponent settings{audioProcessor, *this};
juce::ComponentAnimator codeEditorAnimator;

Wyświetl plik

@ -1,20 +1,13 @@
#include "../LookAndFeel.h"
#include "VisualiserComponent.h"
VisualiserComponent::VisualiserComponent(OscirenderAudioProcessor& p, VisualiserComponent* parent, bool useOldVisualiser) : backgroundColour(juce::Colours::black), waveformColour(juce::Colour(0xff00ff00)), audioProcessor(p), oldVisualiser(useOldVisualiser), juce::Thread("VisualiserComponent"), parent(parent) {
VisualiserComponent::VisualiserComponent(OscirenderAudioProcessor& p, VisualiserSettings& settings, VisualiserComponent* parent, bool useOldVisualiser) : settings(settings), backgroundColour(juce::Colours::black), waveformColour(juce::Colour(0xff00ff00)), audioProcessor(p), oldVisualiser(useOldVisualiser), juce::Thread("VisualiserComponent"), parent(parent) {
setVisualiserType(oldVisualiser);
resetBuffer();
startTimerHz(60);
startThread();
settingsWindow.setResizable(false, false);
settingsWindow.setUsingNativeTitleBar(true);
settings.setLookAndFeel(&getLookAndFeel());
settings.setSize(550, 230);
settingsWindow.setContentNonOwned(&settings, true);
settingsWindow.centreWithSize(550, 230);
setMouseCursor(juce::MouseCursor::PointingHandCursor);
setWantsKeyboardFocus(true);
@ -228,6 +221,9 @@ void VisualiserComponent::setVisualiserType(bool oldVisualiser) {
}
if (oldVisualiser) {
browser.reset();
if (closeSettings != nullptr) {
closeSettings();
}
} else {
initialiseBrowser();
}
@ -349,8 +345,10 @@ void VisualiserComponent::childChanged() {
}
void VisualiserComponent::popoutWindow() {
auto visualiser = new VisualiserComponent(audioProcessor, this, oldVisualiser);
auto visualiser = new VisualiserComponent(audioProcessor, settings, this, oldVisualiser);
visualiser->settings.setLookAndFeel(&getLookAndFeel());
visualiser->openSettings = openSettings;
visualiser->closeSettings = closeSettings;
child = visualiser;
childChanged();
popOutButton.setVisible(false);
@ -365,8 +363,3 @@ void VisualiserComponent::popoutWindow() {
resized();
popOutButton.setVisible(false);
}
void VisualiserComponent::openSettings() {
settingsWindow.setVisible(true);
settingsWindow.toFront(true);
}

Wyświetl plik

@ -18,10 +18,12 @@ enum class FullScreenMode {
class VisualiserWindow;
class VisualiserComponent : public juce::Component, public juce::Timer, public juce::Thread, public juce::MouseListener, public juce::SettableTooltipClient {
public:
VisualiserComponent(OscirenderAudioProcessor& p, VisualiserComponent* parent = nullptr, bool useOldVisualiser = false);
VisualiserComponent(OscirenderAudioProcessor& p, VisualiserSettings& settings, VisualiserComponent* parent = nullptr, bool useOldVisualiser = false);
~VisualiserComponent() override;
void openSettings();
std::function<void()> openSettings;
std::function<void()> closeSettings;
void childChanged();
void enableFullScreen();
void setFullScreenCallback(std::function<void(FullScreenMode)> callback);
@ -76,8 +78,8 @@ private:
std::shared_ptr<BufferConsumer> consumer;
std::function<void(FullScreenMode)> fullScreenCallback;
VisualiserSettings settings = VisualiserSettings(audioProcessor, *this);
SettingsWindow settingsWindow = SettingsWindow("Visualiser Settings");
VisualiserSettings& settings;
juce::WebBrowserComponent::ResourceProvider provider = [this](const juce::String& path) {
juce::String mimeType;

Wyświetl plik

@ -2,7 +2,7 @@
#include "VisualiserComponent.h"
#include "../PluginEditor.h"
VisualiserSettings::VisualiserSettings(OscirenderAudioProcessor& p, VisualiserComponent& visualiser) : audioProcessor(p), visualiser(visualiser) {
VisualiserSettings::VisualiserSettings(OscirenderAudioProcessor& p) : audioProcessor(p) {
addAndMakeVisible(intensity);
addAndMakeVisible(persistence);
addAndMakeVisible(hue);

Wyświetl plik

@ -6,17 +6,15 @@
#include "../LookAndFeel.h"
#include "SwitchButton.h"
class VisualiserComponent;
class VisualiserSettings : public juce::Component {
public:
VisualiserSettings(OscirenderAudioProcessor&, VisualiserComponent&);
VisualiserSettings(OscirenderAudioProcessor&);
~VisualiserSettings();
void resized() override;
juce::var getSettings();
private:
OscirenderAudioProcessor& audioProcessor;
VisualiserComponent& visualiser;
EffectComponent intensity{audioProcessor, *audioProcessor.intensityEffect};
EffectComponent persistence{audioProcessor, *audioProcessor.persistenceEffect};