diff options
Diffstat (limited to 'src/com/darkprograms/speech/synthesiser/Synthesiser.java')
-rw-r--r-- | src/com/darkprograms/speech/synthesiser/Synthesiser.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/darkprograms/speech/synthesiser/Synthesiser.java b/src/com/darkprograms/speech/synthesiser/Synthesiser.java index 3169a2a..2821601 100644 --- a/src/com/darkprograms/speech/synthesiser/Synthesiser.java +++ b/src/com/darkprograms/speech/synthesiser/Synthesiser.java @@ -83,12 +83,6 @@ public class Synthesiser { */ public InputStream getMP3Data(String synthText) throws Exception { - if(synthText.length()>100){ - List<String> fragments = parseString(synthText);//parses String if too long - return getMP3Data(fragments); - } - - String languageCode = this.languageCode;//Ensures retention of language settings if set to auto if(languageCode == null || languageCode.equals("") || languageCode.equalsIgnoreCase("auto")){ @@ -103,6 +97,16 @@ public class Synthesiser { languageCode = "en-us";//Reverts to Default Language if it can't detect it. } } + + if(synthText.length()>100){ + List<String> fragments = parseString(synthText);//parses String if too long + String tmp = getLanguage(); + setLanguage(languageCode);//Keeps it from autodetecting each fragment. + InputStream out = getMP3Data(fragments); + setLanguage(tmp);//Reverts it to it's previous Language such as auto. + return out; + } + String encoded = URLEncoder.encode(synthText, "UTF-8"); //Encode |