The low impact fix for #2865

This commit is contained in:
sonora 2016-07-28 21:45:04 +02:00
parent a4c7a68825
commit a93afeaac5

View file

@ -468,8 +468,19 @@ public class VoiceRouter {
} else {
playMakeTurn(currentSegment, next, null);
}
if (nextNextInfo.distanceTo < TURN_IN_DISTANCE_END && isTargetPoint(nextNextInfo)) {
if (!next.getTurnType().goAhead()) { // Avoids isolated "and arrive.." prompt
if (!next.getTurnType().goAhead() && isTargetPoint(nextNextInfo)) { // !goAhead() avoids isolated "and arrive.." prompt, as goAhead() is not pronounced
if (nextNextInfo.distanceTo < TURN_IN_DISTANCE_END) {
// Issue #2865: Ensure a distance associated with the destination arrival is always announced, either here, or in subsequent "Turn in" prompt
// Distance fon non-straights already announced in "Turn (now)"'s nextnext code above
if ((nextNextInfo != null) && (nextNextInfo.directionInfo != null) && nextNextInfo.directionInfo.getTurnType().goAhead()) {
playThen();
playGoAhead(nextNextInfo.distanceTo, empty);
}
playAndArriveAtDestination(nextNextInfo);
} else if (nextNextInfo.distanceTo < 1.2f * TURN_IN_DISTANCE_END) {
// 1.2 is safety margin should the subsequent "Turn in" prompt not fit in amy more
playThen();
playGoAhead(nextNextInfo.distanceTo, empty);
playAndArriveAtDestination(nextNextInfo);
}
}
@ -538,6 +549,14 @@ public class VoiceRouter {
return false;
}
private void playThen() {
CommandBuilder play = getNewCommandPlayerToPlay();
if (play != null) {
notifyOnVoiceMessage();
play.then().play();
}
}
private void playGoAhead(int dist, Term streetName) {
CommandBuilder play = getNewCommandPlayerToPlay();
if (play != null) {