2023-07-13 19:11:24 +00:00
|
|
|
#include "WobbleEffect.h"
|
2025-02-01 14:28:13 +00:00
|
|
|
#include "../PluginProcessor.h"
|
2023-07-13 19:11:24 +00:00
|
|
|
|
2025-02-01 14:28:13 +00:00
|
|
|
WobbleEffect::WobbleEffect(OscirenderAudioProcessor& p) : audioProcessor(p) {}
|
2023-07-13 19:11:24 +00:00
|
|
|
|
|
|
|
WobbleEffect::~WobbleEffect() {}
|
|
|
|
|
2025-04-23 14:26:33 +00:00
|
|
|
osci::Point WobbleEffect::apply(int index, osci::Point input, const std::vector<std::atomic<double>>& values, double sampleRate) {
|
2025-02-01 14:28:13 +00:00
|
|
|
double wobblePhase = values[1] * std::numbers::pi;
|
|
|
|
double theta = nextPhase(audioProcessor.frequency, sampleRate) + wobblePhase;
|
|
|
|
double delta = 0.5 * values[0] * std::sin(theta);
|
2023-07-13 19:11:24 +00:00
|
|
|
|
2024-02-12 20:34:00 +00:00
|
|
|
return input + delta;
|
2023-07-13 19:11:24 +00:00
|
|
|
}
|