Dear developers,
I have trouble writing a simple client. Could anyone help me? Here is the source code:
#include <libspeechd.h>
int main() {
char *error;
SPDConnection *conn = spd_open2("IBusSpeech", "main",
NULL, SPD_MODE_THREADED, NULL, 1, &error);
if (conn == NULL) {
fprintf(stderr, "Failed to connect to Speech Dispatcher:\n%s\n", error);
return 1;
}
spd_say(conn, SPD_TEXT, "spd say success");
return 0;
}
Here is the build command is run output:
$ gcc -I/usr/include/speech-dispatcher -lspeechd -o test_speechd.o -c test_speechd.c
$ libtool --mode=link gcc -lspeechd test_speechd.o -o test_speechd
$ ./test_speechd
(process:76943): GLib-DEBUG: 16:41:21.054: posix_spawn avoided (fd close requested)
Failed to connect to Speech Dispatcher:
Error: Can't connect to unix socket /run/user/1000/speech-dispatcher/speechd.sock: Connection refused. Autospawn: Autospawn failed. Speech Dispatcher refused to start with error code, stating this as a reason:
$ speech-dispatcher -v
speech-dispatcher 0.10.0-rc2
Some years before, I have written a client (for speechd version 0.7.1). I remember that speech-dispatcher need to launch a server process before I run the client. But I find that spd-say now seems spawn speech-dispatcher server process automatically. My client seems fail to spawn the server process. Does anyone know what the problem is?
Thanks in advanced!
Cameron Wong