Browse Source

Use M_PI instead of PI.

master
Reece H. Dunn 9 years ago
parent
commit
4b61d38551
3 changed files with 6 additions and 11 deletions
  1. 4
    4
      src/libespeak-ng/klatt.c
  2. 0
    3
      src/libespeak-ng/klatt.h
  3. 2
    4
      src/libespeak-ng/wavegen.c

+ 4
- 4
src/libespeak-ng/klatt.c View File



fla = (double)kt_globals.f0_flutter / 50; fla = (double)kt_globals.f0_flutter / 50;
flb = (double)kt_globals.original_f0 / 100; flb = (double)kt_globals.original_f0 / 100;
flc = sin(PI*12.7*time_count); // because we are calling flutter() more frequently, every 2.9mS flc = sin(M_PI*12.7*time_count); // because we are calling flutter() more frequently, every 2.9mS
fld = sin(PI*7.1*time_count); fld = sin(M_PI*7.1*time_count);
fle = sin(PI*4.7*time_count); fle = sin(M_PI*4.7*time_count);
delta_f0 = fla * flb * (flc + fld + fle) * 10; delta_f0 = fla * flb * (flc + fld + fle) * 10;
frame->F0hz10 = frame->F0hz10 + (long)delta_f0; frame->F0hz10 = frame->F0hz10 + (long)delta_f0;
time_count++; time_count++;
// Full reset // Full reset
kt_globals.FLPhz = (950 * kt_globals.samrate) / 10000; kt_globals.FLPhz = (950 * kt_globals.samrate) / 10000;
kt_globals.BLPhz = (630 * kt_globals.samrate) / 10000; kt_globals.BLPhz = (630 * kt_globals.samrate) / 10000;
kt_globals.minus_pi_t = -PI / kt_globals.samrate; kt_globals.minus_pi_t = -M_PI / kt_globals.samrate;
kt_globals.two_pi_t = -2.0 * kt_globals.minus_pi_t; kt_globals.two_pi_t = -2.0 * kt_globals.minus_pi_t;
setabc(kt_globals.FLPhz, kt_globals.BLPhz, &(kt_globals.rsn[RLP])); setabc(kt_globals.FLPhz, kt_globals.BLPhz, &(kt_globals.rsn[RLP]));
} }

+ 0
- 3
src/libespeak-ng/klatt.h View File

#define SAMPLED 3 #define SAMPLED 3
#define SAMPLED2 4 #define SAMPLED2 4


#define PI 3.1415927


/* typedef's that need to be exported */ /* typedef's that need to be exported */


typedef long flag; typedef long flag;

+ 2
- 4
src/libespeak-ng/wavegen.c View File



#include "sintab.h" #include "sintab.h"


#define PI 3.1415927
#define PI2 6.283185307
#define N_WAV_BUF 10 #define N_WAV_BUF 10


voice_t *wvoice; voice_t *wvoice;
// wavemult table has preset values for 22050 Hz, we only need to // wavemult table has preset values for 22050 Hz, we only need to
// recalculate them if we have a different sample rate // recalculate them if we have a different sample rate
for (ix = 0; ix < wavemult_max; ix++) { for (ix = 0; ix < wavemult_max; ix++) {
x = 127*(1.0 - cos(PI2*ix/wavemult_max)); x = 127*(1.0 - cos((M_PI*2)*ix/wavemult_max));
wavemult[ix] = (int)x; wavemult[ix] = (int)x;
} }
} }
{ {
int ix; int ix;


minus_pi_t = -PI / samplerate; minus_pi_t = -M_PI / samplerate;
two_pi_t = -2.0 * minus_pi_t; two_pi_t = -2.0 * minus_pi_t;


for (ix = 0; ix < N_PEAKS; ix++) for (ix = 0; ix < N_PEAKS; ix++)

Loading…
Cancel
Save