electro-smith / DaisySP

A Powerful DSP Library in C++
https://www.electro-smith.com/daisy
Other
882 stars 139 forks source link

Phasor doesn't play nice with negative frequencies #201

Open v7b1 opened 8 months ago

v7b1 commented 8 months ago

The setFreq method of the Phasor class accepts negative values, which is nice cause it would allow the phasor to run in reverse (ramp down). But the Process() routine clips negative phase values to zero instead of wrapping to the maximum value.

Should probably be something like:

if(phs_ < 0.0f) { phs_ += TWOPI_F; // phs_ = 0.0f; }