kopia lustrzana https://github.com/jameshball/osci-render
24 wiersze
952 B
C++
24 wiersze
952 B
C++
#pragma once
|
|
#include <JuceHeader.h>
|
|
|
|
class SwirlEffectApp : public osci::EffectApplication {
|
|
public:
|
|
osci::Point apply(int /*index*/, osci::Point input, const std::vector<std::atomic<double>>& values, double /*sampleRate*/) override {
|
|
double length = 10 * values[0] * input.magnitude();
|
|
double newX = input.x * std::cos(length) - input.y * std::sin(length);
|
|
double newY = input.x * std::sin(length) + input.y * std::cos(length);
|
|
return osci::Point(newX, newY, input.z);
|
|
}
|
|
|
|
std::shared_ptr<osci::Effect> build() const override {
|
|
auto eff = std::make_shared<osci::Effect>(
|
|
std::make_shared<SwirlEffectApp>(),
|
|
std::vector<osci::EffectParameter*>{
|
|
new osci::EffectParameter("Swirl", "Swirls the image in a spiral pattern.", "swirl", VERSION_HINT, 0.4, -1.0, 1.0),
|
|
}
|
|
);
|
|
eff->setIcon(BinaryData::swirl_svg);
|
|
return eff;
|
|
}
|
|
};
|