kopia lustrzana https://github.com/jameshball/osci-render
Fix bugs post-refactor and improve quality of wide blur
rodzic
6e86f97649
commit
cc3dae4267
|
@ -2,7 +2,7 @@
|
||||||
#include "CommonPluginEditor.h"
|
#include "CommonPluginEditor.h"
|
||||||
#include <juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h>
|
#include <juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h>
|
||||||
|
|
||||||
CommonPluginEditor::CommonPluginEditor(CommonAudioProcessor& p, juce::String appName, juce::String projectFileType)
|
CommonPluginEditor::CommonPluginEditor(CommonAudioProcessor& p, juce::String appName, juce::String projectFileType, int width, int height)
|
||||||
: AudioProcessorEditor(&p), audioProcessor(p), appName(appName), projectFileType(projectFileType)
|
: AudioProcessorEditor(&p), audioProcessor(p), appName(appName), projectFileType(projectFileType)
|
||||||
{
|
{
|
||||||
if (!applicationFolder.exists()) {
|
if (!applicationFolder.exists()) {
|
||||||
|
@ -60,7 +60,7 @@ CommonPluginEditor::CommonPluginEditor(CommonAudioProcessor& p, juce::String app
|
||||||
|
|
||||||
menuBar.toFront(true);
|
menuBar.toFront(true);
|
||||||
|
|
||||||
setSize(700, 750);
|
setSize(width, height);
|
||||||
setResizable(true, true);
|
setResizable(true, true);
|
||||||
setResizeLimits(250, 250, 999999, 999999);
|
setResizeLimits(250, 250, 999999, 999999);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
class CommonPluginEditor : public juce::AudioProcessorEditor {
|
class CommonPluginEditor : public juce::AudioProcessorEditor {
|
||||||
public:
|
public:
|
||||||
CommonPluginEditor(CommonAudioProcessor&, juce::String appName, juce::String projectFileType);
|
CommonPluginEditor(CommonAudioProcessor&, juce::String appName, juce::String projectFileType, int width, int height);
|
||||||
~CommonPluginEditor() override;
|
~CommonPluginEditor() override;
|
||||||
|
|
||||||
void initialiseMenuBar(juce::MenuBarModel& menuBarModel);
|
void initialiseMenuBar(juce::MenuBarModel& menuBarModel);
|
||||||
|
|
|
@ -126,6 +126,7 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
|
||||||
|
|
||||||
BooleanParameter* visualiserFullScreen = audioProcessor.visualiserParameters.visualiserFullScreen;
|
BooleanParameter* visualiserFullScreen = audioProcessor.visualiserParameters.visualiserFullScreen;
|
||||||
|
|
||||||
|
addAndMakeVisible(pluginEditor.visualiser);
|
||||||
pluginEditor.visualiser.setFullScreenCallback([this, visualiserFullScreen](FullScreenMode mode) {
|
pluginEditor.visualiser.setFullScreenCallback([this, visualiserFullScreen](FullScreenMode mode) {
|
||||||
if (mode == FullScreenMode::TOGGLE) {
|
if (mode == FullScreenMode::TOGGLE) {
|
||||||
visualiserFullScreen->setBoolValueNotifyingHost(!visualiserFullScreen->getBoolValue());
|
visualiserFullScreen->setBoolValueNotifyingHost(!visualiserFullScreen->getBoolValue());
|
||||||
|
@ -142,8 +143,6 @@ MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
|
||||||
resized();
|
resized();
|
||||||
repaint();
|
repaint();
|
||||||
});
|
});
|
||||||
|
|
||||||
addAndMakeVisible(recorder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainComponent::~MainComponent() {}
|
MainComponent::~MainComponent() {}
|
||||||
|
@ -169,9 +168,6 @@ void MainComponent::resized() {
|
||||||
auto buttonHeight = 30;
|
auto buttonHeight = 30;
|
||||||
auto padding = 10;
|
auto padding = 10;
|
||||||
auto rowPadding = 10;
|
auto rowPadding = 10;
|
||||||
|
|
||||||
recorder.setBounds(bounds.removeFromBottom(30));
|
|
||||||
bounds.removeFromBottom(padding);
|
|
||||||
|
|
||||||
auto row = bounds.removeFromTop(buttonHeight);
|
auto row = bounds.removeFromTop(buttonHeight);
|
||||||
fileButton.setBounds(row.removeFromLeft(buttonWidth));
|
fileButton.setBounds(row.removeFromLeft(buttonWidth));
|
||||||
|
@ -212,6 +208,7 @@ void MainComponent::resized() {
|
||||||
createFile.setBounds(row.removeFromLeft(buttonWidth));
|
createFile.setBounds(row.removeFromLeft(buttonWidth));
|
||||||
|
|
||||||
bounds.removeFromTop(padding);
|
bounds.removeFromTop(padding);
|
||||||
|
bounds.expand(10, 0);
|
||||||
if (!audioProcessor.visualiserParameters.visualiserFullScreen->getBoolValue()) {
|
if (!audioProcessor.visualiserParameters.visualiserFullScreen->getBoolValue()) {
|
||||||
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());
|
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());
|
||||||
juce::Point<int> localTopLeft = {bounds.getX(), bounds.getY()};
|
juce::Point<int> localTopLeft = {bounds.getX(), bounds.getY()};
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "audio/PitchDetector.h"
|
#include "audio/PitchDetector.h"
|
||||||
#include "UGen/ugen_JuceEnvelopeComponent.h"
|
#include "UGen/ugen_JuceEnvelopeComponent.h"
|
||||||
#include "components/SvgButton.h"
|
#include "components/SvgButton.h"
|
||||||
#include "components/AudioRecordingComponent.h"
|
|
||||||
|
|
||||||
class OscirenderAudioProcessorEditor;
|
class OscirenderAudioProcessorEditor;
|
||||||
class MainComponent : public juce::GroupComponent {
|
class MainComponent : public juce::GroupComponent {
|
||||||
|
@ -38,7 +37,5 @@ private:
|
||||||
juce::ComboBox fileType;
|
juce::ComboBox fileType;
|
||||||
juce::TextButton createFile{"Create File"};
|
juce::TextButton createFile{"Create File"};
|
||||||
|
|
||||||
AudioRecordingComponent recorder{audioProcessor};
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainComponent)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainComponent)
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h>
|
#include <juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h>
|
||||||
|
|
||||||
OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioProcessor& p)
|
OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioProcessor& p)
|
||||||
: CommonPluginEditor(p, "osci-render", "osci"), audioProcessor(p), collapseButton("Collapse", juce::Colours::white, juce::Colours::white, juce::Colours::white) {
|
: CommonPluginEditor(p, "osci-render", "osci", 1100, 750), audioProcessor(p), collapseButton("Collapse", juce::Colours::white, juce::Colours::white, juce::Colours::white) {
|
||||||
addAndMakeVisible(volume);
|
addAndMakeVisible(volume);
|
||||||
|
|
||||||
addAndMakeVisible(console);
|
addAndMakeVisible(console);
|
||||||
|
@ -66,6 +66,7 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
||||||
}
|
}
|
||||||
|
|
||||||
OscirenderAudioProcessorEditor::~OscirenderAudioProcessorEditor() {
|
OscirenderAudioProcessorEditor::~OscirenderAudioProcessorEditor() {
|
||||||
|
menuBar.setModel(nullptr);
|
||||||
juce::MessageManagerLock lock;
|
juce::MessageManagerLock lock;
|
||||||
audioProcessor.broadcaster.removeChangeListener(this);
|
audioProcessor.broadcaster.removeChangeListener(this);
|
||||||
audioProcessor.fileChangeBroadcaster.removeChangeListener(this);
|
audioProcessor.fileChangeBroadcaster.removeChangeListener(this);
|
||||||
|
|
|
@ -2,11 +2,15 @@
|
||||||
#include "SosciPluginEditor.h"
|
#include "SosciPluginEditor.h"
|
||||||
#include <juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h>
|
#include <juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h>
|
||||||
|
|
||||||
SosciPluginEditor::SosciPluginEditor(SosciAudioProcessor& p) : CommonPluginEditor(p, "sosci", "sosci"), audioProcessor(p) {
|
SosciPluginEditor::SosciPluginEditor(SosciAudioProcessor& p) : CommonPluginEditor(p, "sosci", "sosci", 700, 750), audioProcessor(p) {
|
||||||
initialiseMenuBar(model);
|
initialiseMenuBar(model);
|
||||||
resized();
|
resized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SosciPluginEditor::~SosciPluginEditor() {
|
||||||
|
menuBar.setModel(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void SosciPluginEditor::paint(juce::Graphics& g) {
|
void SosciPluginEditor::paint(juce::Graphics& g) {
|
||||||
g.fillAll(Colours::veryDark);
|
g.fillAll(Colours::veryDark);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
class SosciPluginEditor : public CommonPluginEditor {
|
class SosciPluginEditor : public CommonPluginEditor {
|
||||||
public:
|
public:
|
||||||
SosciPluginEditor(SosciAudioProcessor&);
|
SosciPluginEditor(SosciAudioProcessor&);
|
||||||
|
~SosciPluginEditor() override;
|
||||||
|
|
||||||
void paint(juce::Graphics&) override;
|
void paint(juce::Graphics&) override;
|
||||||
void resized() override;
|
void resized() override;
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include "DoubleTextBox.h"
|
|
||||||
#include "../audio/AudioRecorder.h"
|
|
||||||
|
|
||||||
class AudioRecordingComponent final : public juce::Component {
|
|
||||||
public:
|
|
||||||
AudioRecordingComponent(OscirenderAudioProcessor& p) : audioProcessor(p) {
|
|
||||||
addAndMakeVisible(recordButton);
|
|
||||||
addAndMakeVisible(timedRecord);
|
|
||||||
addAndMakeVisible(recordLength);
|
|
||||||
|
|
||||||
recordButton.setTooltip("Start recording audio to a WAV file. Press again to stop and save the recording.");
|
|
||||||
timedRecord.setTooltip("Record for a set amount of time in seconds. When enabled, the recording will automatically stop once the time is reached.");
|
|
||||||
|
|
||||||
recordLength.setValue(1);
|
|
||||||
|
|
||||||
recordButton.setPulseAnimation(true);
|
|
||||||
recordButton.onClick = [this] {
|
|
||||||
if (recordButton.getToggleState()) {
|
|
||||||
startRecording();
|
|
||||||
} else {
|
|
||||||
stopRecording();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
timedRecord.onClick = [this] {
|
|
||||||
if (timedRecord.getToggleState()) {
|
|
||||||
addAndMakeVisible(recordLength);
|
|
||||||
} else {
|
|
||||||
removeChildComponent(&recordLength);
|
|
||||||
}
|
|
||||||
resized();
|
|
||||||
};
|
|
||||||
|
|
||||||
recorder.stopCallback = [this] {
|
|
||||||
juce::MessageManager::callAsync([this] {
|
|
||||||
recordButton.setToggleState(false, juce::sendNotification);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
audioProcessor.setAudioThreadCallback([this](const juce::AudioBuffer<float>& buffer) { recorder.audioThreadCallback(buffer); });
|
|
||||||
}
|
|
||||||
|
|
||||||
~AudioRecordingComponent() {
|
|
||||||
audioProcessor.setAudioThreadCallback(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void resized() override {
|
|
||||||
double iconSize = 25;
|
|
||||||
|
|
||||||
auto area = getLocalBounds();
|
|
||||||
recordButton.setBounds(area.removeFromLeft(iconSize).withSizeKeepingCentre(iconSize, iconSize));
|
|
||||||
area.removeFromLeft(5);
|
|
||||||
timedRecord.setBounds(area.removeFromLeft(iconSize).withSizeKeepingCentre(iconSize, iconSize));
|
|
||||||
if (timedRecord.getToggleState()) {
|
|
||||||
recordLength.setBounds(area.removeFromLeft(80).withSizeKeepingCentre(60, 25));
|
|
||||||
}
|
|
||||||
area.removeFromLeft(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
OscirenderAudioProcessor& audioProcessor;
|
|
||||||
|
|
||||||
AudioRecorder recorder;
|
|
||||||
|
|
||||||
SvgButton recordButton{ "record", BinaryData::record_svg, juce::Colours::red, juce::Colours::red.withAlpha(0.01f) };
|
|
||||||
juce::File lastRecording;
|
|
||||||
juce::FileChooser chooser { "Output file...", juce::File::getCurrentWorkingDirectory().getChildFile("recording.wav"), "*.wav" };
|
|
||||||
SvgButton timedRecord{ "timedRecord", BinaryData::timer_svg, juce::Colours::white, juce::Colours::red };
|
|
||||||
DoubleTextBox recordLength{ 0, 60 * 60 * 24 };
|
|
||||||
|
|
||||||
void startRecording() {
|
|
||||||
auto parentDir = juce::File::getSpecialLocation(juce::File::tempDirectory);
|
|
||||||
|
|
||||||
lastRecording = parentDir.getNonexistentChildFile("osci-render-recording", ".wav");
|
|
||||||
if (timedRecord.getToggleState()) {
|
|
||||||
recorder.setRecordLength(recordLength.getValue());
|
|
||||||
} else {
|
|
||||||
recorder.setRecordLength(99999999999.0);
|
|
||||||
}
|
|
||||||
recorder.startRecording(lastRecording);
|
|
||||||
|
|
||||||
recordButton.setColour(juce::TextButton::buttonColourId, juce::Colours::red);
|
|
||||||
recordButton.setColour(juce::TextButton::textColourOnId, juce::Colours::black);
|
|
||||||
}
|
|
||||||
|
|
||||||
void stopRecording() {
|
|
||||||
recorder.stop();
|
|
||||||
|
|
||||||
recordButton.setColour(juce::TextButton::buttonColourId, findColour(juce::TextButton::buttonColourId));
|
|
||||||
recordButton.setColour(juce::TextButton::textColourOnId, findColour(juce::TextButton::textColourOnId));
|
|
||||||
|
|
||||||
chooser.launchAsync(juce::FileBrowserComponent::saveMode
|
|
||||||
| juce::FileBrowserComponent::canSelectFiles
|
|
||||||
| juce::FileBrowserComponent::warnAboutOverwriting,
|
|
||||||
[this](const juce::FileChooser& c) {
|
|
||||||
if (juce::FileInputStream inputStream(lastRecording); inputStream.openedOk()) {
|
|
||||||
juce::URL url = c.getURLResult();
|
|
||||||
if (url.isLocalFile()) {
|
|
||||||
if (const auto outputStream = url.getLocalFile().createOutputStream()) {
|
|
||||||
outputStream->setPosition(0);
|
|
||||||
outputStream->truncate();
|
|
||||||
outputStream->writeFromInputStream(inputStream, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastRecording.deleteFile();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
inline juce::Colour getUIColourIfAvailable(juce::LookAndFeel_V4::ColourScheme::UIColour uiColour, juce::Colour fallback = juce::Colour(0xff4d4d4d)) noexcept {
|
|
||||||
if (auto* v4 = dynamic_cast<juce::LookAndFeel_V4*> (&juce::LookAndFeel::getDefaultLookAndFeel()))
|
|
||||||
return v4->getCurrentColourScheme().getUIColour(uiColour);
|
|
||||||
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::unique_ptr<juce::OutputStream> makeOutputStream(const juce::URL& url) {
|
|
||||||
if (const auto doc = juce::AndroidDocument::fromDocument(url))
|
|
||||||
return doc.createOutputStream();
|
|
||||||
|
|
||||||
#if ! JUCE_IOS
|
|
||||||
if (url.isLocalFile())
|
|
||||||
return url.getLocalFile().createOutputStream();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return url.createOutputStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioRecordingComponent)
|
|
||||||
};
|
|
|
@ -30,7 +30,7 @@ void main() {
|
||||||
vec4 tightGlow = texture2D(uTexture1, vTexCoord);
|
vec4 tightGlow = texture2D(uTexture1, vTexCoord);
|
||||||
vec4 scatter = texture2D(uTexture2, vTexCoord)+0.35;
|
vec4 scatter = texture2D(uTexture2, vTexCoord)+0.35;
|
||||||
float light = line.r + uGlow * 1.5 * screen.g * screen.g * tightGlow.r;
|
float light = line.r + uGlow * 1.5 * screen.g * screen.g * tightGlow.r;
|
||||||
light += uGlow * 0.4 * scatter.g * (2.0 + 1.0 * screen.g + 0.5 * screen.r);
|
light += uGlow * 0.3 * scatter.g * (2.0 + 1.0 * screen.g + 0.5 * screen.r);
|
||||||
float tlight = 1.0-pow(2.0, -uExposure*light);
|
float tlight = 1.0-pow(2.0, -uExposure*light);
|
||||||
float tlight2 = tlight * tlight * tlight;
|
float tlight2 = tlight * tlight * tlight;
|
||||||
gl_FragColor.rgb = mix(uColour, vec3(1.0), 0.3+tlight2*tlight2*0.5)*tlight;
|
gl_FragColor.rgb = mix(uColour, vec3(1.0), 0.3+tlight2*tlight2*0.5)*tlight;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include "VisualiserComponent.h"
|
#include "VisualiserComponent.h"
|
||||||
#include "BlurFragmentShader.glsl"
|
#include "BlurFragmentShader.glsl"
|
||||||
#include "BlurVertexShader.glsl"
|
#include "BlurVertexShader.glsl"
|
||||||
|
#include "WideBlurFragmentShader.glsl"
|
||||||
|
#include "WideBlurVertexShader.glsl"
|
||||||
#include "LineFragmentShader.glsl"
|
#include "LineFragmentShader.glsl"
|
||||||
#include "LineVertexShader.glsl"
|
#include "LineVertexShader.glsl"
|
||||||
#include "OutputFragmentShader.glsl"
|
#include "OutputFragmentShader.glsl"
|
||||||
|
@ -325,6 +327,11 @@ void VisualiserComponent::newOpenGLContextCreated() {
|
||||||
blurShader->addVertexShader(juce::OpenGLHelpers::translateVertexShaderToV3(blurVertexShader));
|
blurShader->addVertexShader(juce::OpenGLHelpers::translateVertexShaderToV3(blurVertexShader));
|
||||||
blurShader->addFragmentShader(blurFragmentShader);
|
blurShader->addFragmentShader(blurFragmentShader);
|
||||||
blurShader->link();
|
blurShader->link();
|
||||||
|
|
||||||
|
wideBlurShader = std::make_unique<juce::OpenGLShaderProgram>(openGLContext);
|
||||||
|
wideBlurShader->addVertexShader(juce::OpenGLHelpers::translateVertexShaderToV3(wideBlurVertexShader));
|
||||||
|
wideBlurShader->addFragmentShader(wideBlurFragmentShader);
|
||||||
|
wideBlurShader->link();
|
||||||
|
|
||||||
glGenBuffers(1, &vertexBuffer);
|
glGenBuffers(1, &vertexBuffer);
|
||||||
glGenBuffers(1, &quadIndexBuffer);
|
glGenBuffers(1, &quadIndexBuffer);
|
||||||
|
@ -462,10 +469,10 @@ void VisualiserComponent::setupTextures() {
|
||||||
|
|
||||||
// Create textures
|
// Create textures
|
||||||
lineTexture = makeTexture(1024, 1024);
|
lineTexture = makeTexture(1024, 1024);
|
||||||
blur1Texture = makeTexture(256, 256);
|
blur1Texture = makeTexture(512, 512);
|
||||||
blur2Texture = makeTexture(256, 256);
|
blur2Texture = makeTexture(512, 512);
|
||||||
blur3Texture = makeTexture(32, 32);
|
blur3Texture = makeTexture(128, 128);
|
||||||
blur4Texture = makeTexture(32, 32);
|
blur4Texture = makeTexture(128, 128);
|
||||||
renderTexture = makeTexture(1024, 1024);
|
renderTexture = makeTexture(1024, 1024);
|
||||||
|
|
||||||
screenTexture = createScreenTexture();
|
screenTexture = createScreenTexture();
|
||||||
|
@ -707,8 +714,6 @@ void VisualiserComponent::fade() {
|
||||||
|
|
||||||
void VisualiserComponent::drawCRT() {
|
void VisualiserComponent::drawCRT() {
|
||||||
using namespace juce::gl;
|
using namespace juce::gl;
|
||||||
|
|
||||||
saveTextureToQOI(lineTexture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("line.qoi"));
|
|
||||||
|
|
||||||
setNormalBlending();
|
setNormalBlending();
|
||||||
|
|
||||||
|
@ -717,46 +722,34 @@ void VisualiserComponent::drawCRT() {
|
||||||
texturedShader->setUniform("uResizeForCanvas", lineTexture.width / 1024.0f);
|
texturedShader->setUniform("uResizeForCanvas", lineTexture.width / 1024.0f);
|
||||||
drawTexture(lineTexture);
|
drawTexture(lineTexture);
|
||||||
|
|
||||||
saveTextureToQOI(blur1Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("blur1.qoi"));
|
|
||||||
|
|
||||||
//horizontal blur 256x256
|
//horizontal blur 256x256
|
||||||
activateTargetTexture(blur2Texture);
|
activateTargetTexture(blur2Texture);
|
||||||
setShader(blurShader.get());
|
setShader(blurShader.get());
|
||||||
blurShader->setUniform("uOffset", 1.0f / 256.0f, 0.0f);
|
blurShader->setUniform("uOffset", 1.0f / 512.0f, 0.0f);
|
||||||
drawTexture(blur1Texture);
|
drawTexture(blur1Texture);
|
||||||
|
|
||||||
saveTextureToQOI(blur2Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("blur2.qoi"));
|
|
||||||
|
|
||||||
//vertical blur 256x256
|
//vertical blur 256x256
|
||||||
activateTargetTexture(blur1Texture);
|
activateTargetTexture(blur1Texture);
|
||||||
blurShader->setUniform("uOffset", 0.0f, 1.0f / 256.0f);
|
blurShader->setUniform("uOffset", 0.0f, 1.0f / 512.0f);
|
||||||
drawTexture(blur2Texture);
|
drawTexture(blur2Texture);
|
||||||
|
|
||||||
saveTextureToQOI(blur1Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("blur1_1.qoi"));
|
|
||||||
|
|
||||||
//preserve blur1 for later
|
//preserve blur1 for later
|
||||||
activateTargetTexture(blur3Texture);
|
activateTargetTexture(blur3Texture);
|
||||||
setShader(texturedShader.get());
|
setShader(texturedShader.get());
|
||||||
texturedShader->setUniform("uResizeForCanvas", 1.0f);
|
texturedShader->setUniform("uResizeForCanvas", 1.0f);
|
||||||
drawTexture(blur1Texture);
|
drawTexture(blur1Texture);
|
||||||
|
|
||||||
saveTextureToQOI(blur3Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("blur3.qoi"));
|
//horizontal blur 128x128
|
||||||
|
|
||||||
//horizontal blur 64x64
|
|
||||||
activateTargetTexture(blur4Texture);
|
activateTargetTexture(blur4Texture);
|
||||||
setShader(blurShader.get());
|
setShader(wideBlurShader.get());
|
||||||
blurShader->setUniform("uOffset", 1.0f / 32.0f, 1.0f / 60.0f);
|
wideBlurShader->setUniform("uOffset", 1.0f / 128.0f, 0.0f);
|
||||||
drawTexture(blur3Texture);
|
drawTexture(blur3Texture);
|
||||||
|
|
||||||
saveTextureToQOI(blur4Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("blur4.qoi"));
|
//vertical blur 128x128
|
||||||
|
|
||||||
//vertical blur 64x64
|
|
||||||
activateTargetTexture(blur3Texture);
|
activateTargetTexture(blur3Texture);
|
||||||
blurShader->setUniform("uOffset", -1.0f / 60.0f, 1.0f / 32.0f);
|
wideBlurShader->setUniform("uOffset", 0.0f, 1.0f / 128.0f);
|
||||||
drawTexture(blur4Texture);
|
drawTexture(blur4Texture);
|
||||||
|
|
||||||
saveTextureToQOI(blur3Texture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("blur3_1.qoi"));
|
|
||||||
|
|
||||||
activateTargetTexture(renderTexture);
|
activateTargetTexture(renderTexture);
|
||||||
setShader(outputShader.get());
|
setShader(outputShader.get());
|
||||||
float brightness = std::pow(2, settings.getBrightness() - 2);
|
float brightness = std::pow(2, settings.getBrightness() - 2);
|
||||||
|
@ -770,8 +763,6 @@ void VisualiserComponent::drawCRT() {
|
||||||
outputShader->setUniform("uColour", colour.getFloatRed(), colour.getFloatGreen(), colour.getFloatBlue());
|
outputShader->setUniform("uColour", colour.getFloatRed(), colour.getFloatGreen(), colour.getFloatBlue());
|
||||||
activateTargetTexture(renderTexture);
|
activateTargetTexture(renderTexture);
|
||||||
drawTexture(lineTexture, blur1Texture, blur3Texture, screenTexture);
|
drawTexture(lineTexture, blur1Texture, blur3Texture, screenTexture);
|
||||||
|
|
||||||
saveTextureToQOI(renderTexture, juce::File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getChildFile("render.qoi"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture VisualiserComponent::createScreenTexture() {
|
Texture VisualiserComponent::createScreenTexture() {
|
||||||
|
|
|
@ -171,6 +171,7 @@ private:
|
||||||
std::unique_ptr<juce::OpenGLShaderProgram> simpleShader;
|
std::unique_ptr<juce::OpenGLShaderProgram> simpleShader;
|
||||||
std::unique_ptr<juce::OpenGLShaderProgram> texturedShader;
|
std::unique_ptr<juce::OpenGLShaderProgram> texturedShader;
|
||||||
std::unique_ptr<juce::OpenGLShaderProgram> blurShader;
|
std::unique_ptr<juce::OpenGLShaderProgram> blurShader;
|
||||||
|
std::unique_ptr<juce::OpenGLShaderProgram> wideBlurShader;
|
||||||
std::unique_ptr<juce::OpenGLShaderProgram> lineShader;
|
std::unique_ptr<juce::OpenGLShaderProgram> lineShader;
|
||||||
std::unique_ptr<juce::OpenGLShaderProgram> outputShader;
|
std::unique_ptr<juce::OpenGLShaderProgram> outputShader;
|
||||||
juce::OpenGLShaderProgram* currentShader;
|
juce::OpenGLShaderProgram* currentShader;
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
std::string wideBlurFragmentShader = R"(
|
||||||
|
|
||||||
|
uniform sampler2D uTexture0;
|
||||||
|
uniform vec2 uOffset;
|
||||||
|
varying vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 sum = vec4(0.0);
|
||||||
|
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -32) * 7.936396739629738e-9;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -31) * 2.1238899047869243e-8;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -30) * 5.5089512435892845e-8;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -29) * 1.3849501900610678e-7;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -28) * 3.37464176550827e-7;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -27) * 7.969838069860066e-7;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -26) * 0.0000018243141024985921;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -25) * 0.000004047417737721991;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -24) * 0.000008703315823121481;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -23) * 0.000018139267838241068;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -22) * 0.00003664232826522744;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -21) * 0.0000717421959978491;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -20) * 0.00013614276559291948;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -19) * 0.00025040486855393973;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -18) * 0.00044639494279724747;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -17) * 0.00077130129517095;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -16) * 0.0012916865959769006;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -15) * 0.0020966142949301195;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -14) * 0.003298437274607801;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -13) * 0.005029516233086111;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -12) * 0.007433143141769405;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -11) * 0.010647485948997013;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -10) * 0.014782570282805454;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -9) * 0.019892122581030056;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -8) * 0.02594421881668063;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -7) * 0.03279656561871859;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -6) * 0.040183192177668754;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -5) * 0.04771872140419803;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -4) * 0.05492391166591576;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -3) * 0.06127205113483162;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -2) * 0.06625088366795348;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * -1) * 0.06943032995966593;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 0) * 0.07052369856294818;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 1) * 0.06943032995966593;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 2) * 0.06625088366795348;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 3) * 0.06127205113483162;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 4) * 0.05492391166591576;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 5) * 0.04771872140419803;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 6) * 0.040183192177668754;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 7) * 0.03279656561871859;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 8) * 0.02594421881668063;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 9) * 0.019892122581030056;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 10) * 0.014782570282805454;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 11) * 0.010647485948997013;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 12) * 0.007433143141769405;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 13) * 0.005029516233086111;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 14) * 0.003298437274607801;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 15) * 0.0020966142949301195;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 16) * 0.0012916865959769006;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 17) * 0.00077130129517095;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 18) * 0.00044639494279724747;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 19) * 0.00025040486855393973;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 20) * 0.00013614276559291948;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 21) * 0.0000717421959978491;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 22) * 0.00003664232826522744;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 23) * 0.000018139267838241068;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 24) * 0.000008703315823121481;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 25) * 0.000004047417737721991;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 26) * 0.0000018243141024985921;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 27) * 7.969838069860066e-7;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 28) * 3.37464176550827e-7;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 29) * 1.3849501900610678e-7;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 30) * 5.5089512435892845e-8;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 31) * 2.1238899047869243e-8;
|
||||||
|
sum += texture2D(uTexture0, vTexCoord + uOffset * 32) * 7.936396739629738e-9;
|
||||||
|
|
||||||
|
gl_FragColor = sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
)";
|
|
@ -0,0 +1,11 @@
|
||||||
|
std::string wideBlurVertexShader = R"(
|
||||||
|
|
||||||
|
attribute vec2 aPos;
|
||||||
|
varying vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_Position = vec4(aPos, 0.0, 1.0);
|
||||||
|
vTexCoord = (0.5*aPos+0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
)";
|
|
@ -137,8 +137,6 @@
|
||||||
file="Source/components/AboutComponent.cpp"/>
|
file="Source/components/AboutComponent.cpp"/>
|
||||||
<FILE id="vDlOTn" name="AboutComponent.h" compile="0" resource="0"
|
<FILE id="vDlOTn" name="AboutComponent.h" compile="0" resource="0"
|
||||||
file="Source/components/AboutComponent.h"/>
|
file="Source/components/AboutComponent.h"/>
|
||||||
<FILE id="M7wyTt" name="AudioRecordingComponent.h" compile="0" resource="0"
|
|
||||||
file="Source/components/AudioRecordingComponent.h"/>
|
|
||||||
<FILE id="kUinTt" name="ComponentList.cpp" compile="1" resource="0"
|
<FILE id="kUinTt" name="ComponentList.cpp" compile="1" resource="0"
|
||||||
file="Source/components/ComponentList.cpp"/>
|
file="Source/components/ComponentList.cpp"/>
|
||||||
<FILE id="HGTPEW" name="ComponentList.h" compile="0" resource="0" file="Source/components/ComponentList.h"/>
|
<FILE id="HGTPEW" name="ComponentList.h" compile="0" resource="0" file="Source/components/ComponentList.h"/>
|
||||||
|
@ -628,6 +626,10 @@
|
||||||
file="Source/visualiser/VisualiserSettings.cpp"/>
|
file="Source/visualiser/VisualiserSettings.cpp"/>
|
||||||
<FILE id="CaPdPD" name="VisualiserSettings.h" compile="0" resource="0"
|
<FILE id="CaPdPD" name="VisualiserSettings.h" compile="0" resource="0"
|
||||||
file="Source/visualiser/VisualiserSettings.h"/>
|
file="Source/visualiser/VisualiserSettings.h"/>
|
||||||
|
<FILE id="Qa4JGo" name="WideBlurFragmentShader.glsl" compile="0" resource="0"
|
||||||
|
file="Source/visualiser/WideBlurFragmentShader.glsl"/>
|
||||||
|
<FILE id="mSCsyS" name="WideBlurVertexShader.glsl" compile="0" resource="0"
|
||||||
|
file="Source/visualiser/WideBlurVertexShader.glsl"/>
|
||||||
</GROUP>
|
</GROUP>
|
||||||
<GROUP id="{DC345620-B6F6-F3B9-D359-C265590B0F00}" name="wav">
|
<GROUP id="{DC345620-B6F6-F3B9-D359-C265590B0F00}" name="wav">
|
||||||
<FILE id="vYzJlF" name="WavParser.cpp" compile="1" resource="0" file="Source/wav/WavParser.cpp"/>
|
<FILE id="vYzJlF" name="WavParser.cpp" compile="1" resource="0" file="Source/wav/WavParser.cpp"/>
|
||||||
|
|
Ładowanie…
Reference in New Issue