Merge branch 'FF/MasterDevel' into FF/Ops

This commit is contained in:
Frank 2021-06-10 23:23:30 +02:00
commit a8ef096f24
3 changed files with 43 additions and 19 deletions

View File

@ -1395,11 +1395,14 @@ function ATIS:onafterBroadcast(From, Event, To)
if time < 0 then if time < 0 then
time = 24*60*60 + time --avoid negative time around midnight time = 24*60*60 + time --avoid negative time around midnight
end end
local clock=UTILS.SecondsToClock(time) local clock=UTILS.SecondsToClock(time)
local zulu=UTILS.Split(clock, ":") local zulu=UTILS.Split(clock, ":")
local ZULU=string.format("%s%s", zulu[1], zulu[2]) local ZULU=string.format("%s%s", zulu[1], zulu[2])
if self.useSRS then
ZULU=string.format("%s hours", zulu[1])
end
-- NATO time stamp. 0=Alfa, 1=Bravo, 2=Charlie, etc. -- NATO time stamp. 0=Alfa, 1=Bravo, 2=Charlie, etc.
@ -1419,10 +1422,17 @@ function ATIS:onafterBroadcast(From, Event, To)
local sunrise=coord:GetSunrise() local sunrise=coord:GetSunrise()
sunrise=UTILS.Split(sunrise, ":") sunrise=UTILS.Split(sunrise, ":")
local SUNRISE=string.format("%s%s", sunrise[1], sunrise[2]) local SUNRISE=string.format("%s%s", sunrise[1], sunrise[2])
if self.useSRS then
SUNRISE=string.format("%s %s hours", sunrise[1], sunrise[2])
end
local sunset=coord:GetSunset() local sunset=coord:GetSunset()
sunset=UTILS.Split(sunset, ":") sunset=UTILS.Split(sunset, ":")
local SUNSET=string.format("%s%s", sunset[1], sunset[2]) local SUNSET=string.format("%s%s", sunset[1], sunset[2])
if self.useSRS then
SUNSET=string.format("%s %s hours", sunset[1], sunset[2])
end
--------------------------------- ---------------------------------
--- Temperature and Dew Point --- --- Temperature and Dew Point ---

View File

@ -158,7 +158,7 @@ end
--- Set path to SRS install directory. More precisely, path to where the DCS- --- Set path to SRS install directory. More precisely, path to where the DCS-
-- @param #MSRS self -- @param #MSRS self
-- @param #string Path Path to the directory, where the sound file is located. -- @param #string Path Path to the directory, where the sound file is located. This does **not** contain a final backslash or slash.
-- @return #MSRS self -- @return #MSRS self
function MSRS:SetPath(Path) function MSRS:SetPath(Path)
@ -177,9 +177,8 @@ function MSRS:SetPath(Path)
n=n+1 n=n+1
end end
self.path=self.path --.."/" -- Debug output.
self:T(string.format("SRS path=%s", self:GetPath()))
self:I(string.format("SRS path=%s", self:GetPath()))
return self return self
end end
@ -258,13 +257,13 @@ end
-- @param #string Gender Gender: "male" or "female" (default). -- @param #string Gender Gender: "male" or "female" (default).
-- @return #MSRS self -- @return #MSRS self
function MSRS:SetGender(Gender) function MSRS:SetGender(Gender)
self:I("Input gender to "..tostring(Gender))
Gender=Gender or "female" Gender=Gender or "female"
self.gender=Gender:lower() self.gender=Gender:lower()
self:I("Setting gender to "..tostring(self.gender)) -- Debug output.
self:T("Setting gender to "..tostring(self.gender))
return self return self
end end
@ -291,6 +290,26 @@ function MSRS:SetVoice(Voice)
return self return self
end end
--- Opens a new command window and prints the SRS STTS help.
-- @param #MSRS self
-- @return #MSRS self
function MSRS:Help()
local path=self:GetPath() or STTS.DIRECTORY
local exe=STTS.EXECUTABLE or "DCS-SR-ExternalAudio.exe"
local filename = os.getenv('TMP') .. "\\MSRS-help-"..STTS.uuid()..".txt"
local command=string.format("%s/%s --help > %s", path, exe, filename)
os.execute(command)
local f=assert(io.open(filename, "rb"))
local data=f:read("*all")
f:close()
env.info(data)
return self
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Transmission Functions -- Transmission Functions
@ -450,7 +469,7 @@ function MSRS:PlayTextFile(TextFile, Delay)
command=command..string.format(" --textFile=\"%s\"", tostring(TextFile)) command=command..string.format(" --textFile=\"%s\"", tostring(TextFile))
-- Debug output. -- Debug output.
self:I(string.format("MSRS TextFile command=%s", command)) self:T(string.format("MSRS TextFile command=%s", command))
-- Count length of command. -- Count length of command.
local l=string.len(command) local l=string.len(command)
@ -502,13 +521,8 @@ function MSRS:_ExecCommand(command)
local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs) local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs)
-- Debug output. -- Debug output.
self:I("MSRS execute command="..command) self:T("MSRS execute command="..command)
self:I("MSRS execute VBS command="..runvbs) self:T("MSRS execute VBS command="..runvbs)
-- Now create powershell process and feed your script to its stdin
--local pipe = io.popen("cscript.exe //Nologo //B", "w")
--pipe:write(script)
--pipe:close()
-- Play file in 0.01 seconds -- Play file in 0.01 seconds
os.execute(runvbs) os.execute(runvbs)
@ -521,7 +535,7 @@ function MSRS:_ExecCommand(command)
else else
-- Debug output. -- Debug output.
self:I("MSRS execute command="..command) self:T("MSRS execute command="..command)
-- Play file in 0.05 seconds -- Play file in 0.05 seconds
timer.scheduleFunction(os.execute, command, timer.getTime()+0.01) timer.scheduleFunction(os.execute, command, timer.getTime()+0.01)
@ -592,7 +606,7 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp
end end
-- Debug output. -- Debug output.
self:I("MSRS command="..command) self:T("MSRS command="..command)
return command return command
end end

View File

@ -132,7 +132,7 @@ do -- Sound File
self:SetDuration(Duration) self:SetDuration(Duration)
-- Debug info: -- Debug info:
self:I(string.format("New SOUNDFILE: file name=%s, path=%s", self.filename, self.path)) self:T(string.format("New SOUNDFILE: file name=%s, path=%s", self.filename, self.path))
return self return self
end end
@ -300,7 +300,7 @@ do -- Text-To-Speech
--self:SetCulture() --self:SetCulture()
-- Debug info: -- Debug info:
self:I(string.format("New SOUNDTEXT: text=%s, duration=%.1f sec", self.text, self.duration)) self:T(string.format("New SOUNDTEXT: text=%s, duration=%.1f sec", self.text, self.duration))
return self return self
end end