Browse Source

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.
master
Reece H. Dunn 12 years ago
parent
commit
027217d5f7

+ 1
- 4
android/jni/jni/eSpeakService.cpp View File



JNIEXPORT jboolean JNIEXPORT jboolean
JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeSetVoiceByProperties( JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeSetVoiceByProperties(
JNIEnv *env, jobject object, jstring name, jstring languages, jint gender, jint age,
jint variant) {
JNIEnv *env, jobject object, jstring name, jstring languages, jint gender) {
const char *c_name = name ? env->GetStringUTFChars(name, NULL) : NULL; const char *c_name = name ? env->GetStringUTFChars(name, NULL) : NULL;
const char *c_languages = languages ? env->GetStringUTFChars(languages, NULL) : NULL; const char *c_languages = languages ? env->GetStringUTFChars(languages, NULL) : NULL;




voice_select.name = c_name; voice_select.name = c_name;
voice_select.languages = c_languages; voice_select.languages = c_languages;
voice_select.age = (int) age;
voice_select.gender = (int) gender; voice_select.gender = (int) gender;
voice_select.variant = (int) variant;


const espeak_ERROR result = espeak_SetVoiceByProperties(&voice_select); const espeak_ERROR result = espeak_SetVoiceByProperties(&voice_select);



+ 3
- 5
android/src/com/reecedunn/espeak/SpeechSynthesis.java View File

return voices; return voices;
} }


public void setVoiceByProperties(
String name, String languages, int gender, int age, int variant) {
nativeSetVoiceByProperties(name, languages, gender, age, variant);
public void setVoiceByProperties(String name, String languages, int gender) {
nativeSetVoiceByProperties(name, languages, gender);
} }


public void setRate(int rate) { public void setRate(int rate) {


private native final String[] nativeGetAvailableVoices(); private native final String[] nativeGetAvailableVoices();


private native final boolean nativeSetVoiceByProperties(
String name, String languages, int gender, int age, int variant);
private native final boolean nativeSetVoiceByProperties(String name, String languages, int gender);


private native final boolean nativeSetRate(int rate); private native final boolean nativeSetRate(int rate);



+ 1
- 1
android/src/com/reecedunn/espeak/TtsService.java View File

mCallback.start(mEngine.getSampleRate(), mEngine.getAudioFormat(), mCallback.start(mEngine.getSampleRate(), mEngine.getAudioFormat(),
mEngine.getChannelCount()); mEngine.getChannelCount());


mEngine.setVoiceByProperties(null, mMatchingVoice.name, gender, 0, 0);
mEngine.setVoiceByProperties(null, mMatchingVoice.name, gender);
mEngine.setRate(rate); mEngine.setRate(rate);
mEngine.setPitch(pitch); mEngine.setPitch(pitch);
mEngine.synthesize(text, text.startsWith("<speak")); mEngine.synthesize(text, text.startsWith("<speak"));

Loading…
Cancel
Save