Skip to content

Commit

Permalink
Clamping the wavetable position
Browse files Browse the repository at this point in the history
  • Loading branch information
aure committed May 18, 2023
1 parent 18d5ed4 commit ee7d954
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ void reset() override {
sp_oscmorph_init(sp, oscmorph, ft_array, 4, 0);
}

float clamp(float x) {
if (x > 1) { x = 1; }
if (x < 0) { x = 0; }
return x;
}

void process(FrameRange range) override {

for (int i : range) {

oscmorph->freq = frequencyRamp.getAndStep() * detuningMultiplierRamp.getAndStep() + detuningOffsetRamp.getAndStep();
oscmorph->amp = amplitudeRamp.getAndStep();
oscmorph->wtpos = indexRamp.getAndStep() / 3.f;
oscmorph->wtpos = clamp(indexRamp.getAndStep() / 3.f);

sp_oscmorph_compute(sp, oscmorph, nil, &outputSample(0, i));
}
Expand Down

0 comments on commit ee7d954

Please sign in to comment.