Skip to content

Commit

Permalink
initial morph value fix (#7775)
Browse files Browse the repository at this point in the history
* initial morph value fix

If you modulated the morph value, the initial is never set. instead it interpolates to the initial value from zero, which can cause a glitch in the beginning of each note.

* Update WavetableOscillator.cpp

---------

Co-authored-by: EvilDragon <[email protected]>
  • Loading branch information
blancoberg and mkruselj authored Aug 26, 2024
1 parent 200851c commit 82f86a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/dsp/oscillators/WavetableOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ void WavetableOscillator::init(float pitch, bool is_display, bool nonzero_init_d
// nointerp adjusts the tableid range so that it scans the whole wavetable
// rather than wavetable from first to second to last frame
nointerp = !oscdata->p[wt_morph].extend_range;
float shape = oscdata->p[wt_morph].val.f;

float shape = l_shape.v;

float intpart;
shape *= ((float)oscdata->wt.n_tables - 1.f + nointerp) * 0.99999f;
tableipol = modff(shape, &intpart);
Expand Down

0 comments on commit 82f86a2

Please sign in to comment.