mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Update SRS.lua
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
-- **Main Features:**
|
-- **Main Features:**
|
||||||
--
|
--
|
||||||
-- * Play sound files via SRS
|
-- * Play sound files via SRS
|
||||||
-- * Play text-to-speach via SRS
|
-- * Play text-to-speech via SRS
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -65,6 +65,16 @@
|
|||||||
--
|
--
|
||||||
-- This script needs SRS version >= 1.9.6.
|
-- This script needs SRS version >= 1.9.6.
|
||||||
--
|
--
|
||||||
|
-- ## Knwon Issues
|
||||||
|
--
|
||||||
|
-- ### Pop-up Window
|
||||||
|
--
|
||||||
|
-- The text-to-speech conversion of SRS is done via an external exe file. When this file is called, a windows `cmd` window is briefly opended. That puts DCS out of focus, which is annoying,
|
||||||
|
-- expecially in VR but unavoidable (if you have a solution, please feel free to share!).
|
||||||
|
--
|
||||||
|
-- NOTE that this is not an issue if the mission is running on a server.
|
||||||
|
-- Also NOTE that using DCS-gRPC as backend will avoid the pop-up window.
|
||||||
|
--
|
||||||
-- # Play Sound Files
|
-- # Play Sound Files
|
||||||
--
|
--
|
||||||
-- local soundfile=SOUNDFILE:New("My Soundfile.ogg", "D:\\Sounds For DCS")
|
-- local soundfile=SOUNDFILE:New("My Soundfile.ogg", "D:\\Sounds For DCS")
|
||||||
@@ -188,7 +198,7 @@ MSRS = {
|
|||||||
gender = "female",
|
gender = "female",
|
||||||
culture = nil,
|
culture = nil,
|
||||||
voice = nil,
|
voice = nil,
|
||||||
volume = 1,
|
volume = 1,
|
||||||
speed = 1,
|
speed = 1,
|
||||||
coordinate = nil,
|
coordinate = nil,
|
||||||
Label = "ROBOT",
|
Label = "ROBOT",
|
||||||
@@ -201,7 +211,7 @@ MSRS = {
|
|||||||
|
|
||||||
--- MSRS class version.
|
--- MSRS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
MSRS.version="0.1.3"
|
MSRS.version="0.2.0"
|
||||||
|
|
||||||
--- Voices
|
--- Voices
|
||||||
-- @type MSRS.Voices
|
-- @type MSRS.Voices
|
||||||
@@ -304,7 +314,20 @@ MSRS.Voices = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
--- Text-to-speech providers. These are compatible with the DCS-gRPC conventions.
|
||||||
|
-- @type MSRS.Provider
|
||||||
|
-- @field #string WINDOWS Microsoft windows (`win`).
|
||||||
|
-- @field #string GOOGLE Google (`gcloud`).
|
||||||
|
-- @field #string AZURE Microsoft Azure (`azure`).
|
||||||
|
-- @field #string AMAZON Amazon Web Service (`asw`).
|
||||||
|
MSRS.Provider = {
|
||||||
|
WINDOWS = "win",
|
||||||
|
GOOGLE = "gcloud",
|
||||||
|
AZURE = "azure",
|
||||||
|
AMAZON = "asw",
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Provider options.
|
||||||
-- @type MSRS.ProviderOptions
|
-- @type MSRS.ProviderOptions
|
||||||
-- @field #string key
|
-- @field #string key
|
||||||
-- @field #string secret
|
-- @field #string secret
|
||||||
@@ -312,7 +335,7 @@ MSRS.Voices = {
|
|||||||
-- @field #string defaultVoice
|
-- @field #string defaultVoice
|
||||||
-- @field #string voice
|
-- @field #string voice
|
||||||
|
|
||||||
--- GRPC options
|
--- GRPC options.
|
||||||
-- @type MSRS.GRPCOptions
|
-- @type MSRS.GRPCOptions
|
||||||
-- @field #string plaintext
|
-- @field #string plaintext
|
||||||
-- @field #string srsClientName
|
-- @field #string srsClientName
|
||||||
@@ -339,6 +362,8 @@ MSRS.GRPCOptions.DefaultProvider = "win"
|
|||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- TODO: Refactoring of input/config file.
|
||||||
|
-- TODO: Refactoring gRPC backend.
|
||||||
-- TODO: Add functions to remove freqs and modulations.
|
-- TODO: Add functions to remove freqs and modulations.
|
||||||
-- DONE: Add coordinate.
|
-- DONE: Add coordinate.
|
||||||
-- DONE: Add google.
|
-- DONE: Add google.
|
||||||
@@ -354,7 +379,7 @@ MSRS.GRPCOptions.DefaultProvider = "win"
|
|||||||
-- @param #string PathToSRS Path to the directory, where SRS is located.
|
-- @param #string PathToSRS Path to the directory, where SRS is located.
|
||||||
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. Can also be given as a #table of multiple frequencies.
|
-- @param #number Frequency Radio frequency in MHz. Default 143.00 MHz. Can also be given as a #table of multiple frequencies.
|
||||||
-- @param #number Modulation Radio modulation: 0=AM (default), 1=FM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. Can also be given as a #table of multiple modulations.
|
-- @param #number Modulation Radio modulation: 0=AM (default), 1=FM. See `radio.modulation.AM` and `radio.modulation.FM` enumerators. Can also be given as a #table of multiple modulations.
|
||||||
-- @param #number Volume Volume - 1.0 is max, 0.0 is silence
|
-- @param #number Volume Volume - 1.0 is max, 0.0 is silence.
|
||||||
-- @param #table AltBackend Optional table containing tables 'Functions' and 'Vars' which add/replace functions and variables for the MSRS instance to allow alternate backends for transmitting to SRS.
|
-- @param #table AltBackend Optional table containing tables 'Functions' and 'Vars' which add/replace functions and variables for the MSRS instance to allow alternate backends for transmitting to SRS.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:New(PathToSRS, Frequency, Modulation, Volume, AltBackend)
|
function MSRS:New(PathToSRS, Frequency, Modulation, Volume, AltBackend)
|
||||||
@@ -534,13 +559,8 @@ end
|
|||||||
-- @param #table Frequencies Frequencies in MHz. Can also be given as a #number if only one frequency should be used.
|
-- @param #table Frequencies Frequencies in MHz. Can also be given as a #number if only one frequency should be used.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetFrequencies(Frequencies)
|
function MSRS:SetFrequencies(Frequencies)
|
||||||
|
|
||||||
-- Ensure table.
|
|
||||||
if type(Frequencies)~="table" then
|
|
||||||
Frequencies={Frequencies}
|
|
||||||
end
|
|
||||||
|
|
||||||
self.frequencies=Frequencies
|
self.frequencies=UTILS.EnsureTable(Frequencies, false)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -551,12 +571,8 @@ end
|
|||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:AddFrequencies(Frequencies)
|
function MSRS:AddFrequencies(Frequencies)
|
||||||
|
|
||||||
-- Ensure table.
|
for _,_freq in pairs(UTILS.EnsureTable(Frequencies, false)) do
|
||||||
if type(Frequencies)~="table" then
|
self:T(self.lid..string.format("Adding frequency %s", tostring(_freq)))
|
||||||
Frequencies={Frequencies}
|
|
||||||
end
|
|
||||||
|
|
||||||
for _,_freq in pairs(Frequencies) do
|
|
||||||
table.insert(self.frequencies,_freq)
|
table.insert(self.frequencies,_freq)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -576,13 +592,12 @@ end
|
|||||||
-- @param #table Modulations Modulations. Can also be given as a #number if only one modulation should be used.
|
-- @param #table Modulations Modulations. Can also be given as a #number if only one modulation should be used.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetModulations(Modulations)
|
function MSRS:SetModulations(Modulations)
|
||||||
|
|
||||||
-- Ensure table.
|
|
||||||
if type(Modulations)~="table" then
|
|
||||||
Modulations={Modulations}
|
|
||||||
end
|
|
||||||
|
|
||||||
self.modulations=Modulations
|
self.modulations=UTILS.EnsureTable(Modulations, false)
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
self:T(self.lid.."Modulations:")
|
||||||
|
self:T(self.modulations)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -592,13 +607,8 @@ end
|
|||||||
-- @param #table Modulations Modulations. Can also be given as a #number if only one modulation should be used.
|
-- @param #table Modulations Modulations. Can also be given as a #number if only one modulation should be used.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:AddModulations(Modulations)
|
function MSRS:AddModulations(Modulations)
|
||||||
|
|
||||||
-- Ensure table.
|
|
||||||
if type(Modulations)~="table" then
|
|
||||||
Modulations={Modulations}
|
|
||||||
end
|
|
||||||
|
|
||||||
for _,_mod in pairs(Modulations) do
|
for _,_mod in pairs(UTILS.EnsureTable(Modulations, false)) do
|
||||||
table.insert(self.modulations,_mod)
|
table.insert(self.modulations,_mod)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user