mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-04 14:33:31 +00:00
VoiceSettings.java: Support reading the espeak_volume preference.
This commit is contained in:
@@ -29,6 +29,7 @@ public class VoiceSettings {
|
||||
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 static final String PREF_VOLUME = "espeak_volume";
|
||||
|
||||
public VoiceSettings(SharedPreferences preferences, SpeechSynthesis engine) {
|
||||
mPreferences = preferences;
|
||||
@@ -85,6 +86,16 @@ public class VoiceSettings {
|
||||
return range;
|
||||
}
|
||||
|
||||
public int getVolume() {
|
||||
int min = mEngine.Volume.getMinValue();
|
||||
int max = mEngine.Volume.getMaxValue();
|
||||
|
||||
int range = getPreferenceValue(PREF_VOLUME, mEngine.Volume.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