diff --git a/Source/PS_Source/Stretch.cpp b/Source/PS_Source/Stretch.cpp index e73f7e9..fda16e8 100644 --- a/Source/PS_Source/Stretch.cpp +++ b/Source/PS_Source/Stretch.cpp @@ -94,7 +94,7 @@ void FFT::smp2freq() void FFT::freq2smp() { - REALTYPE inv_2p15_2pi=1.0f/16384.0f*(float)M_PI; + REALTYPE inv_2p15_2pi=1.0f/16384.0f*(float)c_PI; for (int i=1;ifreq2smp(); //make the output buffer - REALTYPE tmp=(float)(1.0/(float) bufsize*M_PI); + REALTYPE tmp=(float)(1.0/(float) bufsize*c_PI); REALTYPE hinv_sqrt2=0.853553390593f;//(1.0+1.0/sqrt(2))*0.5; REALTYPE ampfactor=2.0f; diff --git a/Source/PS_Source/globals.h b/Source/PS_Source/globals.h index f696d20..bc915a5 100644 --- a/Source/PS_Source/globals.h +++ b/Source/PS_Source/globals.h @@ -61,9 +61,7 @@ inline String formatted(Args... args) #define NULL 0 #endif -#ifndef M_PI -#define M_PI 3.14159265359 -#endif +const double c_PI = 3.14159265359; const int g_maxnumoutchans = 32; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index bc8f230..cd58b5f 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -843,7 +843,7 @@ void SpectralVisualizer::setState(const ProcessParameters & pars, int nfreqs, do for (int j = 0; j < numharmonics; ++j) { double oscgain = 1.0 - (1.0 / numharmonics)*j; - m_insamples[i] += scaler * oscgain * sin(2 * 3.141592653 / samplerate * i* (hz + hz * j)); + m_insamples[i] += scaler * oscgain * sin(2 * c_PI / samplerate * i* (hz + hz * j)); } } } diff --git a/Source/jcdp_envelope.h b/Source/jcdp_envelope.h index 88311e0..307aa85 100644 --- a/Source/jcdp_envelope.h +++ b/Source/jcdp_envelope.h @@ -596,8 +596,9 @@ public: double center_v = m_minvalue + (m_maxvalue - m_minvalue) / 2.0; double diff = center_v - v; double scaled = center_v - m_transform_y_scale * diff; - double shifted = scaled + m_transform_y_shift + m_transform_y_sinus* - sin(2*3.141592653*(x-m_transform_x_shift)*m_transform_y_sinus_freq); + double shifted = scaled + m_transform_y_shift; + if (m_transform_y_sinus>0.0) + shifted+=m_transform_y_sinus * sin(2*c_PI*(x-m_transform_x_shift)*m_transform_y_sinus_freq); double tiltline = m_transform_y_tilt-(2.0*m_transform_y_tilt*x); double tilted = shifted+tiltline; if (m_transform_y_random_amount > 0.0)