kopia lustrzana https://github.com/jameshball/osci-render
17 wiersze
508 B
C++
17 wiersze
508 B
C++
#include "DistortEffect.h"
|
|
|
|
DistortEffect::DistortEffect(bool vertical) : vertical(vertical) {}
|
|
|
|
DistortEffect::~DistortEffect() {}
|
|
|
|
OsciPoint DistortEffect::apply(int index, OsciPoint input, const std::vector<std::atomic<double>>& values, double sampleRate) {
|
|
double value = values[0];
|
|
int vertical = (int)this->vertical;
|
|
if (index % 2 == 0) {
|
|
input.translate((1 - vertical) * value, vertical * value, 0);
|
|
} else {
|
|
input.translate((1 - vertical) * -value, vertical * -value, 0);
|
|
}
|
|
return input;
|
|
}
|