static BOOL initialise(void) { int param; int result; WavegenInit(22050,0); // 22050 if((result = LoadPhData()) != 1) { if(result == -1) { dbg(0, "Failed to load espeak-data\n"); return FALSE; } else dbg(0, "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 TRUE; }
static int initialise(int control) {//=============================== int param; int result; int srate = 22050; // default sample rate 22050 Hz err = EE_OK; LoadConfig(); if((result = LoadPhData(&srate)) != 1) // reads sample rate from espeak-data/phontab { if(result == -1) { fprintf(stderr,"Failed to load espeak-data\n"); if((control & espeakINITIALIZE_DONT_EXIT) == 0) { exit(1); } } else fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); } WavegenInit(srate,0); memset(¤t_voice_selected,0,sizeof(current_voice_selected)); SetVoiceStack(NULL, ""); SynthesizeInit(); InitNamedata(); for(param=0; param<N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = param_defaults[param]; return(0); }
static int initialise(void) {//======================== int param; int result; LoadConfig(); // By Onyx, change the default sample rate to 44100 WavegenInit(44100,0); // 44100 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); } memset(&voice_selected,0,sizeof(voice_selected)); SetVoiceStack(NULL); SynthesizeInit(); InitNamedata(); for(param=0; param<N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = param_defaults[param]; return(0); }
static int initialise(int control) {//=============================== int param; int result; LoadConfig(); WavegenInit(22050,0); // 22050 if((result = LoadPhData()) != 1) { if(result == -1) { fprintf(stderr,"Failed to load espeak-data\n"); if((control & espeakINITIALIZE_DONT_EXIT) == 0) { exit(1); } } else fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); } memset(&voice_selected,0,sizeof(voice_selected)); SetVoiceStack(NULL); SynthesizeInit(); InitNamedata(); for(param=0; param<N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = param_defaults[param]; return(0); }
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); }
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style): wxFrame(parent, id, title, pos, size, style) {//=================================================================================================================== // Main Frame constructor int error_flag = 0; int result; int param; int srate; notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxSize(312,760)); // notebook->AddPage(voicedlg,_T("Voice"),FALSE); formantdlg = new FormantDlg(notebook); notebook->AddPage(formantdlg,_T(" Spect"),FALSE); voicedlg = new VoiceDlg(notebook); transldlg = new TranslDlg(notebook); notebook->AddPage(transldlg,_T("Text"),TRUE); screenpages = new wxNotebook(this, ID_SCREENPAGES, wxDefaultPosition, wxSize(554,702)); wxBoxSizer *framesizer = new wxBoxSizer( wxHORIZONTAL ); framesizer->Add( notebook, 0, // make horizontally stretchable wxEXPAND | // make vertically stretchable wxALL, // and make border all around 4 ); // set border width framesizer->Add( screenpages, 1, // make horizontally stretchable wxEXPAND | // make vertically stretchable wxALL, // and make border all around 4 ); // set border width SetSizer( framesizer ); // use the sizer for layout framesizer->SetSizeHints( this ); // set size hints to honour minimum size SetSize(pos.x, pos.y, size.GetWidth(), size.GetHeight()); LoadConfig(); if((result = LoadPhData(&srate)) != 1) { if(result == -1) wxLogError(_T("Failed to read espeak-data/phontab,phondata,phonindex\nPath = ")+wxString(path_home,wxConvLocal)+_T("\n\nThe 'eSpeak' package needs to be installed")); else wxLogError(_T("Wrong version of espeak-data at:\n")+ wxString(path_home,wxConvLocal)+_T("\nVersion 0x%x (expects 0x%x)"),result,version_phdata); error_flag = 1; srate = 22050; } WavegenInit(srate,0); WavegenInitSound(); f_trans = stdout; option_ssml = 1; option_phoneme_input = 1; // if(LoadVoice(voice_name,0) == NULL) if(SetVoiceByName(voice_name2) != EE_OK) { if(error_flag==0) wxLogError(_T("Failed to load voice data")); strcpy(dictionary_name,"en"); } WavegenSetVoice(voice); for(param=0; param<N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = param_defaults[param]; SetParameter(espeakRATE,option_speed,0); SetSpeed(3); SynthesizeInit(); InitSpectrumDisplay(); InitProsodyDisplay(); // InitWaveDisplay(); espeak_ListVoices(NULL); m_timer.SetOwner(this,1); m_timer.Start(500); /* 0.5 timer */ } // end of MyFrame::MyFrame
// Initialise this in OnInit, not statically bool MyApp::OnInit(void) {//===================== int j; wxChar *p; char param[80]; if(argc > 1) { p = argv[1]; j = 0; while((param[j] = p[j]) != 0) j++; if((strcmp(param,"--help")==0) || (strcmp(param,"-h")==0)) { printf(about_string2,espeak_Info(NULL)); printf("%s", help_text); exit(0); } ConfigInit(); if(strcmp(param,"--compile")==0) { LoadPhData(NULL); samplerate_native = samplerate = 22050; CompilePhonemeData(); CompileIntonation(); } exit(0); } ConfigInit(); gui_flag = 1; // 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,"en_US.UTF-8") == NULL) { if(setlocale(LC_CTYPE,"UTF-8") == NULL) setlocale(LC_CTYPE,""); } if((frame_w == 0) || (frame_h == 0)) { frame_w = 800; frame_h = 768; } // Create the main frame window myframe = new MyFrame(NULL, -1, AppName, wxPoint(frame_x, frame_y), wxSize(frame_w, frame_h), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE | wxHSCROLL | wxVSCROLL); // Make a menubar myframe->SetMenuBar(MakeMenu(0, voice_name2)); myframe->CreateStatusBar(); myframe->SetVoiceTitle(voice_name2); // myframe->Maximize(); myframe->Show(TRUE); SetTopWindow(myframe); wxInitAllImageHandlers(); // wxImage::AddHandler(wxPNGHandler); return TRUE; }