From bcbf634ff76b9cadcd3d01b34ee7dd3ebaabde1a Mon Sep 17 00:00:00 2001 From: James H Ball Date: Sun, 23 Feb 2025 19:48:19 +0000 Subject: [PATCH] Fix major intel graphics bug, and fix smoothing bugs --- Source/CommonPluginEditor.h | 2 +- Source/PluginProcessor.cpp | 2 +- Source/PluginProcessor.h | 6 +++--- Source/audio/EffectParameter.h | 2 +- Source/visualiser/VisualiserComponent.cpp | 19 +++++++++++++++---- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Source/CommonPluginEditor.h b/Source/CommonPluginEditor.h index 5a66e4b..3b83fd7 100644 --- a/Source/CommonPluginEditor.h +++ b/Source/CommonPluginEditor.h @@ -61,7 +61,7 @@ public: VisualiserSettings visualiserSettings = VisualiserSettings(audioProcessor.visualiserParameters, 3); RecordingSettings recordingSettings = RecordingSettings(audioProcessor.recordingParameters); - SettingsWindow recordingSettingsWindow = SettingsWindow("Recording Settings", recordingSettings, 300, 320, 300, 320); + SettingsWindow recordingSettingsWindow = SettingsWindow("Recording Settings", recordingSettings, 330, 320, 330, 320); VisualiserComponent visualiser{ audioProcessor, #if SOSCI_FEATURES diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index bf18aee..42cef07 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -226,7 +226,7 @@ void OscirenderAudioProcessor::addLuaSlider() { "Lua Slider " + sliderName, "Controls the value of the Lua variable called slider_" + sliderName.toLowerCase() + ".", "lua" + sliderName, - VERSION_HINT, 0.0, 0.0, 1.0, 0.001, false + VERSION_HINT, 0.0, 0.0, 1.0 ) )); } diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 9e2621a..a3530c9 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -77,13 +77,13 @@ public: "Trace Start", "Defines how far into the frame the drawing is started at. This has the effect of 'tracing' out the image from a single dot when animated. By default, we start drawing from the beginning of the frame, so this value is 0.0.", "traceStart", - VERSION_HINT, 0.0, 0.0, 1.0, 0.001, 0.001 + VERSION_HINT, 0.0, 0.0, 1.0, 0.001 ), new EffectParameter( "Trace Length", "Defines how much of the frame is drawn per cycle. This has the effect of 'tracing' out the image from a single dot when animated. By default, we draw the whole frame, corresponding to a value of 1.0.", "traceLength", - VERSION_HINT, 1.0, 0.0, 1.0, 0.001, 0.001 + VERSION_HINT, 1.0, 0.0, 1.0, 0.001 ), } ); @@ -170,7 +170,7 @@ public: "Image Stride", "Controls the spacing between pixels when drawing an image. Larger values mean more of the image can be drawn, but at a lower fidelity.", "imageStride", - VERSION_HINT, 4, 1, 50, 1, false + VERSION_HINT, 4, 1, 50, 1 ) ); diff --git a/Source/audio/EffectParameter.h b/Source/audio/EffectParameter.h index 32f5324..b8e156d 100644 --- a/Source/audio/EffectParameter.h +++ b/Source/audio/EffectParameter.h @@ -448,7 +448,7 @@ public: return lfoEnabled; } - EffectParameter(juce::String name, juce::String description, juce::String id, int versionHint, float value, float min, float max, float step = 0.0001, double smoothValueChange = SMOOTHING_SPEED_CONSTANT) : FloatParameter(name, id, versionHint, value, min, max, step), smoothValueChange(smoothValueChange), description(description) {} + EffectParameter(juce::String name, juce::String description, juce::String id, int versionHint, float value, float min, float max, float step = 0.0001) : FloatParameter(name, id, versionHint, value, min, max, step), description(description) {} private: bool lfoEnabled = true; diff --git a/Source/visualiser/VisualiserComponent.cpp b/Source/visualiser/VisualiserComponent.cpp index 49aa04a..05c3b3c 100644 --- a/Source/visualiser/VisualiserComponent.cpp +++ b/Source/visualiser/VisualiserComponent.cpp @@ -885,7 +885,7 @@ void VisualiserComponent::setupTextures() { Texture VisualiserComponent::makeTexture(int width, int height, GLuint textureID) { using namespace juce::gl; - + // replace existing texture if it exists, otherwise create new texture if (textureID == 0) { glGenTextures(1, &textureID); @@ -900,17 +900,28 @@ Texture VisualiserComponent::makeTexture(int width, int height, GLuint textureID glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); float borderColor[] = { 0.0f, 0.0f, 0.0f, 1.0f }; glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); - + + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); + glViewport(0, 0, width, height); + + // Clear it once so we don't see uninitialized pixels + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + glBindTexture(GL_TEXTURE_2D, 0); // Unbind - + return { textureID, width, height }; } void VisualiserComponent::setResolution(int width) { using namespace juce::gl; - + + glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer); + lineTexture = makeTexture(width, width, lineTexture.id); renderTexture = makeTexture(width, width, renderTexture.id); + + glBindFramebuffer(GL_FRAMEBUFFER, 0); // Unbind } void VisualiserComponent::drawLineTexture(const std::vector& xPoints, const std::vector& yPoints, const std::vector& zPoints) {