2023-03-28 13:33:56 +00:00
|
|
|
#include "VectorCancellingEffect.h"
|
|
|
|
|
|
|
|
VectorCancellingEffect::VectorCancellingEffect() {}
|
|
|
|
|
|
|
|
VectorCancellingEffect::~VectorCancellingEffect() {}
|
|
|
|
|
|
|
|
Vector2 VectorCancellingEffect::apply(int index, Vector2 input, double value, double frequency, double sampleRate) {
|
2023-03-29 09:55:11 +00:00
|
|
|
if (value < 0.001) {
|
|
|
|
return input;
|
|
|
|
}
|
2023-03-28 13:33:56 +00:00
|
|
|
frequency = 1.0 + 9.0 * value;
|
|
|
|
if (index < lastIndex) {
|
|
|
|
nextInvert = nextInvert - lastIndex + frequency;
|
|
|
|
}
|
|
|
|
lastIndex = index;
|
|
|
|
if (index >= nextInvert) {
|
|
|
|
nextInvert += frequency;
|
|
|
|
} else {
|
|
|
|
input.scale(-1, -1);
|
|
|
|
}
|
|
|
|
return input;
|
|
|
|
}
|