|
原来下载了一个rpm包的reciteword,虽然是可以装上且能运行,但是发出的声音有爆音(原因是它使用了esd,而我没有使用esd吧),难听死了.也想过下载源代码自己编绎一下.但是因为它有在gtk2.4以上编绎出错的问题,一直没有成功.
今天受不了了,决定到网上找找.找到了解决编绎问题的方法之一,就是修改Makefile
将118行开始的INCLUDE改成这样:
[code:1]
INCLUDES = \
$(RECITEWORD_CFLAGS) \
-DRECITEWORD_DATA_DIR=\""$(datadir)/reciteword"\" \
-DRECITEWORD_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
[/code:1]
也就是把后面几行删了就行.
这样就可以编绎通过了.但是声音还是一样有问题呀.决定除去用esd播放的部分,换成alsa的
方法: 打开sndserv.cpp,将play_file函数改成这样
[code:1]
void play_file(const char *filename,PLAY_METHOD method)
{
if ((!g_pReciteWord->sndserv.canplay)||(g_pReciteWord->sndserv.disable))
return;
//esd_play_file ("reciteword", filename, 1); //it can't return quickly :( when in typing,press wrong key will cause freezing.
// the system() function is inefficiency, should change to use thread to call esd_play_file().
/*gchar command[256];
sprintf(command,"esdplay %s &",filename);
system(command);*/
switch (method)
{
case PM_MIX:
{
#ifdef G_OS_WIN32
PlaySound(filename, 0, SND_ASYNC | SND_FILENAME);
#else
//GThread * thread;
//gchar *dup_filename = g_strdup(filename); //as in the new thread, filename may have already be freeed.
//thread = g_thread_create(play_file_mix,(gpointer)dup_filename,false,NULL); //use GThreadPool may be more efficient.
gchar *command=g_strdup_printf("aplay %s &",filename);
system(command);
#endif
break;
}
case PM_STOP_PRE: // it is hard to done,may need write my own esd_play_file.
{
break;
}
case PM_AFTER_PRE: // use GThreadPool can do this,but,it does seems very useful before PM_STOP_PRE is done.
{
//GThreadPool *threadpool;
break;
}
}
}
[/code:1]
这样,播放声音就有aplay程序来放.重新编绎一下,安装.成功了
哈哈.这就是linux的优势.想改就改 |
|