diff --git a/espeakup.c b/espeakup.c
index eef672c..7a6bba4 100644
--- a/espeakup.c
+++ b/espeakup.c
@@ -86,7 +86,9 @@ void espeakup_sighandler(int sig)
int main(int argc, char **argv)
{
- struct synth_t s;
+ struct synth_t s = {
+ .voice = "",
+ };
/* process command line options */
process_cli(argc, argv);
diff --git a/espeakup.h b/espeakup.h
index 0518ed0..16556f5 100644
--- a/espeakup.h
+++ b/espeakup.h
@@ -46,7 +46,7 @@ struct synth_t {
int frequency;
int pitch;
int rate;
- char *voice;
+ char voice[10];
int volume;
char *buf;
int len;
@@ -68,7 +68,7 @@ extern espeak_ERROR set_pitch(struct synth_t *s, int pitch,
enum adjust_t adj);
extern espeak_ERROR set_rate(struct synth_t *s, int rate,
enum adjust_t adj);
-extern espeak_ERROR set_voice(struct synth_t *s);
+extern espeak_ERROR set_voice(struct synth_t *s, char *voice);
extern espeak_ERROR set_volume(struct synth_t *s, int vol,
enum adjust_t adj);
extern espeak_ERROR stop_speech(void);
diff --git a/synth.c b/synth.c
index c84ba8a..6c89cca 100644
--- a/synth.c
+++ b/synth.c
@@ -17,6 +17,8 @@
* along with this program. If not, see .
*/
+#include
+
#include "espeakup.h"
/* multipliers and offsets */
@@ -74,9 +76,14 @@ espeak_ERROR set_rate(struct synth_t * s, int rate, enum adjust_t adj)
return rc;
}
-espeak_ERROR set_voice(struct synth_t * s)
+espeak_ERROR set_voice(struct synth_t * s, char *voice)
{
- return (espeak_SetVoiceByName(s->voice));
+ espeak_ERROR rc;
+
+ rc = espeak_SetVoiceByName(voice);
+ if (rc == EE_OK)
+ strcpy(s->voice, voice);
+ return rc;
}
espeak_ERROR set_volume(struct synth_t * s, int vol, enum adjust_t adj)