#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159263
-#endif
-
#ifdef FIXED_POINT
#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
#else
else if (fabs (x) > .5f * N)
return 0;
/*FIXME: Can it really be any slower than this? */
- return WORD2INT (32768. * cutoff * sin (M_PI * xx) / (M_PI * xx) *
+ return WORD2INT (32768. * cutoff * sin (G_PI * xx) / (G_PI * xx) *
compute_func (fabs (2. * x / N), window_func));
}
#else
else if (fabs (x) > .5 * N)
return 0;
/*FIXME: Can it really be any slower than this? */
- return cutoff * sin (M_PI * xx) / (M_PI * xx) * compute_func (fabs (2. * x /
+ return cutoff * sin (G_PI * xx) / (G_PI * xx) * compute_func (fabs (2. * x /
N), window_func);
}
#endif
#include "gstaudiotestsrc.h"
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-#define M_PI_M2 ( M_PI + M_PI )
+#define M_PI_M2 ( G_PI + G_PI )
GST_DEBUG_CATEGORY_STATIC (audio_test_src_debug);
#define GST_CAT_DEFAULT audio_test_src_debug
src->accumulator -= M_PI_M2; \
\
for (c = 0; c < src->channels; ++c) { \
- samples[i++] = (g##type) ((src->accumulator < M_PI) ? amp : -amp); \
+ samples[i++] = (g##type) ((src->accumulator < G_PI) ? amp : -amp); \
} \
} \
}
gdouble step, amp; \
\
step = M_PI_M2 * src->freq / src->samplerate; \
- amp = (src->volume * scale) / M_PI; \
+ amp = (src->volume * scale) / G_PI; \
\
i = 0; \
while (i < (src->generate_samples_per_buffer * src->channels)) { \
if (src->accumulator >= M_PI_M2) \
src->accumulator -= M_PI_M2; \
\
- if (src->accumulator < M_PI) { \
+ if (src->accumulator < G_PI) { \
for (c = 0; c < src->channels; ++c) \
samples[i++] = (g##type) (src->accumulator * amp); \
} else { \
gdouble step, amp; \
\
step = M_PI_M2 * src->freq / src->samplerate; \
- amp = (src->volume * scale) / M_PI_2; \
+ amp = (src->volume * scale) / G_PI_2; \
\
i = 0; \
while (i < (src->generate_samples_per_buffer * src->channels)) { \
if (src->accumulator >= M_PI_M2) \
src->accumulator -= M_PI_M2; \
\
- if (src->accumulator < (M_PI * 0.5)) { \
+ if (src->accumulator < (G_PI_2)) { \
for (c = 0; c < src->channels; ++c) \
samples[i++] = (g##type) (src->accumulator * amp); \
- } else if (src->accumulator < (M_PI * 1.5)) { \
+ } else if (src->accumulator < (G_PI * 1.5)) { \
for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) ((src->accumulator - M_PI) * -amp); \
+ samples[i++] = (g##type) ((src->accumulator - G_PI) * -amp); \
} else { \
for (c = 0; c < src->channels; ++c) \
samples[i++] = (g##type) ((M_PI_M2 - src->accumulator) * -amp); \
gdouble c = cos (2.0 * anim_state.a);
anim_state.a += anim_state.p;
- if (anim_state.a > (M_PI + M_PI))
- anim_state.a -= (M_PI + M_PI);
+ if (anim_state.a > (G_PI + G_PI))
+ anim_state.a -= (G_PI + G_PI);
r->w = anim_state.w / 2;
r->x = (r->w - (r->w / 2)) + c * (r->w / 2);
anim_state.w = 320;
anim_state.h = 240;
anim_state.a = 0.0;
- anim_state.p = (M_PI + M_PI) / 200.0;
+ anim_state.p = (G_PI + G_PI) / 200.0;
handle_resize_cb (video_window, NULL, sink);
g_signal_connect (video_window, "configure-event",