mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-24 20:31:15 +00:00
Make the rate setting use the new SeekBar/Parameter UI.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="tts_settings_label" msgid="2696301846672491410">"eSpeak TTS Settings"</string>
|
||||
<string name="setting_default_pitch" msgid="2063082697363767286">"Default pitch"</string>
|
||||
<string name="setting_default_pitch" msgid="2063082697363767286">"Pitch"</string>
|
||||
<string name="setting_default_gender" msgid="8721577045178419807">"Voice gender"</string>
|
||||
<string name="setting_default_rate" msgid="3255750767876184606">"Speech rate multiplier"</string>
|
||||
<string name="installing_voice_data" msgid="1199950160686799120">"Installing voice data…"</string>
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="default_pitch_values">
|
||||
<item>50</item>
|
||||
<item>75</item>
|
||||
<item>100</item>
|
||||
<item>150</item>
|
||||
<item>200</item>
|
||||
</string-array>
|
||||
<string-array name="default_rate_values">
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
Source: Preference title.
|
||||
Description: Title for the preference that controls default voice pitch.
|
||||
-->
|
||||
<string name="setting_default_pitch">Default pitch</string>
|
||||
<string name="setting_default_pitch">Pitch</string>
|
||||
<!--
|
||||
Source: Preference title.
|
||||
Description: Title for the preference that controls default voice gender.
|
||||
@@ -100,13 +100,6 @@
|
||||
Source: Pitch preference labels.
|
||||
Description: Labels for possible pitch values.
|
||||
-->
|
||||
<string-array name="default_pitch_entries">
|
||||
<item>Very low</item>
|
||||
<item>Low</item>
|
||||
<item>Normal</item>
|
||||
<item>High</item>
|
||||
<item>Very high</item>
|
||||
</string-array>
|
||||
<!--
|
||||
Source: Gender preference labels.
|
||||
Description: Labels for possible gender values.
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="100"
|
||||
android:entries="@array/default_pitch_entries"
|
||||
android:entryValues="@array/default_pitch_values"
|
||||
android:key="default_pitch"
|
||||
android:summary="%s"
|
||||
android:title="@string/setting_default_pitch" />
|
||||
<ListPreference
|
||||
android:defaultValue="100"
|
||||
android:entries="@array/default_rate_entries"
|
||||
|
||||
@@ -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