2023-03-28 12:44:46 +00:00
|
|
|
#include "EffectApplication.h"
|
2023-03-28 13:33:56 +00:00
|
|
|
#include <numbers>
|
2023-09-09 10:22:14 +00:00
|
|
|
#include "../MathUtil.h"
|
2023-03-28 13:33:56 +00:00
|
|
|
|
|
|
|
void EffectApplication::resetPhase() {
|
|
|
|
phase = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
double EffectApplication::nextPhase(double frequency, double sampleRate) {
|
2023-09-09 10:22:14 +00:00
|
|
|
phase += 2 * std::numbers::pi * frequency / sampleRate;
|
|
|
|
phase = MathUtil::wrapAngle(phase);
|
2023-03-28 13:33:56 +00:00
|
|
|
|
2023-09-09 10:22:14 +00:00
|
|
|
return phase;
|
2023-03-28 13:33:56 +00:00
|
|
|
}
|