SpeechSynthesis.java: expose the different voice options from eSpeak

This makes the following changes:

1.  setVoice takes a Voice object instead of a language string.

    This is to make the API cleaner and allows SpeechSynthesis
    to pass the correct parameter (identifier for SetVoiceByName,
    or name for SetVoiceByProperties) to espeak.

2.  The espeak_SetVoiceByName API is also exposed to support passing
    the voice variant to use.

3.  The age parameter has been re-added with the constants:
    *  SpeechSynthesis.AGE_ANY
    *  SpeechSynthesis.AGE_YOUNG
    *  SpeechSynthesis.AGE_OLD
    based on the behaviour of the eSpeak voice selection algorithm.

NOTE: Due to the way that voice selection is implemented in eSpeak,
if variant is specified, the age and gender cannot be specified and
vice versa.
This commit is contained in:
Reece H. Dunn
2013-05-02 18:06:41 +01:00
parent 88eab88d8a
commit cc72825682
3 changed files with 41 additions and 7 deletions
@@ -221,7 +221,7 @@ public class TtsService extends TextToSpeechService {
mCallback.start(mEngine.getSampleRate(), mEngine.getAudioFormat(),
mEngine.getChannelCount());
mEngine.setVoice(mMatchingVoice.name, gender);
mEngine.setVoice(mMatchingVoice, null, gender, SpeechSynthesis.AGE_ANY);
mEngine.setRate(rate);
mEngine.setPitch(pitch);
mEngine.synthesize(text, text.startsWith("<speak"));