From 3e7e5be2b78bdc1dbaa400d3b8e35ac66eab3cbd Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sun, 17 Aug 2008 00:49:46 -0500 Subject: [PATCH] fixed bug with volume setting Now the volume setting should be announced again. --- synth.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/synth.c b/synth.c index 1a83405..b43cd07 100644 --- a/synth.c +++ b/synth.c @@ -31,7 +31,7 @@ int SynthCallback(short *wav, int numsamples, espeak_EVENT *events) return 0; } -espeak_ERROR set_frequency (struct synth_t *s, int freq, enum adjust_t adj) +espeak_ERROR set_frequency(struct synth_t *s, int freq, enum adjust_t adj) { espeak_ERROR rc; @@ -45,7 +45,7 @@ espeak_ERROR set_frequency (struct synth_t *s, int freq, enum adjust_t adj) return rc; } -espeak_ERROR set_pitch (struct synth_t *s, int pitch, enum adjust_t adj) +espeak_ERROR set_pitch(struct synth_t *s, int pitch, enum adjust_t adj) { espeak_ERROR rc; @@ -59,7 +59,7 @@ espeak_ERROR set_pitch (struct synth_t *s, int pitch, enum adjust_t adj) return rc; } -espeak_ERROR set_rate (struct synth_t *s, int rate, enum adjust_t adj) +espeak_ERROR set_rate(struct synth_t *s, int rate, enum adjust_t adj) { espeak_ERROR rc; @@ -78,14 +78,19 @@ espeak_ERROR set_voice(struct synth_t *s) return (espeak_SetVoiceByName(s->voice)); } -espeak_ERROR set_volume (struct synth_t *s, int vol, enum adjust_t adj) +espeak_ERROR set_volume(struct synth_t *s, int vol, enum adjust_t adj) { espeak_ERROR rc; - + if (adj == ADJ_DEC) + vol = -vol; + if (adj != ADJ_SET) + vol += s->volume; rc = espeak_SetParameter(espeakVOLUME, (vol+1) * volumeMultiplier, 0); if (rc == EE_OK) s->volume = vol; + + return rc; } espeak_ERROR stop_speech(void)