mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-08 07:32:32 +00:00
VoiceSettings.java: Support reading the espeak_pitch_range preference.
This commit is contained in:
@@ -28,6 +28,7 @@ public class VoiceSettings {
|
||||
public static final String PREF_RATE = "espeak_rate";
|
||||
public static final String PREF_DEFAULT_PITCH = "default_pitch";
|
||||
public static final String PREF_PITCH = "espeak_pitch";
|
||||
public static final String PREF_PITCH_RANGE = "espeak_pitch_range";
|
||||
|
||||
public VoiceSettings(SharedPreferences preferences, SpeechSynthesis engine) {
|
||||
mPreferences = preferences;
|
||||
@@ -74,6 +75,16 @@ public class VoiceSettings {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public int getPitchRange() {
|
||||
int min = mEngine.PitchRange.getMinValue();
|
||||
int max = mEngine.PitchRange.getMaxValue();
|
||||
|
||||
int range = getPreferenceValue(PREF_PITCH_RANGE, mEngine.PitchRange.getDefaultValue());
|
||||
if (range > max) range = max;
|
||||
if (range < min) range = min;
|
||||
return range;
|
||||
}
|
||||
|
||||
private int getPreferenceValue(String preference, int defaultValue) {
|
||||
String prefString = mPreferences.getString(preference, null);
|
||||
if (prefString == null) {
|
||||
|
||||
Reference in New Issue
Block a user