[tts] Fix invalid formatting

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-11-20 12:06:00 +00:00
parent e53532ab0b
commit f98a0efa46

View File

@@ -213,15 +213,18 @@ std::string GetTtsText::GetTurnNotification(Notification const & notification) c
} }
} }
std::string ttsOut = distDirOntoStreetStr + distStr + // in 100 feet char ttsOut[1024];
dirStr + // turn right / take exit std::snprintf(ttsOut, std::size(ttsOut), distDirOntoStreetStr.c_str(),
ontoStr + // onto / null distStr.c_str(), // in 100 feet
streetOut + // Main Street / 543:: M4: Queens Parkway, London dirStr.c_str(), // turn right / take exit
dirVerb; // (optional "turn right" verb) ontoStr.c_str(), // onto / null
streetOut.c_str(), // Main Street / 543:: M4: Queens Parkway, London
dirVerb.c_str() // (optional "turn right" verb)
);
// remove floating punctuation // remove floating punctuation
static boost::regex const rP(" [,\\.:;]+ "); static boost::regex const rP(" [,\\.:;]+ ");
std::string cleanOut = boost::regex_replace(ttsOut, rP, " "); std::string cleanOut = boost::regex_replace(std::string(ttsOut), rP, " ");
// remove repetitious spaces or colons // remove repetitious spaces or colons
static boost::regex const rS("[ :]{2,99}"); static boost::regex const rS("[ :]{2,99}");
cleanOut = boost::regex_replace(cleanOut, rS, " "); cleanOut = boost::regex_replace(cleanOut, rS, " ");