starting work toward supporting changing voices

This commit adds a set_voice() function which will ultimately allow the
user to switch voices.
This commit is contained in:
William Hubbs 2008-09-27 10:52:24 -05:00
commit 527fb136de
3 changed files with 14 additions and 5 deletions

View file

@ -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);

View file

@ -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);

11
synth.c
View file

@ -17,6 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#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)