From 3e8db6a1fad274c1ad59bb8a6b23e5729d6c0d04 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 10 Jun 2021 23:23:16 +0200 Subject: [PATCH] ATIS Improved time TTS format --- Moose Development/Moose/Ops/ATIS.lua | 12 ++++- Moose Development/Moose/Sound/SRS.lua | 46 ++++++++++++------- Moose Development/Moose/Sound/SoundOutput.lua | 4 +- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 310d42a9d..92683b48e 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -1395,11 +1395,14 @@ function ATIS:onafterBroadcast(From, Event, To) if time < 0 then time = 24*60*60 + time --avoid negative time around midnight - end + end local clock=UTILS.SecondsToClock(time) local zulu=UTILS.Split(clock, ":") 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. @@ -1419,10 +1422,17 @@ function ATIS:onafterBroadcast(From, Event, To) local sunrise=coord:GetSunrise() sunrise=UTILS.Split(sunrise, ":") 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() sunset=UTILS.Split(sunset, ":") 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 --- diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index 44c5a4c3f..04b785b6c 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -158,7 +158,7 @@ end --- Set path to SRS install directory. More precisely, path to where the DCS- -- @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 function MSRS:SetPath(Path) @@ -177,9 +177,8 @@ function MSRS:SetPath(Path) n=n+1 end - self.path=self.path --.."/" - - self:I(string.format("SRS path=%s", self:GetPath())) + -- Debug output. + self:T(string.format("SRS path=%s", self:GetPath())) return self end @@ -258,13 +257,13 @@ end -- @param #string Gender Gender: "male" or "female" (default). -- @return #MSRS self function MSRS:SetGender(Gender) - self:I("Input gender to "..tostring(Gender)) Gender=Gender or "female" self.gender=Gender:lower() - self:I("Setting gender to "..tostring(self.gender)) + -- Debug output. + self:T("Setting gender to "..tostring(self.gender)) return self end @@ -291,6 +290,26 @@ function MSRS:SetVoice(Voice) return self 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 @@ -450,7 +469,7 @@ function MSRS:PlayTextFile(TextFile, Delay) command=command..string.format(" --textFile=\"%s\"", tostring(TextFile)) -- Debug output. - self:I(string.format("MSRS TextFile command=%s", command)) + self:T(string.format("MSRS TextFile command=%s", command)) -- Count length of command. local l=string.len(command) @@ -502,13 +521,8 @@ function MSRS:_ExecCommand(command) local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs) -- Debug output. - self:I("MSRS execute command="..command) - self:I("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() + self:T("MSRS execute command="..command) + self:T("MSRS execute VBS command="..runvbs) -- Play file in 0.01 seconds os.execute(runvbs) @@ -521,7 +535,7 @@ function MSRS:_ExecCommand(command) else -- Debug output. - self:I("MSRS execute command="..command) + self:T("MSRS execute command="..command) -- Play file in 0.05 seconds 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 -- Debug output. - self:I("MSRS command="..command) + self:T("MSRS command="..command) return command end diff --git a/Moose Development/Moose/Sound/SoundOutput.lua b/Moose Development/Moose/Sound/SoundOutput.lua index af0e0675b..f581e9fe3 100644 --- a/Moose Development/Moose/Sound/SoundOutput.lua +++ b/Moose Development/Moose/Sound/SoundOutput.lua @@ -132,7 +132,7 @@ do -- Sound File self:SetDuration(Duration) -- 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 end @@ -300,7 +300,7 @@ do -- Text-To-Speech --self:SetCulture() -- 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 end