Merge pull request #324 from ahall99/cpow-effect

Add Radial Wrap (complex power) effect
pull/322/head
James H Ball 2025-09-11 21:38:34 +01:00 zatwierdzone przez GitHub
commit d8bc46b00b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
5 zmienionych plików z 51 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M480-320q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm0-80q33 0 56.5-23.5T560-480q0-33-23.5-56.5T480-560q-33 0-56.5 23.5T400-480q0 33 23.5 56.5T480-400ZM661-80q18-56 27-100t14-70q-43 42-100 66t-122 24q-136 0-238.5-18.5T80-214v-85q56 18 100 27t70 14q-42-43-66-100t-24-122q0-137 18.5-239T214-880h85q-18 56-27.5 100T258-710q43-42 100-66t122-24q137 0 239 18.5T880-746v85q-56-18-100-27.5T710-702q42 43 66 100t24 122q0 137-18.5 239T746-80h-85ZM480-240q100 0 170-70t70-170q0-100-70-170t-170-70q-100 0-170 70t-70 170q0 100 70 170t170 70Z"/></svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 689 B

Wyświetl plik

@ -28,6 +28,7 @@
#include "audio/SwirlEffect.h"
#include "audio/BounceEffect.h"
#include "audio/SkewEffect.h"
#include "audio/VortexEffect.h"
#include "audio/GodRayEffect.h"
#include "parser/FileParser.h"
#include "parser/FrameProducer.h"
@ -60,6 +61,7 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() : CommonAudioProcessor(Buse
toggleableEffects.push_back(BounceEffect().build());
toggleableEffects.push_back(TwistEffect().build());
toggleableEffects.push_back(SkewEffect().build());
toggleableEffects.push_back(VortexEffect().build());
toggleableEffects.push_back(GodRayEffect().build());
toggleableEffects.push_back(SpiralBitCrushEffect().build());
#endif

Wyświetl plik

@ -31,6 +31,7 @@ public:
"Controls whether the rays appear to be radiating inward or outward.",
"godRayPosition", VERSION_HINT, 0.8, -1.0, 1.0)
});
eff->setName("God Ray");
eff->setIcon(BinaryData::god_ray_svg);
return eff;
}

Wyświetl plik

@ -0,0 +1,44 @@
#pragma once
#include <JuceHeader.h>
class VortexEffect : public osci::EffectApplication {
public:
osci::Point apply(int index, osci::Point input, const std::vector<std::atomic<double>> &values, double sampleRate) override {
// Treat input as complex number and raise to integer power
// Disallowing non-integer and negative exponents because of the branch cut
double effectScale = juce::jlimit(0.0, 1.0, values[0].load());
double exponent = juce::jmax(1.0, std::floor(values[1].load() + 0.001));
double refTheta = values[2].load() * juce::MathConstants<double>::twoPi;
osci::Point output(0, 0, input.z);
if (input.x != 0 || input.y != 0) {
double r2 = input.x * input.x + input.y * input.y;
double theta = std::atan2(input.y, input.x) - refTheta;
double outR = std::pow(r2, 0.5 * exponent);
double outTheta = exponent * theta + refTheta;
output.x = outR * std::cos(outTheta);
output.y = outR * std::sin(outTheta);
}
return (1 - effectScale) * input + effectScale * output;
}
std::shared_ptr<osci::Effect> build() const override {
auto eff = std::make_shared<osci::Effect>(
std::make_shared<VortexEffect>(),
std::vector<osci::EffectParameter *>{
new osci::EffectParameter("Vortex Strength",
"Controls the strength of the vortex effect.",
"vortexStrength", VERSION_HINT, 0.6, 0.0, 1.0),
new osci::EffectParameter("Vortex Amount",
"The multiplier applied to each point's angle, creating more vortexes.",
"vortexAmount", VERSION_HINT, 2.0, 2.0, 6.0, 1.0),
new osci::EffectParameter("Vortex Rotation",
"The rotation applied to each point.",
"vortexRotation", VERSION_HINT, 0.25, 0.0, 1.0, 0.0001, osci::LfoType::Sawtooth, 0.2)
});
eff->setName("Vortex");
eff->setIcon(BinaryData::vortex_svg);
return eff;
}
};

Wyświetl plik

@ -156,6 +156,7 @@
<FILE id="praXUY" name="vector-cancelling.svg" compile="0" resource="1"
file="Resources/svg/vector-cancelling.svg"/>
<FILE id="qC6QiP" name="volume.svg" compile="0" resource="1" file="Resources/svg/volume.svg"/>
<FILE id="hH1OSK" name="vortex.svg" compile="0" resource="1" file="Resources/svg/vortex.svg"/>
<FILE id="Unp5Kx" name="waves.svg" compile="0" resource="1" file="Resources/svg/waves.svg"/>
<FILE id="SkgUSk" name="wobble.svg" compile="0" resource="1" file="Resources/svg/wobble.svg"/>
<FILE id="HCK5B8" name="yinyang.svg" compile="0" resource="1" file="Resources/svg/yinyang.svg"/>
@ -170,6 +171,7 @@
</GROUP>
<GROUP id="{75439074-E50C-362F-1EDF-8B4BE9011259}" name="Source">
<GROUP id="{85A33213-D880-BD92-70D8-1901DA6D23F0}" name="audio">
<FILE id="jfRtxu" name="VortexEffect.h" compile="0" resource="0" file="Source/audio/VortexEffect.h"/>
<FILE id="de5H36" name="GodRayEffect.h" compile="0" resource="0" file="Source/audio/GodRayEffect.h"/>
<FILE id="tU2pQl" name="SkewEffect.h" compile="0" resource="0" file="Source/audio/SkewEffect.h"/>
<FILE id="yxWOsR" name="DuplicatorEffect.h" compile="0" resource="0"
@ -910,3 +912,4 @@
<MODULE id="osci_render_core" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
</MODULES>
</JUCERPROJECT>