diff --git a/android/eSpeakTests/src/com/reecedunn/espeak/test/VoiceSettingsTest.java b/android/eSpeakTests/src/com/reecedunn/espeak/test/VoiceSettingsTest.java
index e8dd352d..312071b3 100644
--- a/android/eSpeakTests/src/com/reecedunn/espeak/test/VoiceSettingsTest.java
+++ b/android/eSpeakTests/src/com/reecedunn/espeak/test/VoiceSettingsTest.java
@@ -56,6 +56,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
// Old Settings
@@ -75,6 +76,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testDefaultGenderFemale()
@@ -92,6 +94,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void defaultRateTest(int prefValue, int settingValue, SpeechSynthesis synth)
@@ -108,6 +111,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testDefaultRate()
@@ -134,6 +138,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(settingValue));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testDefaultPitch()
@@ -164,6 +169,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void espeakRateTest(int prefValue, int settingValue, SpeechSynthesis synth)
@@ -180,6 +186,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testEspeakRate()
@@ -207,6 +214,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(settingValue));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testEspeakPitch()
@@ -233,6 +241,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(settingValue));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testEspeakPitchRange()
@@ -259,6 +268,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(settingValue));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testEspeakVolume()
@@ -271,6 +281,33 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
espeakVolumeTest( -5, 0, synth); // clamped to minimum value
}
+ public void espeakPunctuationLevelTest(int prefValue, int settingValue, SpeechSynthesis synth)
+ {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.clear();
+ editor.putString("espeak_punctuation_level", Integer.toString(prefValue));
+ editor.commit();
+
+ VoiceSettings settings = new VoiceSettings(prefs, synth);
+ assertThat(settings.getVoiceVariant().toString(), is("male"));
+ assertThat(settings.getRate(), is(synth.Rate.getDefaultValue()));
+ assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
+ assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
+ assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(settingValue));
+ }
+
+ public void testEspeakPunctuationLevel()
+ {
+ SpeechSynthesis synth = new SpeechSynthesis(getContext(), mCallback);
+ espeakPunctuationLevelTest( 3, SpeechSynthesis.PUNCT_SOME, synth); // clamped to maximum value
+ espeakPunctuationLevelTest( 2, SpeechSynthesis.PUNCT_SOME, synth);
+ espeakPunctuationLevelTest( 1, SpeechSynthesis.PUNCT_ALL, synth);
+ espeakPunctuationLevelTest( 0, SpeechSynthesis.PUNCT_NONE, synth);
+ espeakPunctuationLevelTest(-1, SpeechSynthesis.PUNCT_NONE, synth); // clamped to minimum value
+ }
+
// Mixed (Old and New) Settings
public void testEspeakVariantWithDefaultGenderFemale()
@@ -289,6 +326,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testEspeakRateWithDefaultRate()
@@ -307,6 +345,7 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(synth.Pitch.getDefaultValue()));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
public void testEspeakPitchWithDefaultPitch()
@@ -325,5 +364,6 @@ public class VoiceSettingsTest extends TextToSpeechTestCase
assertThat(settings.getPitch(), is(75));
assertThat(settings.getPitchRange(), is(synth.PitchRange.getDefaultValue()));
assertThat(settings.getVolume(), is(synth.Volume.getDefaultValue()));
+ assertThat(settings.getPunctuationLevel(), is(SpeechSynthesis.PUNCT_NONE));
}
}
diff --git a/android/res/values/donottranslate.xml b/android/res/values/donottranslate.xml
index bfe736aa..b7e17cdf 100644
--- a/android/res/values/donottranslate.xml
+++ b/android/res/values/donottranslate.xml
@@ -5,7 +5,7 @@
Description: The name of the application.
-->
eSpeak
-
+
- male
- m1
@@ -34,4 +34,10 @@
- female-old
+
+ - 0
+ - 1
+ - 2
+
+
\ No newline at end of file
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index 0b7bd9ae..2c806d43 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -111,4 +111,14 @@
Set to default
Pitch variation
Voice variant
+ Punctuation level
+
+
+ - None
+ - All
+ - Some
+
diff --git a/android/res/xml/preferences.xml b/android/res/xml/preferences.xml
index fe20d547..7e9a2f6a 100644
--- a/android/res/xml/preferences.xml
+++ b/android/res/xml/preferences.xml
@@ -9,4 +9,12 @@
android:summary="%s"
android:title="@string/espeak_variant" />
+
+
\ No newline at end of file
diff --git a/android/src/com/reecedunn/espeak/TtsService.java b/android/src/com/reecedunn/espeak/TtsService.java
index 10762a40..260267dd 100644
--- a/android/src/com/reecedunn/espeak/TtsService.java
+++ b/android/src/com/reecedunn/espeak/TtsService.java
@@ -240,6 +240,7 @@ public class TtsService extends TextToSpeechService {
mEngine.Pitch.setValue(settings.getPitch(), request.getPitch());
mEngine.PitchRange.setValue(settings.getPitchRange());
mEngine.Volume.setValue(settings.getVolume());
+ mEngine.Punctuation.setValue(settings.getPunctuationLevel());
mEngine.synthesize(text, text.startsWith(" max) level = max;
+ if (level < min) level = min;
+ return level;
+ }
+
private int getPreferenceValue(String preference, int defaultValue) {
String prefString = mPreferences.getString(preference, null);
if (prefString == null) {