mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-02 22:07:12 +00:00
Fix TextToSpeech,setLanguage on Android 5.0.
As of Android 5.0, TextToSpeech.setLanguage calls the new TextToSpeechService.onGetDefaultVoiceNameFor(lang,country,variant) and uses the specified voice name. The default Android 5.0 implementation of onGetDefaultVoiceNameFor does not work with eSpeak. This provides a working implementation. This fixes the TextToSpeechTest.testLanguages tests on Android 5.0.
This commit is contained in:
@@ -201,7 +201,13 @@ public class TtsService extends TextToSpeechService {
|
||||
|
||||
@Override
|
||||
public String onGetDefaultVoiceNameFor(String language, String country, String variant) {
|
||||
return super.onGetDefaultVoiceNameFor(language, country, variant);
|
||||
final int result = onLoadLanguage(language, country, variant);
|
||||
switch (result) {
|
||||
case TextToSpeech.LANG_MISSING_DATA:
|
||||
case TextToSpeech.LANG_NOT_SUPPORTED:
|
||||
return null;
|
||||
}
|
||||
return mMatchingVoice.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user