Change M_PI to G_PI
authorDavid Schleef <ds@schleef.org>
Thu, 30 Dec 2010 22:20:52 +0000 (14:20 -0800)
committerDavid Schleef <ds@schleef.org>
Thu, 30 Dec 2010 22:20:52 +0000 (14:20 -0800)
13 files changed:
gst/audiofx/audiochebband.c
gst/audiofx/audiocheblimit.c
gst/audiofx/audiokaraoke.c
gst/audiofx/audiowsincband.c
gst/audiofx/audiowsinclimit.c
gst/effectv/gstop.c
gst/equalizer/gstiirequalizer.c
gst/goom/convolve_fx.c
gst/goom/ifs.c
gst/goom/lines.c
gst/goom/tentacle3d.c
tests/examples/audiofx/firfilter-example.c
tests/examples/audiofx/iirfilter-example.c

index 037304c..89a950c 100644 (file)
@@ -229,7 +229,7 @@ generate_biquad_coefficients (GstAudioChebBand * filter,
 
   /* Calculate pole location for lowpass at frequency 1 */
   {
-    gdouble angle = (M_PI / 2.0) * (2.0 * p - 1) / np;
+    gdouble angle = (G_PI / 2.0) * (2.0 * p - 1) / np;
 
     rp = -sin (angle);
     ip = cos (angle);
@@ -266,7 +266,7 @@ generate_biquad_coefficients (GstAudioChebBand * filter,
   /* Calculate zero location for frequency 1 on the
    * unit circle for type 2 */
   if (type == 2) {
-    gdouble angle = M_PI / (np * 2.0) + ((p - 1) * M_PI) / (np);
+    gdouble angle = G_PI / (np * 2.0) + ((p - 1) * G_PI) / (np);
     gdouble mag2;
 
     iz = cos (angle);
@@ -339,10 +339,10 @@ generate_biquad_coefficients (GstAudioChebBand * filter,
     gdouble a, b, d;
     gdouble alpha, beta;
     gdouble w0 =
-        2.0 * M_PI * (filter->lower_frequency /
+        2.0 * G_PI * (filter->lower_frequency /
         GST_AUDIO_FILTER (filter)->format.rate);
     gdouble w1 =
-        2.0 * M_PI * (filter->upper_frequency /
+        2.0 * G_PI * (filter->upper_frequency /
         GST_AUDIO_FILTER (filter)->format.rate);
 
     if (filter->mode == MODE_BAND_PASS) {
@@ -498,10 +498,10 @@ generate_coefficients (GstAudioChebBand * filter)
       /* gain is H(wc), wc = center frequency */
 
       gdouble w1 =
-          2.0 * M_PI * (filter->lower_frequency /
+          2.0 * G_PI * (filter->lower_frequency /
           GST_AUDIO_FILTER (filter)->format.rate);
       gdouble w2 =
-          2.0 * M_PI * (filter->upper_frequency /
+          2.0 * G_PI * (filter->upper_frequency /
           GST_AUDIO_FILTER (filter)->format.rate);
       gdouble w0 = (w2 + w1) / 2.0;
       gdouble zr = cos (w0), zi = sin (w0);
@@ -530,10 +530,10 @@ generate_coefficients (GstAudioChebBand * filter)
                 np + 1, 1.0, 0.0)));
     {
       gdouble w1 =
-          2.0 * M_PI * (filter->lower_frequency /
+          2.0 * G_PI * (filter->lower_frequency /
           GST_AUDIO_FILTER (filter)->format.rate);
       gdouble w2 =
-          2.0 * M_PI * (filter->upper_frequency /
+          2.0 * G_PI * (filter->upper_frequency /
           GST_AUDIO_FILTER (filter)->format.rate);
       gdouble w0 = (w2 + w1) / 2.0;
       gdouble zr, zi;
index 02cbc14..8d51fbb 100644 (file)
@@ -222,7 +222,7 @@ generate_biquad_coefficients (GstAudioChebLimit * filter,
 
   /* Calculate pole location for lowpass at frequency 1 */
   {
-    gdouble angle = (M_PI / 2.0) * (2.0 * p - 1) / np;
+    gdouble angle = (G_PI / 2.0) * (2.0 * p - 1) / np;
 
     rp = -sin (angle);
     ip = cos (angle);
@@ -259,7 +259,7 @@ generate_biquad_coefficients (GstAudioChebLimit * filter,
   /* Calculate zero location for frequency 1 on the
    * unit circle for type 2 */
   if (type == 2) {
-    gdouble angle = M_PI / (np * 2.0) + ((p - 1) * M_PI) / (np);
+    gdouble angle = G_PI / (np * 2.0) + ((p - 1) * G_PI) / (np);
     gdouble mag2;
 
     iz = cos (angle);
@@ -324,7 +324,7 @@ generate_biquad_coefficients (GstAudioChebLimit * filter,
   {
     gdouble k, d;
     gdouble omega =
-        2.0 * M_PI * (filter->cutoff / GST_AUDIO_FILTER (filter)->format.rate);
+        2.0 * G_PI * (filter->cutoff / GST_AUDIO_FILTER (filter)->format.rate);
 
     if (filter->mode == MODE_LOW_PASS)
       k = sin ((1.0 - omega) / 2.0) / sin ((1.0 + omega) / 2.0);
@@ -456,7 +456,7 @@ generate_coefficients (GstAudioChebLimit * filter)
 #ifndef GST_DISABLE_GST_DEBUG
     {
       gdouble wc =
-          2.0 * M_PI * (filter->cutoff /
+          2.0 * G_PI * (filter->cutoff /
           GST_AUDIO_FILTER (filter)->format.rate);
       gdouble zr = cos (wc), zi = sin (wc);
 
index aeda8d3..c6fb93e 100644 (file)
@@ -179,8 +179,8 @@ update_filter (GstAudioKaraoke * filter, gint rate)
   if (rate == 0)
     return;
 
-  C = exp (-2 * M_PI * filter->filter_width / rate);
-  B = -4 * C / (1 + C) * cos (2 * M_PI * filter->filter_band / rate);
+  C = exp (-2 * G_PI * filter->filter_width / rate);
+  B = -4 * C / (1 + C) * cos (2 * G_PI * filter->filter_band / rate);
   A = sqrt (1 - B * B / (4 * C)) * (1 - C);
 
   filter->A = A;
index 4b76a16..c6e2a0d 100644 (file)
@@ -255,7 +255,7 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
       (self->mode == MODE_BAND_PASS) ? "band-pass" : "band-reject");
 
   /* fill the lp kernel */
-  w = 2 * M_PI * (self->lower_frequency / GST_AUDIO_FILTER (self)->format.rate);
+  w = 2 * G_PI * (self->lower_frequency / GST_AUDIO_FILTER (self)->format.rate);
   kernel_lp = g_new (gdouble, len);
   for (i = 0; i < len; ++i) {
     if (i == len / 2)
@@ -265,11 +265,11 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
           / (i - len / 2);
     /* Windowing */
     if (self->window == WINDOW_HAMMING)
-      kernel_lp[i] *= (0.54 - 0.46 * cos (2 * M_PI * i / len));
+      kernel_lp[i] *= (0.54 - 0.46 * cos (2 * G_PI * i / len));
     else
       kernel_lp[i] *=
-          (0.42 - 0.5 * cos (2 * M_PI * i / len) +
-          0.08 * cos (4 * M_PI * i / len));
+          (0.42 - 0.5 * cos (2 * G_PI * i / len) +
+          0.08 * cos (4 * G_PI * i / len));
   }
 
   /* normalize for unity gain at DC */
@@ -280,7 +280,7 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
     kernel_lp[i] /= sum;
 
   /* fill the hp kernel */
-  w = 2 * M_PI * (self->upper_frequency / GST_AUDIO_FILTER (self)->format.rate);
+  w = 2 * G_PI * (self->upper_frequency / GST_AUDIO_FILTER (self)->format.rate);
   kernel_hp = g_new (gdouble, len);
   for (i = 0; i < len; ++i) {
     if (i == len / 2)
@@ -290,11 +290,11 @@ gst_audio_wsincband_build_kernel (GstAudioWSincBand * self)
           / (i - len / 2);
     /* Windowing */
     if (self->window == WINDOW_HAMMING)
-      kernel_hp[i] *= (0.54 - 0.46 * cos (2 * M_PI * i / len));
+      kernel_hp[i] *= (0.54 - 0.46 * cos (2 * G_PI * i / len));
     else
       kernel_hp[i] *=
-          (0.42 - 0.5 * cos (2 * M_PI * i / len) +
-          0.08 * cos (4 * M_PI * i / len));
+          (0.42 - 0.5 * cos (2 * G_PI * i / len) +
+          0.08 * cos (4 * G_PI * i / len));
   }
 
   /* normalize for unity gain at DC */
index 4b79e93..046f1ca 100644 (file)
@@ -239,7 +239,7 @@ gst_audio_wsinclimit_build_kernel (GstAudioWSincLimit * self)
       (self->mode == MODE_LOW_PASS) ? "low-pass" : "high-pass");
 
   /* fill the kernel */
-  w = 2 * M_PI * (self->cutoff / GST_AUDIO_FILTER (self)->format.rate);
+  w = 2 * G_PI * (self->cutoff / GST_AUDIO_FILTER (self)->format.rate);
 
   kernel = g_new (gdouble, len);
 
@@ -250,10 +250,10 @@ gst_audio_wsinclimit_build_kernel (GstAudioWSincLimit * self)
       kernel[i] = sin (w * (i - len / 2)) / (i - len / 2);
     /* windowing */
     if (self->window == WINDOW_HAMMING)
-      kernel[i] *= (0.54 - 0.46 * cos (2 * M_PI * i / len));
+      kernel[i] *= (0.54 - 0.46 * cos (2 * G_PI * i / len));
     else
-      kernel[i] *= (0.42 - 0.5 * cos (2 * M_PI * i / len) +
-          0.08 * cos (4 * M_PI * i / len));
+      kernel[i] *= (0.42 - 0.5 * cos (2 * G_PI * i / len) +
+          0.08 * cos (4 * G_PI * i / len));
   }
 
   /* normalize for unity gain at DC */
index d9e35df..de798dc 100644 (file)
@@ -161,14 +161,14 @@ setOpmap (gint8 * opmap[4], gint width, gint height)
 #endif
 
       opmap[OP_SPIRAL1][i] = ((guint)
-          ((at / M_PI * 256) + (r * 4000))) & 255;
+          ((at / G_PI * 256) + (r * 4000))) & 255;
 
       j = r * 300 / 32;
       rr = r * 300 - j * 32;
       j *= 64;
       j += (rr > 28) ? (rr - 28) * 16 : 0;
       opmap[OP_SPIRAL2][i] = ((guint)
-          ((at / M_PI * 4096) + (r * 1600) - j)) & 255;
+          ((at / G_PI * 4096) + (r * 1600) - j)) & 255;
 
       opmap[OP_PARABOLA][i] =
           ((guint) (yy / (xx * xx * 0.3 + 0.1) * 400)) & 255;
index b679d4d..0b76748 100644 (file)
@@ -441,11 +441,11 @@ calculate_omega (gdouble freq, gint rate)
   gdouble omega;
 
   if (freq / rate >= 0.5)
-    omega = M_PI;
+    omega = G_PI;
   else if (freq <= 0.0)
     omega = 0.0;
   else
-    omega = 2.0 * M_PI * (freq / rate);
+    omega = 2.0 * G_PI * (freq / rate);
 
   return omega;
 }
@@ -456,10 +456,10 @@ calculate_bw (GstIirEqualizerBand * band, gint rate)
   gdouble bw = 0.0;
 
   if (band->width / rate >= 0.5) {
-    /* If bandwidth == 0.5 the calculation below fails as tan(M_PI/2)
+    /* If bandwidth == 0.5 the calculation below fails as tan(G_PI/2)
      * is undefined. So set the bandwidth to a slightly smaller value.
      */
-    bw = M_PI - 0.00000001;
+    bw = G_PI - 0.00000001;
   } else if (band->width <= 0.0) {
     /* If bandwidth == 0 this band won't change anything so set
      * the coefficients accordingly. The coefficient calculation
@@ -472,7 +472,7 @@ calculate_bw (GstIirEqualizerBand * band, gint rate)
     band->b1 = 0.0;
     band->b2 = 0.0;
   } else {
-    bw = 2.0 * M_PI * (band->width / rate);
+    bw = 2.0 * G_PI * (band->width / rate);
   }
   return bw;
 }
index 349de4d..457b5eb 100644 (file)
@@ -76,7 +76,7 @@ compute_tables (VisualFX * _this, PluginInfo * info)
   data->h_height = info->screen.height;
 
   for (i = 0; i < NB_THETA; i++) {
-    radian = 2 * i * M_PI / NB_THETA;
+    radian = 2 * i * G_PI / NB_THETA;
     h = (0.2 + cos (radian) / 15.0 * sin (radian * 2.0 + 12.123)) * screen_coef;
     data->h_cos[i] = 0x10000 * (-h * cos (radian) * cos (radian));
     data->h_sin[i] = 0x10000 * (h * sin (radian + 1.57) * sin (radian));
index 9c59d92..3684dcc 100644 (file)
@@ -177,8 +177,8 @@ Random_Simis (PluginInfo * goomInfo, FRACTAL * F, SIMI * Cur, int i)
     Cur->c_y = Gauss_Rand (goomInfo, 0.0, .8, 4.0);
     Cur->r = Gauss_Rand (goomInfo, F->r_mean, F->dr_mean, 3.0);
     Cur->r2 = Half_Gauss_Rand (goomInfo, 0.0, F->dr2_mean, 2.0);
-    Cur->A = Gauss_Rand (goomInfo, 0.0, 360.0, 4.0) * (M_PI / 180.0);
-    Cur->A2 = Gauss_Rand (goomInfo, 0.0, 360.0, 4.0) * (M_PI / 180.0);
+    Cur->A = Gauss_Rand (goomInfo, 0.0, 360.0, 4.0) * (G_PI / 180.0);
+    Cur->A2 = Gauss_Rand (goomInfo, 0.0, 360.0, 4.0) * (G_PI / 180.0);
     Cur++;
   }
 }
index 849fbe6..096240c 100644 (file)
@@ -70,7 +70,7 @@ genline (int id, float param, GMUnitPointer * l, int rx, int ry)
       for (i = 0; i < 512; i++) {
         l[i].x = ((float) i * rx) / 512.0f;
         l[i].y = param;
-        l[i].angle = M_PI / 2.0f;
+        l[i].angle = G_PI / 2.0f;
       }
       return;
     case GML_VLINE:
@@ -84,7 +84,7 @@ genline (int id, float param, GMUnitPointer * l, int rx, int ry)
       for (i = 0; i < 512; i++) {
         float cosa, sina;
 
-        l[i].angle = 2.0f * M_PI * (float) i / 512.0f;
+        l[i].angle = 2.0f * G_PI * (float) i / 512.0f;
         cosa = param * cos (l[i].angle);
         sina = param * sin (l[i].angle);
         l[i].x = ((float) rx / 2.0f) + cosa;
index 83de43e..4c0d143 100644 (file)
@@ -51,7 +51,7 @@ typedef struct _TENTACLE_FX_DATA
   /* statics from pretty_move */
   float distt;
   float distt2;
-  float rot;                    /* entre 0 et 2 * M_PI */
+  float rot;                    /* entre 0 et 2 * G_PI */
   int happens;
   int rotation;
   int lock;
@@ -85,7 +85,7 @@ tentacle_fx_init (VisualFX * _this, PluginInfo * info)
 
   data->distt = 10.0f;
   data->distt2 = 0.0f;
-  data->rot = 0.0f;             /* entre 0 et 2 * M_PI */
+  data->rot = 0.0f;             /* entre 0 et 2 * G_PI */
   data->happens = 0;
 
   data->rotation = 0;
@@ -253,27 +253,27 @@ pretty_move (PluginInfo * goomInfo, float cycle, float *dist, float *dist2,
   *dist = fx_data->distt = (tmp + 3.0f * fx_data->distt) / 4.0f;
 
   if (!fx_data->happens) {
-    tmp = M_PI * sin (cycle) / 32 + 3 * M_PI / 2;
+    tmp = G_PI * sin (cycle) / 32 + 3 * G_PI / 2;
   } else {
     fx_data->rotation =
         goom_irand (goomInfo->gRandom,
         500) ? fx_data->rotation : goom_irand (goomInfo->gRandom, 2);
     if (fx_data->rotation)
-      cycle *= 2.0f * M_PI;
+      cycle *= 2.0f * G_PI;
     else
-      cycle *= -1.0f * M_PI;
-    tmp = cycle - (M_PI * 2.0) * floor (cycle / (M_PI * 2.0));
+      cycle *= -1.0f * G_PI;
+    tmp = cycle - (G_PI * 2.0) * floor (cycle / (G_PI * 2.0));
   }
 
-  if (abs (tmp - fx_data->rot) > abs (tmp - (fx_data->rot + 2.0 * M_PI))) {
-    fx_data->rot = (tmp + 15.0f * (fx_data->rot + 2 * M_PI)) / 16.0f;
-    if (fx_data->rot > 2.0 * M_PI)
-      fx_data->rot -= 2.0 * M_PI;
+  if (abs (tmp - fx_data->rot) > abs (tmp - (fx_data->rot + 2.0 * G_PI))) {
+    fx_data->rot = (tmp + 15.0f * (fx_data->rot + 2 * G_PI)) / 16.0f;
+    if (fx_data->rot > 2.0 * G_PI)
+      fx_data->rot -= 2.0 * G_PI;
     *rotangle = fx_data->rot;
-  } else if (abs (tmp - fx_data->rot) > abs (tmp - (fx_data->rot - 2.0 * M_PI))) {
-    fx_data->rot = (tmp + 15.0f * (fx_data->rot - 2.0 * M_PI)) / 16.0f;
+  } else if (abs (tmp - fx_data->rot) > abs (tmp - (fx_data->rot - 2.0 * G_PI))) {
+    fx_data->rot = (tmp + 15.0f * (fx_data->rot - 2.0 * G_PI)) / 16.0f;
     if (fx_data->rot < 0.0f)
-      fx_data->rot += 2.0 * M_PI;
+      fx_data->rot += 2.0 * G_PI;
     *rotangle = fx_data->rot;
   } else
     *rotangle = fx_data->rot = (tmp + 15.0f * fx_data->rot) / 16.0f;
index a0c3157..b344e74 100644 (file)
@@ -90,7 +90,7 @@ on_rate_changed (GstElement * element, gint rate, gpointer user_data)
    * a better result than given from the rectangular window
    */
   for (i = 0; i < 32; i++)
-    filter_kernel[i] *= (0.54 - 0.46 * cos (2 * M_PI * i / 32));
+    filter_kernel[i] *= (0.54 - 0.46 * cos (2 * G_PI * i / 32));
 
   va = g_value_array_new (1);
 
index 8ccffb7..7fac2ac 100644 (file)
@@ -63,7 +63,7 @@ on_rate_changed (GstElement * element, gint rate, gpointer user_data)
   gdouble x;
 
   if (rate / 2.0 > CUTOFF)
-    x = exp (-2.0 * M_PI * (CUTOFF / rate));
+    x = exp (-2.0 * G_PI * (CUTOFF / rate));
   else
     x = 0.0;