Browse Source

Fix phase of analog triangle wave in VCO.

tags/v1.0.2
Andrew Belt 3 years ago
parent
commit
bc2ae6e962
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/VCO.cpp

+ 3
- 2
src/VCO.cpp View File

@@ -201,8 +201,9 @@ struct VoltageControlledOscillator {
if (analog) {
T x = phase + 0.25f;
x -= simd::trunc(x);
T halfX = (x < 0.5f);
x = 2 * x - simd::ifelse(halfX, 0.f, 1.f);
T halfX = (x >= 0.5f);
x *= 2;
x -= simd::trunc(x);
v = expCurve(x) * simd::ifelse(halfX, 1.f, -1.f);
}
else {


Loading…
Cancel
Save