mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#CSAR Nicer TTS output for MGRS coordinates
This commit is contained in:
parent
044fb66ca0
commit
dd8b2caa24
@ -295,7 +295,7 @@ CSAR.AircraftType["OH-6A"] = 2
|
|||||||
|
|
||||||
--- CSAR class version.
|
--- CSAR class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CSAR.version="1.0.22"
|
CSAR.version="1.0.23"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@ -735,7 +735,7 @@ function CSAR:_SpawnPilotInField(country,point,frequency,wetfeet)
|
|||||||
:NewWithAlias(template,alias)
|
:NewWithAlias(template,alias)
|
||||||
:InitCoalition(coalition)
|
:InitCoalition(coalition)
|
||||||
:InitCountry(country)
|
:InitCountry(country)
|
||||||
:InitAIOnOff(pilotcacontrol)
|
--:InitAIOnOff(pilotcacontrol)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
:SpawnFromCoordinate(point)
|
:SpawnFromCoordinate(point)
|
||||||
|
|
||||||
@ -1239,10 +1239,24 @@ function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage, _pla
|
|||||||
if not _nomessage then
|
if not _nomessage then
|
||||||
if _freq ~= 0 then --shagrat
|
if _freq ~= 0 then --shagrat
|
||||||
local _text = string.format("%s requests SAR at %s, beacon at %.2f KHz", _groupName, _coordinatesText, _freqk)--shagrat _groupName to prevent 'f15_Pilot_Parachute'
|
local _text = string.format("%s requests SAR at %s, beacon at %.2f KHz", _groupName, _coordinatesText, _freqk)--shagrat _groupName to prevent 'f15_Pilot_Parachute'
|
||||||
|
if self.coordtype ~= 2 then --not MGRS
|
||||||
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
||||||
|
else
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,false,true)
|
||||||
|
local coordtext = UTILS.MGRSStringToSRSFriendly(_coordinatesText,true)
|
||||||
|
local _text = string.format("%s requests SAR at %s, beacon at %.2f kilo hertz", _groupName, coordtext, _freqk)
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,true,false)
|
||||||
|
end
|
||||||
else --shagrat CASEVAC msg
|
else --shagrat CASEVAC msg
|
||||||
local _text = string.format("Pickup Zone at %s.", _coordinatesText )
|
local _text = string.format("Pickup Zone at %s.", _coordinatesText )
|
||||||
|
if self.coordtype ~= 2 then --not MGRS
|
||||||
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
|
||||||
|
else
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,false,true)
|
||||||
|
local coordtext = UTILS.MGRSStringToSRSFriendly(_coordinatesText,true)
|
||||||
|
local _text = string.format("Pickup Zone at %s.", coordtext )
|
||||||
|
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,true,false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1948,23 +1962,28 @@ end
|
|||||||
-- @param #string _message Message to display.
|
-- @param #string _message Message to display.
|
||||||
-- @param #number _side Coalition of message.
|
-- @param #number _side Coalition of message.
|
||||||
-- @param #number _messagetime How long to show.
|
-- @param #number _messagetime How long to show.
|
||||||
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime)
|
-- @param #boolean ToSRS If true or nil, send to SRS TTS
|
||||||
|
-- @param #boolean ToScreen If true or nil, send to Screen
|
||||||
|
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime,ToSRS,ToScreen)
|
||||||
self:T(self.lid .. " _DisplayToAllSAR")
|
self:T(self.lid .. " _DisplayToAllSAR")
|
||||||
local messagetime = _messagetime or self.messageTime
|
local messagetime = _messagetime or self.messageTime
|
||||||
if self.msrs then
|
self:T({_message,ToSRS=ToSRS,ToScreen=ToScreen})
|
||||||
|
if self.msrs and (ToSRS == true or ToSRS == nil) then
|
||||||
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
|
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
|
||||||
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
|
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
|
||||||
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
|
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
|
||||||
end
|
end
|
||||||
self:I("Voice = "..voice)
|
self:F("Voice = "..voice)
|
||||||
self.SRSQueue:NewTransmission(_message,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,voice,volume,label,self.coordinate)
|
self.SRSQueue:NewTransmission(_message,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,voice,volume,label,self.coordinate)
|
||||||
end
|
end
|
||||||
|
if ToScreen == true or ToScreen == nil then
|
||||||
for _, _unitName in pairs(self.csarUnits) do
|
for _, _unitName in pairs(self.csarUnits) do
|
||||||
local _unit = self:_GetSARHeli(_unitName)
|
local _unit = self:_GetSARHeli(_unitName)
|
||||||
if _unit and not self.suppressmessages then
|
if _unit and not self.suppressmessages then
|
||||||
self:_DisplayMessageToSAR(_unit, _message, _messagetime)
|
self:_DisplayMessageToSAR(_unit, _message, _messagetime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -2649,6 +2649,9 @@ function UTILS.SaveSetOfGroups(Set,Path,Filename,Structured)
|
|||||||
if group and group:IsAlive() then
|
if group and group:IsAlive() then
|
||||||
local name = group:GetName()
|
local name = group:GetName()
|
||||||
local template = string.gsub(name,"-(.+)$","")
|
local template = string.gsub(name,"-(.+)$","")
|
||||||
|
if string.find(name,"AID") then
|
||||||
|
template = string.gsub(name,"(.AID.%d+$","")
|
||||||
|
end
|
||||||
if string.find(template,"#") then
|
if string.find(template,"#") then
|
||||||
template = string.gsub(name,"#(%d+)$","")
|
template = string.gsub(name,"#(%d+)$","")
|
||||||
end
|
end
|
||||||
@ -3881,3 +3884,46 @@ function UTILS.ClockHeadingString(refHdg,tgtHdg)
|
|||||||
local clockPos = math.ceil((relativeAngle % 360) / 30)
|
local clockPos = math.ceil((relativeAngle % 360) / 30)
|
||||||
return clockPos.." o'clock"
|
return clockPos.." o'clock"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get a NATO abbreviated MGRS text for SRS use, optionally with prosody slow tag
|
||||||
|
-- @param #string Text The input string, e.g. "MGRS 4Q FJ 12345 67890"
|
||||||
|
-- @param #boolean Slow Optional - add slow tags
|
||||||
|
-- @return #string Output for (Slow) spelling in SRS TTS e.g. "MGRS;<prosody rate="slow">4;Quebec;Foxtrot;Juliett;1;2;3;4;5;6;7;8;niner;zero;</prosody>"
|
||||||
|
function UTILS.MGRSStringToSRSFriendly(Text,Slow)
|
||||||
|
local Text = string.gsub(Text,"MGRS ","")
|
||||||
|
Text = string.gsub(Text,"%s+","")
|
||||||
|
Text = string.gsub(Text,"([%a%d])","%1;") -- "0;5;1;"
|
||||||
|
Text = string.gsub(Text,"A","Alpha")
|
||||||
|
Text = string.gsub(Text,"B","Bravo")
|
||||||
|
Text = string.gsub(Text,"C","Charlie")
|
||||||
|
Text = string.gsub(Text,"D","Delta")
|
||||||
|
Text = string.gsub(Text,"E","Echo")
|
||||||
|
Text = string.gsub(Text,"F","Foxtrot")
|
||||||
|
Text = string.gsub(Text,"G","Golf")
|
||||||
|
Text = string.gsub(Text,"H","Hotel")
|
||||||
|
Text = string.gsub(Text,"I","India")
|
||||||
|
Text = string.gsub(Text,"J","Juliett")
|
||||||
|
Text = string.gsub(Text,"K","Kilo")
|
||||||
|
Text = string.gsub(Text,"L","Lima")
|
||||||
|
Text = string.gsub(Text,"M","Mike")
|
||||||
|
Text = string.gsub(Text,"N","November")
|
||||||
|
Text = string.gsub(Text,"O","Oscar")
|
||||||
|
Text = string.gsub(Text,"P","Papa")
|
||||||
|
Text = string.gsub(Text,"Q","Quebec")
|
||||||
|
Text = string.gsub(Text,"R","Romeo")
|
||||||
|
Text = string.gsub(Text,"S","Sierra")
|
||||||
|
Text = string.gsub(Text,"T","Tango")
|
||||||
|
Text = string.gsub(Text,"U","Uniform")
|
||||||
|
Text = string.gsub(Text,"V","Victor")
|
||||||
|
Text = string.gsub(Text,"W","Whiskey")
|
||||||
|
Text = string.gsub(Text,"X","Xray")
|
||||||
|
Text = string.gsub(Text,"Y","Yankee")
|
||||||
|
Text = string.gsub(Text,"Z","Zulu")
|
||||||
|
Text = string.gsub(Text,"0","zero")
|
||||||
|
Text = string.gsub(Text,"9","niner")
|
||||||
|
if Slow then
|
||||||
|
Text = '<prosody rate="slow">'..Text..'</prosody>'
|
||||||
|
end
|
||||||
|
Text = "MGRS;"..Text
|
||||||
|
return Text
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user