static void select_output(espeak_AUDIO_OUTPUT output_type) {//======================================================= my_mode = output_type; my_audio = NULL; synchronous_mode = 1; option_waveout = 1; // inhibit portaudio callback from wavegen.cpp out_samplerate = 0; switch(my_mode) { case AUDIO_OUTPUT_PLAYBACK: // wave_init() is now called just before the first wave_write() synchronous_mode = 0; break; case AUDIO_OUTPUT_RETRIEVAL: synchronous_mode = 0; break; case AUDIO_OUTPUT_SYNCHRONOUS: break; case AUDIO_OUTPUT_SYNCH_PLAYBACK: option_waveout = 0; WavegenInitSound(); break; } } // end of select_output
static void select_output(espeak_AUDIO_OUTPUT output_type) {//======================================================= my_mode = output_type; my_audio = NULL; synchronous_mode = 1; option_waveout = 1; // inhibit portaudio callback from wavegen.cpp switch(my_mode) { case AUDIO_OUTPUT_PLAYBACK: synchronous_mode = 0; #ifdef USE_ASYNC wave_init(); wave_set_callback_is_output_enabled( fifo_is_command_enabled); my_audio = wave_open("alsa"); event_init(); #endif break; case AUDIO_OUTPUT_RETRIEVAL: synchronous_mode = 0; break; case AUDIO_OUTPUT_SYNCHRONOUS: break; case AUDIO_OUTPUT_SYNCH_PLAYBACK: option_waveout = 0; WavegenInitSound(); break; } } // end of select_output
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