*
* @return the speaking rate, or -1 if unknown or an error occurred
*/
public boolean setSpeakingRate(float wordsPerMin) {
float oldSpeed = getSpeakingRate();
SynthesizerProperties properties =
synthesizer.getSynthesizerProperties();
try {
properties.setSpeakingRate(wordsPerMin);
return true;
} catch (PropertyVetoException pve) {
try {
properties.setSpeakingRate(oldSpeed);
} catch (PropertyVetoException pe) {
pe.printStackTrace();
}
return false;
}