コード例 #1
0
ファイル: espeakedit.cpp プロジェクト: ashengmz/espeak
void MyFrame::OnTools(wxCommandEvent& event)
{//=========================================
	int err;
	FILE *log;
	int debug_flag=0;
	char fname_log[sizeof(path_dsource)+12];
	char err_fname[sizeof(path_home)+15];

	switch(event.GetId())
	{
	case MENU_TEST:
		TestTest(0);
		break;

	case MENU_TEST2:
		TestTest(2);
		break;

	case MENU_TO_UTF8:
		ConvertToUtf8();
		break;

	case MENU_COUNT_WORDS:
		MakeWordFreqList();
		break;

	case MENU_LEXICON_RU:
	case MENU_LEXICON_BG:
	case MENU_LEXICON_DE:
	case MENU_LEXICON_IT:
	case MENU_LEXICON_TEST:
		CompareLexicon(event.GetId());  // Compare a lexicon with _rules translation
		break;

	case MENU_COMPILE_PH:
		CompilePhonemeData();
		SetVoiceTitle(voice_name2);
		break;

	case MENU_COMPILE_PH2:
		CompileSampleRate();
		SetVoiceTitle(voice_name2);
		break;

	case MENU_COMPILE_MBROLA:
		CompileMbrola();
		break;

	case MENU_COMPILE_INTONATION:
		CompileIntonation();
		break;

	case MENU_COMPILE_DICT_DEBUG:
		debug_flag =1;  // and drop through to next case
	case MENU_COMPILE_DICT:
		sprintf(fname_log,"%s%s",path_dsource,"dict_log");
		log = fopen(fname_log,"w");

		LoadDictionary(translator, translator->dictionary_name, 0);
		if((err = CompileDictionary(path_dsource,translator->dictionary_name,log,err_fname,debug_flag)) < 0)
		{
			wxLogError(_T("Can't access file:\n")+wxString(err_fname,wxConvLocal));

			wxString dir = wxDirSelector(_T("Directory containing dictionary files"),path_dictsource);
			if(!dir.IsEmpty())
			{
				path_dictsource = dir;
				strncpy0(path_dsource,path_dictsource.mb_str(wxConvLocal),sizeof(path_dsource)-1);
				strcat(path_dsource,"/");
			}
			break;
		}
		wxLogStatus(_T("Compiled '")+wxString(dictionary_name,wxConvLocal)+_T("', %d errors"),err);

		if(log != NULL)
		{
			fclose(log);

			if(err > 0)
			{
				// display the error messages
				DisplayErrorFile(fname_log);
			}
		}
		break;

	case MENU_FORMAT_DICTIONARY:
		DictionaryFormat(dictionary_name);
		break;

	case MENU_SORT_DICTIONARY:
		DictionarySort(dictionary_name);
		break;

	case MENU_VOWELCHART1:
		MakeVowelLists();
		break;

	case MENU_VOWELCHART2:
		VowelChart(2,NULL);
		break;

	case MENU_VOWELCHART3:
		VowelChart(3,NULL);
		break;

	case MENU_LOAD_WAV:
//		LoadWavFile();
		break;
	}
}
コード例 #2
0
ファイル: speak_lib.cpp プロジェクト: alltoy/espeak
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags)
{//=============================================================================
	ENTER("espeak_CompileDictionary");
	CompileDictionary(path, dictionary_name, log, NULL, flags);
}   //  end of espeak_CompileDirectory