| if (rate == null) { | if (rate == null) { | ||||
| // Try the old eyes-free setting: | // Try the old eyes-free setting: | ||||
| SpeechSynthesis engine = new SpeechSynthesis(this, null); | SpeechSynthesis engine = new SpeechSynthesis(this, null); | ||||
| int defaultValue = engine.Rate.getDefaultValue(); | |||||
| int maxValue = engine.Rate.getMaxValue(); | |||||
| rate = prefs.getString("default_rate", "100"); | rate = prefs.getString("default_rate", "100"); | ||||
| int rateValue = (Integer.parseInt(rate) / 100) * engine.Rate.getDefaultValue(); | |||||
| int rateValue = (Integer.parseInt(rate) / 100) * defaultValue; | |||||
| if (rateValue < defaultValue) rateValue = defaultValue; | |||||
| if (rateValue > maxValue) rateValue = maxValue; | |||||
| editor.putString("espeak_rate", Integer.toString(rateValue)); | editor.putString("espeak_rate", Integer.toString(rateValue)); | ||||
| } | } | ||||