diff --git a/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h b/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h index f4d6829f3..99f8ca12b 100644 --- a/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h +++ b/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h @@ -175,6 +175,7 @@ class OSMSCOUT_API VoiceInstructionAgent CLASS_FINAL : public NavigationAgent private: DistanceUnitSystem units{DistanceUnitSystem::Metrics}; + Vehicle vehicle{vehicleCar}; // state used for triggering GpsFound / GpsLost messages bool prevGpsSignal{true}; diff --git a/libosmscout/src/osmscout/navigation/VoiceInstructionAgent.cpp b/libosmscout/src/osmscout/navigation/VoiceInstructionAgent.cpp index a71f8e63d..d4e84a1d7 100644 --- a/libosmscout/src/osmscout/navigation/VoiceInstructionAgent.cpp +++ b/libosmscout/src/osmscout/navigation/VoiceInstructionAgent.cpp @@ -270,7 +270,9 @@ std::vector VoiceInstructionAgent::toSampl return samples; } - if (distanceInUnits > 50){ + if (bool skipDistanceInformation = (distanceInUnits < 80 && vehicle == vehicleCar); + !skipDistanceInformation){ + samples.push_back(VoiceSample::After); if (distanceInUnits > 800){ samples.push_back(VoiceSample::Distance800); @@ -299,7 +301,7 @@ std::vector VoiceInstructionAgent::toSampl toSamples(samples, message.type); if (then){ auto thenDistance = then.distance - message.distance; - if (thenDistance <= Meters(200)) { // ignore then messsage otherwise + if (thenDistance <= Meters(200)) { // ignore then message otherwise samples.push_back(VoiceSample::Then); toSamples(samples, then.type); } @@ -316,6 +318,7 @@ std::list VoiceInstructionAgent::Process(const NavigationM // reset state lastMessage.type=MessageType::NoMessage; lastMessagePosition=Distance::Zero(); + vehicle=routeUpdateMessage->vehicle; return result; }