mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-24 12:28:10 +00:00
Make the rate setting use the new SeekBar/Parameter UI.
This commit is contained in:
@@ -198,9 +198,14 @@ public class TtsService extends TextToSpeechService {
|
||||
|
||||
final int gender = getPreferenceValue("default_gender", 0);
|
||||
final int rate = (getPreferenceValue("default_rate", 100) / 100) * mEngine.Rate.getDefaultValue();
|
||||
final int pitch = getPreferenceValue("default_pitch", 100) / 2;
|
||||
final Bundle params = request.getParams();
|
||||
|
||||
int pitch = getPreferenceValue("espeak_pitch", Integer.MIN_VALUE);
|
||||
if (pitch == Integer.MIN_VALUE) {
|
||||
// Try the old eyes-free setting:
|
||||
pitch = getPreferenceValue("default_pitch", 100) / 2;
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "Received synthesis request: {language=\"" + mMatchingVoice.name + "\"}");
|
||||
|
||||
|
||||
@@ -122,8 +122,26 @@ public class TtsSettingsActivity extends PreferenceActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
// Migrate old eyes-free settings to the new settings:
|
||||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
String pitch = prefs.getString("espeak_pitch", null);
|
||||
if (pitch == null) {
|
||||
// Try the old eyes-free setting:
|
||||
pitch = prefs.getString("default_pitch", "100");
|
||||
int pitchValue = Integer.parseInt(pitch) / 2;
|
||||
editor.putString("espeak_pitch", Integer.toString(pitchValue));
|
||||
}
|
||||
|
||||
editor.commit();
|
||||
|
||||
// Bind eSpeak parameters to preference settings:
|
||||
|
||||
SpeechSynthesis engine = new SpeechSynthesis(context, null);
|
||||
|
||||
group.addPreference(createPreference(context, engine.Pitch, "espeak_pitch", R.string.setting_default_pitch));
|
||||
group.addPreference(createPreference(context, engine.Volume, "espeak_volume", R.string.espeak_volume));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user