Пример #1
0
bool stardict_tts_plugin_init(StarDictTtsPlugInObject *obj)
{
	flite_init();

	register_cmu_us_kal(NULL);
	register_cmu_time_awb(NULL);
	register_cmu_us_kal16(NULL);
	register_cmu_us_awb(NULL);
	register_cmu_us_rms(NULL);
	register_cmu_us_slt(NULL);

	std::string res = get_cfg_filename();
	if (!g_file_test(res.c_str(), G_FILE_TEST_EXISTS)) {
		g_file_set_contents(res.c_str(), "[flite]\nvoice=\n", -1, NULL);
	}
	GKeyFile *keyfile = g_key_file_new();
	g_key_file_load_from_file(keyfile, res.c_str(), G_KEY_FILE_NONE, NULL);
	gchar *str = g_key_file_get_string(keyfile, "flite", "voice", NULL);
	g_key_file_free(keyfile);
	if (str) {
		voice_engine = str;
		g_free(str);
	}
	if (!voice_engine.empty()) {
		now_voice = flite_voice_select(voice_engine.c_str());
	} else {
		now_voice = flite_voice_select(NULL);
	}
	obj->saytext_func = saytext;
	obj->tts_name = _("Flite TTS");
	g_print(_("Flite plug-in loaded.\n"));
	return false;
}
Пример #2
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{

    flite_init();

    cst_voice *v1 = register_cmu_us_rms(NULL);
    cst_voice *v2 = register_cmu_us_slt(NULL);
    for(int i = 0; i < 3; ++i)
    {
        flite_text_to_speech("Welcome to the testing facility", v1, "play");
        ::Beep( 1000, 800);

        flite_text_to_speech("Welcome to the testing facility", v2, "play");
        ::Beep( 1000, 800);
    }
}