code cleanup: new file langopts.c for handling language options.
The switch case in LoadVoice() currently mixes voice and language
options. This change will start separating them into two functions.
CheckTranslator will be moved to langopts.c. In the future there should
be no need to use it in voices.c. There will be other temporary
solutions also.
code cleanup: start moving translateWord3() to a new source file.
The file will be organized to have one callable function only. This
should make code structure simpler.
Existing code will be changed to use function parameters instead of
global variables.
Possible problems include too much dependencies with numbers.c.
Soundicons are used for external audio with SSML <audio> tag and for
replacing punctuation names with sound files in LoadConfig().
Currently there's a bug wih soundicon slots: if both LoadConfig and
<audio> are used, the punctuation reserves all slots and no sound from
<audio> is played.
The ART runtime is stricter about calling env->DeleteWeakGlobalRef
on an object/value that was not returned from env->NewWeakGlobalRef.
In that case, it triggers an abort which causes the application to
crash and display an "Application has stopped" dialog message.
The Android 4.x+ code has changed a lot since the initial import
of the eyes-free codebase. A lot of bug fixes and improvements
have been made to it.
The eyes-free codebase had two different code paths:
* one for ICS (4.0) or later, using the Java-based TTS APIs
provided by the Android platform;
* one for pre-ICS using an internal C++-based TTS API.
Thus, any bug fixes or improvements would have to be done to both
code bases if Android 2.x/3.x support is required. This is not
maintainable.
If pre-ICS support is to be re-added in the future, the plan will
be to:
* forward the C++-based APIs to the Java-based APIs via a
compatibility layer;
* use a compatibility layer (Android Support Library?) for using
the ICS settings API on pre-ICS.
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.
SpeechSynthesis.java: further simplify the setVoice method.
This renames `setVoiceByProperties` to the more consise `setVoice`
and removes the name parameter as this is not used -- the voice is
set by the language and gender parameters only.
SpeechSynthesis.java: Simplify the SetVoiceByProperties parameters.
The `age` parameter is not useful as eSpeak does not use this when
selecting voices. This is always set to `0` by TtsService.java.
The `variant` parameter is not used to select the actual voice
variant (from the `!v` directory) but to select the n^th matching
voice from the list of matching voices. This is always set to
select the first matching voice by TtsService.java.