2 #include <libspeechd.h>
8 char *voices
[8] = {"male1","male2","male3","female1","female2","female3","child_male","child_female"};
11 void mycallback(size_t a
, size_t b
, SPDNotificationType state
) {
16 spd
= spd_open("bcllib",NULL
,NULL
,SPD_MODE_THREADED
);
17 spd
->callback_end
=spd
->callback_cancel
=mycallback
;
18 spd_set_notification_on(spd
,SPD_END
);
21 spd_set_voice_rate(spd
,myrate
);
22 spd_set_synthesis_voice(spd
,voices
[myvoice
]);
25 void terminateSpeech() {
29 void speak(char * text
, int flags
) {
31 if (flags
&SPEAK_INTERRUPTING
)
33 spd_say(spd
,SPD_MESSAGE
,text
);
34 if (flags
&SPEAK_BLOCKING
)
35 while (isSpeaking()) {
45 void setSpeechRate(int rate
) {
47 spd_set_voice_rate(spd
,myrate
);
50 int getSpeechVoice() {
54 void setSpeechVoice(int voice
) {
56 spd_set_synthesis_voice(spd
,voices
[myvoice
]);