return ucd_tolower(c); | return ucd_tolower(c); | ||||
} | } | ||||
static uint32_t espeak_rand_state = 0; | |||||
long espeak_rand(long min, long max) { | |||||
// Ref: https://github.com/bminor/glibc/blob/glibc-2.36/stdlib/random_r.c#L364 | |||||
espeak_rand_state = (((uint64_t)espeak_rand_state * 1103515245) + 12345) % 0x7fffffff; | |||||
long res = (long)espeak_rand_state; | |||||
return (res % (max-min+1))-min; | |||||
} | |||||
void espeak_srand(long seed) { | |||||
espeak_rand_state = (uint32_t)(seed); | |||||
(void)espeak_rand(0, 1); // Dummy flush a generator | |||||
} | |||||
extern ESPEAK_NG_API int GetFileLength(const char *filename); | extern ESPEAK_NG_API int GetFileLength(const char *filename); | ||||
extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); | extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); | ||||
void espeak_srand(long seed); | |||||
long espeak_rand(long min, long max); | |||||
int IsAlpha(unsigned int c); | int IsAlpha(unsigned int c); | ||||
int IsBracket(int c); | int IsBracket(int c); | ||||
int IsDigit(unsigned int c); | int IsDigit(unsigned int c); |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include "klatt.h" | #include "klatt.h" | ||||
#include "common.h" // for espeak_rand | |||||
#include "synthesize.h" // for frame_t, WGEN_DATA, STEPSIZE, N_KLATTP, echo... | #include "synthesize.h" // for frame_t, WGEN_DATA, STEPSIZE, N_KLATTP, echo... | ||||
#include "voice.h" // for voice_t, N_PEAKS | #include "voice.h" // for voice_t, N_PEAKS | ||||
#ifdef INCLUDE_SPEECHPLAYER | #ifdef INCLUDE_SPEECHPLAYER | ||||
static int nsamples; | static int nsamples; | ||||
static int sample_count; | static int sample_count; | ||||
#ifdef _MSC_VER | |||||
#define getrandom(min, max) ((rand()%(int)(((max)+1)-(min)))+(min)) | |||||
#else | |||||
#define getrandom(min, max) ((rand()%(long)(((max)+1)-(min)))+(min)) | |||||
#endif | |||||
#define getrandom(min, max) espeak_rand((min), (max)) | |||||
// function prototypes for functions private to this file | // function prototypes for functions private to this file | ||||
option_phonemes = 0; | option_phonemes = 0; | ||||
option_phoneme_events = 0; | option_phoneme_events = 0; | ||||
// Seed random generator | |||||
espeak_srand(time(NULL)); | |||||
return ENS_OK; | return ENS_OK; | ||||
} | } | ||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include "wavegen.h" | #include "wavegen.h" | ||||
#include "common.h" // for espeak_rand | |||||
#include "synthesize.h" // for WGEN_DATA, RESONATOR, frame_t | #include "synthesize.h" // for WGEN_DATA, RESONATOR, frame_t | ||||
#include "mbrola.h" // for MbrolaFill, MbrolaReset, mbrola... | #include "mbrola.h" // for MbrolaFill, MbrolaReset, mbrola... | ||||
int ix; | int ix; | ||||
// use two random numbers, for alternate formants | // use two random numbers, for alternate formants | ||||
noise = (rand() & 0x3fff) - 0x2000; | |||||
noise = espeak_rand(-0x2000, 0x1fff); | |||||
for (ix = 1; ix < N_PEAKS; ix++) { | for (ix = 1; ix < N_PEAKS; ix++) { | ||||
int amp; | int amp; |