minor optimizations to remove float->double casts related to uncasted M_PI
@@ -6,17 +6,17 @@ using namespace daisysp;
void phasor::set_freq(float freq)
{
freq_ = freq;
- inc_ = (2.0f * M_PI * freq_) / sample_rate_;
+ inc_ = ((float)M_TWOPI * freq_) / sample_rate_;
}
float phasor::process()
{
float out;
- out = phs_ / (2.0f * M_PI);
+ out = phs_ / ((float)M_TWOPI);
phs_ += inc_;
- if(phs_ > 2.0f * M_PI)
+ if(phs_ > (float)M_TWOPI)
{
- phs_ -= 2.0f * M_PI;
+ phs_ -= (float)M_TWOPI;
}
if(phs_ < 0.0f)
{
