From 3423ccd893d64eb9f0b2de2ef0f04e0d0982abba Mon Sep 17 00:00:00 2001 From: James Ball Date: Tue, 13 Feb 2024 08:48:15 +0000 Subject: [PATCH] Add ripple effect --- Source/PluginProcessor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 5e93602b..f865587d 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -52,6 +52,18 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() toggleableEffects.push_back(std::make_shared( std::make_shared(true), new EffectParameter("Distort Y", "Distorts the image in the vertical direction by jittering the audio sample being drawn.", "distortY", VERSION_HINT, 0.0, 0.0, 1.0) + )); + toggleableEffects.push_back(std::make_shared( + [this](int index, Point input, const std::vector& values, double sampleRate) { + double phase = values[1] * std::numbers::pi; + double distance = 100 * values[2] * (input.x * input.x + input.y * input.y); + input.z += values[0] * std::sin(phase + distance); + return input; + }, std::vector{ + new EffectParameter("Ripple Depth", "Controls how large the ripples applied to the image are.", "rippleDepth", VERSION_HINT, 0.0, 0.0, 1.0), + new EffectParameter("Ripple Phase", "Controls the position of the ripple. Animate this to see a moving ripple effect.", "ripplePhase", VERSION_HINT, 0.0, -1.0, 1.0), + new EffectParameter("Ripple Amount", "Controls how many ripples are applied to the image.", "rippleAmount", VERSION_HINT, 0.1, 0.0, 1.0), + } )); toggleableEffects.push_back(std::make_shared( [this](int index, Point input, const std::vector& values, double sampleRate) {