espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector) {//============================================================ const char *voice_id; int voice_found; voice_id = SelectVoice(voice_selector, &voice_found); if(voice_found == 0) return(EE_NOT_FOUND); LoadVoiceVariant(voice_id,0); DoVoiceChange(voice); SetVoiceStack(voice_selector, ""); return(EE_OK); } // end of SetVoiceByProperties
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Initialize(espeak_ng_ERROR_CONTEXT *context) { int param; int srate = 22050; // default sample rate 22050 Hz // It seems that the wctype functions don't work until the locale has been set // to something other than the default "C". Then, not only Latin1 but also the // other characters give the correct results with iswalpha() etc. if (setlocale(LC_CTYPE, "C.UTF-8") == NULL) { if (setlocale(LC_CTYPE, "UTF-8") == NULL) { if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) setlocale(LC_CTYPE, ""); } } espeak_ng_STATUS result = LoadPhData(&srate, context); if (result != ENS_OK) return result; WavegenInit(srate, 0); LoadConfig(); memset(¤t_voice_selected, 0, sizeof(current_voice_selected)); SetVoiceStack(NULL, ""); SynthesizeInit(); InitNamedata(); VoiceReset(0); for (param = 0; param < N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = saved_parameters[param] = param_defaults[param]; SetParameter(espeakRATE, espeakRATE_NORMAL, 0); SetParameter(espeakVOLUME, 100, 0); SetParameter(espeakCAPITALS, option_capitals, 0); SetParameter(espeakPUNCTUATION, option_punctuation, 0); SetParameter(espeakWORDGAP, 0, 0); #ifdef USE_ASYNC fifo_init(); #endif option_phonemes = 0; option_phoneme_events = 0; return ENS_OK; }
static int initialise(void) {//======================== int param; int result; // It seems that the wctype functions don't work until the locale has been set // to something other than the default "C". Then, not only Latin1 but also the // other characters give the correct results with iswalpha() etc. #ifdef PLATFORM_RISCOS setlocale(LC_CTYPE,"ISO8859-1"); #else #if 0 if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL) { if(setlocale(LC_CTYPE,"UTF-8") == NULL) setlocale(LC_CTYPE,""); } #endif #endif WavegenInit(22050,0); // 22050 if((result = LoadPhData()) != 1) { if(result == -1) { fprintf(stderr,"Failed to load espeak-data\n"); exit(1); } else fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); } LoadConfig(); SetVoiceStack(NULL); SynthesizeInit(); for(param=0; param<N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = param_defaults[param]; return(0); }