mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
# Conflicts: # Moose Development/Moose/Sound/SRS.lua
This commit is contained in:
@@ -1986,7 +1986,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupActive
|
MGroupInclude = MGroupInclude and MGroupActive
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MGroupInclude then
|
||||||
local MGroupCoalition = false
|
local MGroupCoalition = false
|
||||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||||
self:T3( { "Coalition:", MGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
self:T3( { "Coalition:", MGroup:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
||||||
@@ -1997,7 +1997,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupCoalition
|
MGroupInclude = MGroupInclude and MGroupCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MGroupInclude then
|
||||||
local MGroupCategory = false
|
local MGroupCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
self:T3( { "Category:", MGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } )
|
self:T3( { "Category:", MGroup:GetCategory(), self.FilterMeta.Categories[CategoryName], CategoryName } )
|
||||||
@@ -2008,7 +2008,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupCategory
|
MGroupInclude = MGroupInclude and MGroupCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MGroupInclude then
|
||||||
local MGroupCountry = false
|
local MGroupCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
self:T3( { "Country:", MGroup:GetCountry(), CountryName } )
|
self:T3( { "Country:", MGroup:GetCountry(), CountryName } )
|
||||||
@@ -2019,7 +2019,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupCountry
|
MGroupInclude = MGroupInclude and MGroupCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.GroupPrefixes then
|
if self.Filter.GroupPrefixes and MGroupInclude then
|
||||||
local MGroupPrefix = false
|
local MGroupPrefix = false
|
||||||
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
for GroupPrefixId, GroupPrefix in pairs( self.Filter.GroupPrefixes ) do
|
||||||
self:T3( { "Prefix:", string.find( MGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } )
|
self:T3( { "Prefix:", string.find( MGroup:GetName(), GroupPrefix, 1 ), GroupPrefix } )
|
||||||
@@ -2030,7 +2030,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupPrefix
|
MGroupInclude = MGroupInclude and MGroupPrefix
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones and MGroupInclude then
|
||||||
local MGroupZone = false
|
local MGroupZone = false
|
||||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||||
--self:T( "Zone:", ZoneName )
|
--self:T( "Zone:", ZoneName )
|
||||||
@@ -2041,7 +2041,7 @@ do
|
|||||||
MGroupInclude = MGroupInclude and MGroupZone
|
MGroupInclude = MGroupInclude and MGroupZone
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Functions then
|
if self.Filter.Functions and MGroupInclude then
|
||||||
local MGroupFunc = false
|
local MGroupFunc = false
|
||||||
MGroupFunc = self:_EvalFilterFunctions(MGroup)
|
MGroupFunc = self:_EvalFilterFunctions(MGroup)
|
||||||
MGroupInclude = MGroupInclude and MGroupFunc
|
MGroupInclude = MGroupInclude and MGroupFunc
|
||||||
@@ -3192,7 +3192,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitActive
|
MUnitInclude = MUnitInclude and MUnitActive
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MUnitInclude then
|
||||||
local MUnitCoalition = false
|
local MUnitCoalition = false
|
||||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||||
self:F( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
self:F( { "Coalition:", MUnit:GetCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
|
||||||
@@ -3203,7 +3203,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitCoalition
|
MUnitInclude = MUnitInclude and MUnitCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MUnitInclude then
|
||||||
local MUnitCategory = false
|
local MUnitCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } )
|
self:T3( { "Category:", MUnit:GetDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } )
|
||||||
@@ -3214,7 +3214,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitCategory
|
MUnitInclude = MUnitInclude and MUnitCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Types then
|
if self.Filter.Types and MUnitInclude then
|
||||||
local MUnitType = false
|
local MUnitType = false
|
||||||
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
||||||
self:T3( { "Type:", MUnit:GetTypeName(), TypeName } )
|
self:T3( { "Type:", MUnit:GetTypeName(), TypeName } )
|
||||||
@@ -3225,7 +3225,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitType
|
MUnitInclude = MUnitInclude and MUnitType
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MUnitInclude then
|
||||||
local MUnitCountry = false
|
local MUnitCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
self:T3( { "Country:", MUnit:GetCountry(), CountryName } )
|
self:T3( { "Country:", MUnit:GetCountry(), CountryName } )
|
||||||
@@ -3236,7 +3236,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitCountry
|
MUnitInclude = MUnitInclude and MUnitCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.UnitPrefixes then
|
if self.Filter.UnitPrefixes and MUnitInclude then
|
||||||
local MUnitPrefix = false
|
local MUnitPrefix = false
|
||||||
for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do
|
for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do
|
||||||
self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } )
|
self:T3( { "Prefix:", string.find( MUnit:GetName(), UnitPrefix, 1 ), UnitPrefix } )
|
||||||
@@ -3247,7 +3247,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitPrefix
|
MUnitInclude = MUnitInclude and MUnitPrefix
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.RadarTypes then
|
if self.Filter.RadarTypes and MUnitInclude then
|
||||||
local MUnitRadar = false
|
local MUnitRadar = false
|
||||||
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
for RadarTypeID, RadarType in pairs( self.Filter.RadarTypes ) do
|
||||||
self:T3( { "Radar:", RadarType } )
|
self:T3( { "Radar:", RadarType } )
|
||||||
@@ -3261,7 +3261,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MUnitRadar
|
MUnitInclude = MUnitInclude and MUnitRadar
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.SEAD then
|
if self.Filter.SEAD and MUnitInclude then
|
||||||
local MUnitSEAD = false
|
local MUnitSEAD = false
|
||||||
if MUnit:HasSEAD() == true then
|
if MUnit:HasSEAD() == true then
|
||||||
self:T3( "SEAD Found" )
|
self:T3( "SEAD Found" )
|
||||||
@@ -3271,7 +3271,7 @@ do -- SET_UNIT
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones and MUnitInclude then
|
||||||
local MGroupZone = false
|
local MGroupZone = false
|
||||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||||
self:T3( "Zone:", ZoneName )
|
self:T3( "Zone:", ZoneName )
|
||||||
@@ -3282,7 +3282,7 @@ do -- SET_UNIT
|
|||||||
MUnitInclude = MUnitInclude and MGroupZone
|
MUnitInclude = MUnitInclude and MGroupZone
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Functions then
|
if self.Filter.Functions and MUnitInclude then
|
||||||
local MUnitFunc = self:_EvalFilterFunctions(MUnit)
|
local MUnitFunc = self:_EvalFilterFunctions(MUnit)
|
||||||
MUnitInclude = MUnitInclude and MUnitFunc
|
MUnitInclude = MUnitInclude and MUnitFunc
|
||||||
end
|
end
|
||||||
@@ -4689,7 +4689,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientActive
|
MClientInclude = MClientInclude and MClientActive
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MClientInclude then
|
||||||
local MClientCoalition = false
|
local MClientCoalition = false
|
||||||
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
|
||||||
local ClientCoalitionID = _DATABASE:GetCoalitionFromClientTemplate( MClientName )
|
local ClientCoalitionID = _DATABASE:GetCoalitionFromClientTemplate( MClientName )
|
||||||
@@ -4702,7 +4702,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCoalition
|
MClientInclude = MClientInclude and MClientCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MClientInclude then
|
||||||
local MClientCategory = false
|
local MClientCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
|
local ClientCategoryID = _DATABASE:GetCategoryFromClientTemplate( MClientName )
|
||||||
@@ -4715,7 +4715,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCategory
|
MClientInclude = MClientInclude and MClientCategory
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Types then
|
if self.Filter.Types and MClientInclude then
|
||||||
local MClientType = false
|
local MClientType = false
|
||||||
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
for TypeID, TypeName in pairs( self.Filter.Types ) do
|
||||||
self:T3( { "Type:", MClient:GetTypeName(), TypeName } )
|
self:T3( { "Type:", MClient:GetTypeName(), TypeName } )
|
||||||
@@ -4727,7 +4727,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientType
|
MClientInclude = MClientInclude and MClientType
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MClientInclude then
|
||||||
local MClientCountry = false
|
local MClientCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
local ClientCountryID = _DATABASE:GetCountryFromClientTemplate( MClientName )
|
local ClientCountryID = _DATABASE:GetCountryFromClientTemplate( MClientName )
|
||||||
@@ -4740,7 +4740,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCountry
|
MClientInclude = MClientInclude and MClientCountry
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.ClientPrefixes then
|
if self.Filter.ClientPrefixes and MClientInclude then
|
||||||
local MClientPrefix = false
|
local MClientPrefix = false
|
||||||
for ClientPrefixId, ClientPrefix in pairs( self.Filter.ClientPrefixes ) do
|
for ClientPrefixId, ClientPrefix in pairs( self.Filter.ClientPrefixes ) do
|
||||||
self:T3( { "Prefix:", string.find( MClient.UnitName, ClientPrefix, 1 ), ClientPrefix } )
|
self:T3( { "Prefix:", string.find( MClient.UnitName, ClientPrefix, 1 ), ClientPrefix } )
|
||||||
@@ -4752,7 +4752,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientPrefix
|
MClientInclude = MClientInclude and MClientPrefix
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones and MClientInclude then
|
||||||
local MClientZone = false
|
local MClientZone = false
|
||||||
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
for ZoneName, Zone in pairs( self.Filter.Zones ) do
|
||||||
self:T3( "Zone:", ZoneName )
|
self:T3( "Zone:", ZoneName )
|
||||||
@@ -4764,7 +4764,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientZone
|
MClientInclude = MClientInclude and MClientZone
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Playernames then
|
if self.Filter.Playernames and MClientInclude then
|
||||||
local MClientPlayername = false
|
local MClientPlayername = false
|
||||||
local playername = MClient:GetPlayerName() or "Unknown"
|
local playername = MClient:GetPlayerName() or "Unknown"
|
||||||
--self:T(playername)
|
--self:T(playername)
|
||||||
@@ -4777,7 +4777,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientPlayername
|
MClientInclude = MClientInclude and MClientPlayername
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Callsigns then
|
if self.Filter.Callsigns and MClientInclude then
|
||||||
local MClientCallsigns = false
|
local MClientCallsigns = false
|
||||||
local callsign = MClient:GetCallsign()
|
local callsign = MClient:GetCallsign()
|
||||||
--self:I(callsign)
|
--self:I(callsign)
|
||||||
@@ -4790,7 +4790,7 @@ do -- SET_CLIENT
|
|||||||
MClientInclude = MClientInclude and MClientCallsigns
|
MClientInclude = MClientInclude and MClientCallsigns
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Functions then
|
if self.Filter.Functions and MClientInclude then
|
||||||
local MClientFunc = self:_EvalFilterFunctions(MClient)
|
local MClientFunc = self:_EvalFilterFunctions(MClient)
|
||||||
MClientInclude = MClientInclude and MClientFunc
|
MClientInclude = MClientInclude and MClientFunc
|
||||||
end
|
end
|
||||||
@@ -5554,7 +5554,7 @@ do -- SET_AIRBASE
|
|||||||
MAirbaseInclude = MAirbaseInclude and MAirbaseCoalition
|
MAirbaseInclude = MAirbaseInclude and MAirbaseCoalition
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MAirbaseInclude then
|
||||||
local MAirbaseCategory = false
|
local MAirbaseCategory = false
|
||||||
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
|
||||||
local AirbaseCategoryID = _DATABASE:GetCategoryFromAirbase( MAirbaseName )
|
local AirbaseCategoryID = _DATABASE:GetCategoryFromAirbase( MAirbaseName )
|
||||||
@@ -7900,7 +7900,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter coalitions.
|
-- Filter coalitions.
|
||||||
if self.Filter.Coalitions then
|
if self.Filter.Coalitions and MGroupInclude then
|
||||||
|
|
||||||
local MGroupCoalition = false
|
local MGroupCoalition = false
|
||||||
|
|
||||||
@@ -7914,7 +7914,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter categories.
|
-- Filter categories.
|
||||||
if self.Filter.Categories then
|
if self.Filter.Categories and MGroupInclude then
|
||||||
|
|
||||||
local MGroupCategory = false
|
local MGroupCategory = false
|
||||||
|
|
||||||
@@ -7928,7 +7928,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter countries.
|
-- Filter countries.
|
||||||
if self.Filter.Countries then
|
if self.Filter.Countries and MGroupInclude then
|
||||||
local MGroupCountry = false
|
local MGroupCountry = false
|
||||||
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
for CountryID, CountryName in pairs( self.Filter.Countries ) do
|
||||||
if country.id[CountryName] == MGroup:GetCountry() then
|
if country.id[CountryName] == MGroup:GetCountry() then
|
||||||
@@ -7939,7 +7939,7 @@ do -- SET_OPSGROUP
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Filter "prefixes".
|
-- Filter "prefixes".
|
||||||
if self.Filter.GroupPrefixes then
|
if self.Filter.GroupPrefixes and MGroupInclude then
|
||||||
|
|
||||||
local MGroupPrefix = false
|
local MGroupPrefix = false
|
||||||
|
|
||||||
|
|||||||
@@ -446,13 +446,15 @@ end
|
|||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:New(Path, Frequency, Modulation, Backend)
|
function MSRS:New(Path, Frequency, Modulation, Backend)
|
||||||
|
|
||||||
|
-- Inherit everything from BASE class.
|
||||||
|
local self=BASE:Inherit(self, BASE:New()) -- #MSRS
|
||||||
|
|
||||||
|
self:F( {Path, Frequency, Modulation, Backend} )
|
||||||
|
|
||||||
-- Defaults.
|
-- Defaults.
|
||||||
Frequency = Frequency or 143
|
Frequency = Frequency or 143
|
||||||
Modulation = Modulation or radio.modulation.AM
|
Modulation = Modulation or radio.modulation.AM
|
||||||
|
|
||||||
-- Inherit everything from BASE class.
|
|
||||||
local self=BASE:Inherit(self, BASE:New()) -- #MSRS
|
|
||||||
|
|
||||||
self.lid = string.format("%s-%s | ", "unknown", self.version)
|
self.lid = string.format("%s-%s | ", "unknown", self.version)
|
||||||
|
|
||||||
if not self.ConfigLoaded then
|
if not self.ConfigLoaded then
|
||||||
@@ -466,6 +468,7 @@ function MSRS:New(Path, Frequency, Modulation, Backend)
|
|||||||
self:SetCoalition()
|
self:SetCoalition()
|
||||||
self:SetLabel()
|
self:SetLabel()
|
||||||
self:SetVolume()
|
self:SetVolume()
|
||||||
|
self:SetBackend(Backend)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -483,6 +486,10 @@ function MSRS:New(Path, Frequency, Modulation, Backend)
|
|||||||
self:SetModulations(Modulation)
|
self:SetModulations(Modulation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Backend then
|
||||||
|
self:SetBackend(Backend)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.lid = string.format("%s-%s | ", self.name, self.version)
|
self.lid = string.format("%s-%s | ", self.name, self.version)
|
||||||
@@ -508,7 +515,7 @@ end
|
|||||||
-- @param #string Backend Backend used. Default is `MSRS.Backend.SRSEXE`.
|
-- @param #string Backend Backend used. Default is `MSRS.Backend.SRSEXE`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetBackend(Backend)
|
function MSRS:SetBackend(Backend)
|
||||||
|
self:F( {Backend=Backend} )
|
||||||
self.backend=Backend or MSRS.Backend.SRSEXE
|
self.backend=Backend or MSRS.Backend.SRSEXE
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -518,7 +525,7 @@ end
|
|||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetBackendGRPC()
|
function MSRS:SetBackendGRPC()
|
||||||
|
self:F()
|
||||||
self:SetBackend(MSRS.Backend.GRPC)
|
self:SetBackend(MSRS.Backend.GRPC)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -527,8 +534,8 @@ end
|
|||||||
--- Set `DCS-SR-ExternalAudio.exe` as backend to communicate with SRS.
|
--- Set `DCS-SR-ExternalAudio.exe` as backend to communicate with SRS.
|
||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetBackendSRSEXE(Backend)
|
function MSRS:SetBackendSRSEXE()
|
||||||
|
self:F()
|
||||||
self:SetBackend(MSRS.Backend.SRSEXE)
|
self:SetBackend(MSRS.Backend.SRSEXE)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -537,12 +544,14 @@ end
|
|||||||
--- Set the default backend.
|
--- Set the default backend.
|
||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
function MSRS.SetDefaultBackend(Backend)
|
function MSRS.SetDefaultBackend(Backend)
|
||||||
|
self:F( {Backend=Backend} )
|
||||||
MSRS.backend=Backend or MSRS.Backend.SRSEXE
|
MSRS.backend=Backend or MSRS.Backend.SRSEXE
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set DCS-gRPC to be the default backend.
|
--- Set DCS-gRPC to be the default backend.
|
||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
function MSRS.SetDefaultBackendGRPC()
|
function MSRS.SetDefaultBackendGRPC()
|
||||||
|
self:F()
|
||||||
MSRS.backend=MSRS.Backend.GRPC
|
MSRS.backend=MSRS.Backend.GRPC
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -558,6 +567,7 @@ end
|
|||||||
-- @param #string Path Path to the directory, where the sound file is located. Default is `C:\\Program Files\\DCS-SimpleRadio-Standalone`.
|
-- @param #string Path Path to the directory, where the sound file is located. Default is `C:\\Program Files\\DCS-SimpleRadio-Standalone`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetPath(Path)
|
function MSRS:SetPath(Path)
|
||||||
|
self:F( {Path=Path} )
|
||||||
|
|
||||||
-- Set path.
|
-- Set path.
|
||||||
self.path=Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
self.path=Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||||
@@ -570,7 +580,7 @@ function MSRS:SetPath(Path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Debug output.
|
-- Debug output.
|
||||||
self:T(string.format("SRS path=%s", self:GetPath()))
|
self:F(string.format("SRS path=%s", self:GetPath()))
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -587,6 +597,7 @@ end
|
|||||||
-- @param #number Volume Volume - 1.0 is max, 0.0 is silence
|
-- @param #number Volume Volume - 1.0 is max, 0.0 is silence
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVolume(Volume)
|
function MSRS:SetVolume(Volume)
|
||||||
|
self:F( {Volume=Volume} )
|
||||||
local volume = Volume or 1
|
local volume = Volume or 1
|
||||||
if volume > 1 then volume = 1 elseif volume < 0 then volume = 0 end
|
if volume > 1 then volume = 1 elseif volume < 0 then volume = 0 end
|
||||||
self.volume = volume
|
self.volume = volume
|
||||||
@@ -605,6 +616,7 @@ end
|
|||||||
-- @param #number Label. Default "ROBOT"
|
-- @param #number Label. Default "ROBOT"
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetLabel(Label)
|
function MSRS:SetLabel(Label)
|
||||||
|
self:F( {Label=Label} )
|
||||||
self.Label=Label or "ROBOT"
|
self.Label=Label or "ROBOT"
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -621,6 +633,7 @@ end
|
|||||||
-- @param #number Port Port. Default 5002.
|
-- @param #number Port Port. Default 5002.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetPort(Port)
|
function MSRS:SetPort(Port)
|
||||||
|
self:F( {Port=Port} )
|
||||||
self.port=Port or 5002
|
self.port=Port or 5002
|
||||||
self:T(string.format("SRS port=%s", self:GetPort()))
|
self:T(string.format("SRS port=%s", self:GetPort()))
|
||||||
return self
|
return self
|
||||||
@@ -638,6 +651,7 @@ end
|
|||||||
-- @param #number Coalition Coalition. Default 0.
|
-- @param #number Coalition Coalition. Default 0.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetCoalition(Coalition)
|
function MSRS:SetCoalition(Coalition)
|
||||||
|
self:F( {Coalition=Coalition} )
|
||||||
self.coalition=Coalition or 0
|
self.coalition=Coalition or 0
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -655,7 +669,7 @@ 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)
|
||||||
|
self:F( Frequencies )
|
||||||
self.frequencies=UTILS.EnsureTable(Frequencies, false)
|
self.frequencies=UTILS.EnsureTable(Frequencies, false)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -666,7 +680,7 @@ 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:AddFrequencies(Frequencies)
|
function MSRS:AddFrequencies(Frequencies)
|
||||||
|
self:F( Frequencies )
|
||||||
for _,_freq in pairs(UTILS.EnsureTable(Frequencies, false)) do
|
for _,_freq in pairs(UTILS.EnsureTable(Frequencies, false)) do
|
||||||
self:T(self.lid..string.format("Adding frequency %s", tostring(_freq)))
|
self:T(self.lid..string.format("Adding frequency %s", tostring(_freq)))
|
||||||
table.insert(self.frequencies,_freq)
|
table.insert(self.frequencies,_freq)
|
||||||
@@ -688,7 +702,7 @@ 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)
|
||||||
|
self:F( Modulations )
|
||||||
self.modulations=UTILS.EnsureTable(Modulations, false)
|
self.modulations=UTILS.EnsureTable(Modulations, false)
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
@@ -703,7 +717,7 @@ 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)
|
||||||
|
self:F( Modulations )
|
||||||
for _,_mod in pairs(UTILS.EnsureTable(Modulations, false)) do
|
for _,_mod in pairs(UTILS.EnsureTable(Modulations, false)) do
|
||||||
table.insert(self.modulations,_mod)
|
table.insert(self.modulations,_mod)
|
||||||
end
|
end
|
||||||
@@ -723,7 +737,7 @@ 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:F( {Gender=Gender} )
|
||||||
Gender=Gender or "female"
|
Gender=Gender or "female"
|
||||||
|
|
||||||
self.gender=Gender:lower()
|
self.gender=Gender:lower()
|
||||||
@@ -739,7 +753,7 @@ end
|
|||||||
-- @param #string Culture Culture, *e.g.* "en-GB".
|
-- @param #string Culture Culture, *e.g.* "en-GB".
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetCulture(Culture)
|
function MSRS:SetCulture(Culture)
|
||||||
|
self:F( {Culture=Culture} )
|
||||||
self.culture=Culture
|
self.culture=Culture
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -750,7 +764,7 @@ end
|
|||||||
-- @param #string Voice Voice.
|
-- @param #string Voice Voice.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVoice(Voice)
|
function MSRS:SetVoice(Voice)
|
||||||
|
self:F( {Voice=Voice} )
|
||||||
self.voice=Voice
|
self.voice=Voice
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -762,7 +776,7 @@ end
|
|||||||
-- @param #string Provider Provider. Default is as set by @{#MSRS.SetProvider}, which itself defaults to `MSRS.Provider.WINDOWS` if not set.
|
-- @param #string Provider Provider. Default is as set by @{#MSRS.SetProvider}, which itself defaults to `MSRS.Provider.WINDOWS` if not set.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVoiceProvider(Voice, Provider)
|
function MSRS:SetVoiceProvider(Voice, Provider)
|
||||||
|
self:F( {Voice=Voice, Provider=Provider} )
|
||||||
self.poptions=self.poptions or {}
|
self.poptions=self.poptions or {}
|
||||||
|
|
||||||
self.poptions[Provider or self:GetProvider()]=Voice
|
self.poptions[Provider or self:GetProvider()]=Voice
|
||||||
@@ -775,7 +789,7 @@ end
|
|||||||
-- @param #string Voice Voice. Default `"Microsoft Hazel Desktop"`.
|
-- @param #string Voice Voice. Default `"Microsoft Hazel Desktop"`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVoiceWindows(Voice)
|
function MSRS:SetVoiceWindows(Voice)
|
||||||
|
self:F( {Voice=Voice} )
|
||||||
self:SetVoiceProvider(Voice or "Microsoft Hazel Desktop", MSRS.Provider.WINDOWS)
|
self:SetVoiceProvider(Voice or "Microsoft Hazel Desktop", MSRS.Provider.WINDOWS)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -786,7 +800,7 @@ end
|
|||||||
-- @param #string Voice Voice. Default `MSRS.Voices.Google.Standard.en_GB_Standard_A`.
|
-- @param #string Voice Voice. Default `MSRS.Voices.Google.Standard.en_GB_Standard_A`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVoiceGoogle(Voice)
|
function MSRS:SetVoiceGoogle(Voice)
|
||||||
|
self:F( {Voice=Voice} )
|
||||||
self:SetVoiceProvider(Voice or MSRS.Voices.Google.Standard.en_GB_Standard_A, MSRS.Provider.GOOGLE)
|
self:SetVoiceProvider(Voice or MSRS.Voices.Google.Standard.en_GB_Standard_A, MSRS.Provider.GOOGLE)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -798,7 +812,7 @@ end
|
|||||||
-- @param #string Voice [Azure Voice](https://learn.microsoft.com/azure/cognitive-services/speech-service/language-support). Default `"en-US-AriaNeural"`.
|
-- @param #string Voice [Azure Voice](https://learn.microsoft.com/azure/cognitive-services/speech-service/language-support). Default `"en-US-AriaNeural"`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVoiceAzure(Voice)
|
function MSRS:SetVoiceAzure(Voice)
|
||||||
|
self:F( {Voice=Voice} )
|
||||||
self:SetVoiceProvider(Voice or "en-US-AriaNeural", MSRS.Provider.AZURE)
|
self:SetVoiceProvider(Voice or "en-US-AriaNeural", MSRS.Provider.AZURE)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -809,7 +823,7 @@ end
|
|||||||
-- @param #string Voice [AWS Voice](https://docs.aws.amazon.com/polly/latest/dg/voicelist.html). Default `"Brian"`.
|
-- @param #string Voice [AWS Voice](https://docs.aws.amazon.com/polly/latest/dg/voicelist.html). Default `"Brian"`.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetVoiceAmazon(Voice)
|
function MSRS:SetVoiceAmazon(Voice)
|
||||||
|
self:F( {Voice=Voice} )
|
||||||
self:SetVoiceProvider(Voice or "Brian", MSRS.Provider.AMAZON)
|
self:SetVoiceProvider(Voice or "Brian", MSRS.Provider.AMAZON)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -836,7 +850,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE Coordinate Origin of the transmission.
|
-- @param Core.Point#COORDINATE Coordinate Origin of the transmission.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetCoordinate(Coordinate)
|
function MSRS:SetCoordinate(Coordinate)
|
||||||
|
self:F( Coordinate )
|
||||||
self.coordinate=Coordinate
|
self.coordinate=Coordinate
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -847,7 +861,7 @@ end
|
|||||||
-- @param #string PathToCredentials Full path to the google credentials JSON file, e.g. "C:\Users\username\Downloads\service-account-file.json". Can also be the Google API key.
|
-- @param #string PathToCredentials Full path to the google credentials JSON file, e.g. "C:\Users\username\Downloads\service-account-file.json". Can also be the Google API key.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetGoogle(PathToCredentials)
|
function MSRS:SetGoogle(PathToCredentials)
|
||||||
|
self:F( {PathToCredentials=PathToCredentials} )
|
||||||
if PathToCredentials then
|
if PathToCredentials then
|
||||||
|
|
||||||
self.provider = MSRS.Provider.GOOGLE
|
self.provider = MSRS.Provider.GOOGLE
|
||||||
@@ -864,6 +878,7 @@ end
|
|||||||
-- @param #string APIKey API Key, usually a string of length 40 with characters and numbers.
|
-- @param #string APIKey API Key, usually a string of length 40 with characters and numbers.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetGoogleAPIKey(APIKey)
|
function MSRS:SetGoogleAPIKey(APIKey)
|
||||||
|
self:F( {APIKey=APIKey} )
|
||||||
if APIKey then
|
if APIKey then
|
||||||
|
|
||||||
self.provider = MSRS.Provider.GOOGLE
|
self.provider = MSRS.Provider.GOOGLE
|
||||||
@@ -893,6 +908,7 @@ end
|
|||||||
-- @param #string Provider
|
-- @param #string Provider
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetProvider(Provider)
|
function MSRS:SetProvider(Provider)
|
||||||
|
self:F( {Provider=Provider} )
|
||||||
self.provider = Provider or MSRS.Provider.WINDOWS
|
self.provider = Provider or MSRS.Provider.WINDOWS
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -914,21 +930,15 @@ end
|
|||||||
-- @param #string Region Region to use.
|
-- @param #string Region Region to use.
|
||||||
-- @return #MSRS.ProviderOptions Provider optionas table.
|
-- @return #MSRS.ProviderOptions Provider optionas table.
|
||||||
function MSRS:SetProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)
|
function MSRS:SetProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)
|
||||||
|
self:F( {Provider, CredentialsFile, AccessKey, SecretKey, Region} )
|
||||||
local option=MSRS._CreateProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)
|
local option=MSRS._CreateProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)
|
||||||
|
|
||||||
if self then
|
if self then
|
||||||
|
|
||||||
self.poptions=self.poptions or {}
|
self.poptions=self.poptions or {}
|
||||||
|
|
||||||
self.poptions[Provider]=option
|
self.poptions[Provider]=option
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
MSRS.poptions=MSRS.poptions or {}
|
MSRS.poptions=MSRS.poptions or {}
|
||||||
|
|
||||||
MSRS.poptions[Provider]=option
|
MSRS.poptions[Provider]=option
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return option
|
return option
|
||||||
@@ -942,7 +952,7 @@ end
|
|||||||
-- @param #string Region Region to use.
|
-- @param #string Region Region to use.
|
||||||
-- @return #MSRS.ProviderOptions Provider optionas table.
|
-- @return #MSRS.ProviderOptions Provider optionas table.
|
||||||
function MSRS._CreateProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)
|
function MSRS._CreateProviderOptions(Provider, CredentialsFile, AccessKey, SecretKey, Region)
|
||||||
|
self:F( {Provider, CredentialsFile, AccessKey, SecretKey, Region} )
|
||||||
local option={} --#MSRS.ProviderOptions
|
local option={} --#MSRS.ProviderOptions
|
||||||
|
|
||||||
option.provider=Provider
|
option.provider=Provider
|
||||||
@@ -960,7 +970,7 @@ end
|
|||||||
-- @param #string AccessKey Your API access key. This is necessary if DCS-gRPC is used as backend.
|
-- @param #string AccessKey Your API access key. This is necessary if DCS-gRPC is used as backend.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetProviderOptionsGoogle(CredentialsFile, AccessKey)
|
function MSRS:SetProviderOptionsGoogle(CredentialsFile, AccessKey)
|
||||||
|
self:F( {CredentialsFile, AccessKey} )
|
||||||
self:SetProviderOptions(MSRS.Provider.GOOGLE, CredentialsFile, AccessKey)
|
self:SetProviderOptions(MSRS.Provider.GOOGLE, CredentialsFile, AccessKey)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -973,7 +983,7 @@ end
|
|||||||
-- @param #string Region Your AWS [region](https://docs.aws.amazon.com/general/latest/gr/pol.html).
|
-- @param #string Region Your AWS [region](https://docs.aws.amazon.com/general/latest/gr/pol.html).
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetProviderOptionsAmazon(AccessKey, SecretKey, Region)
|
function MSRS:SetProviderOptionsAmazon(AccessKey, SecretKey, Region)
|
||||||
|
self:F( {AccessKey, SecretKey, Region} )
|
||||||
self:SetProviderOptions(MSRS.Provider.AMAZON, nil, AccessKey, SecretKey, Region)
|
self:SetProviderOptions(MSRS.Provider.AMAZON, nil, AccessKey, SecretKey, Region)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -985,7 +995,7 @@ end
|
|||||||
-- @param #string Region Your Azure [region](https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/regions).
|
-- @param #string Region Your Azure [region](https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/regions).
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetProviderOptionsAzure(AccessKey, Region)
|
function MSRS:SetProviderOptionsAzure(AccessKey, Region)
|
||||||
|
self:F( {AccessKey, Region} )
|
||||||
self:SetProviderOptions(MSRS.Provider.AZURE, nil, AccessKey, nil, Region)
|
self:SetProviderOptions(MSRS.Provider.AZURE, nil, AccessKey, nil, Region)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -1005,6 +1015,7 @@ end
|
|||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetTTSProviderGoogle()
|
function MSRS:SetTTSProviderGoogle()
|
||||||
|
self:F()
|
||||||
self:SetProvider(MSRS.Provider.GOOGLE)
|
self:SetProvider(MSRS.Provider.GOOGLE)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1013,6 +1024,7 @@ end
|
|||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetTTSProviderMicrosoft()
|
function MSRS:SetTTSProviderMicrosoft()
|
||||||
|
self:F()
|
||||||
self:SetProvider(MSRS.Provider.WINDOWS)
|
self:SetProvider(MSRS.Provider.WINDOWS)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1022,6 +1034,7 @@ end
|
|||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetTTSProviderAzure()
|
function MSRS:SetTTSProviderAzure()
|
||||||
|
self:F()
|
||||||
self:SetProvider(MSRS.Provider.AZURE)
|
self:SetProvider(MSRS.Provider.AZURE)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1030,6 +1043,7 @@ end
|
|||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:SetTTSProviderAmazon()
|
function MSRS:SetTTSProviderAmazon()
|
||||||
|
self:F()
|
||||||
self:SetProvider(MSRS.Provider.AMAZON)
|
self:SetProvider(MSRS.Provider.AMAZON)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -1039,7 +1053,7 @@ end
|
|||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:Help()
|
function MSRS:Help()
|
||||||
|
self:F()
|
||||||
-- Path and exe.
|
-- Path and exe.
|
||||||
local path=self:GetPath()
|
local path=self:GetPath()
|
||||||
local exe="DCS-SR-ExternalAudio.exe"
|
local exe="DCS-SR-ExternalAudio.exe"
|
||||||
@@ -1074,14 +1088,22 @@ end
|
|||||||
-- @param #number Delay Delay in seconds, before the sound file is played.
|
-- @param #number Delay Delay in seconds, before the sound file is played.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:PlaySoundFile(Soundfile, Delay)
|
function MSRS:PlaySoundFile(Soundfile, Delay)
|
||||||
|
self:F( {Soundfile, Delay} )
|
||||||
|
|
||||||
|
-- Sound file name.
|
||||||
|
local soundfile=Soundfile:GetName()
|
||||||
|
|
||||||
|
-- First check if text file exists!
|
||||||
|
local exists=UTILS.FileExists(soundfile)
|
||||||
|
if not exists then
|
||||||
|
self:E("ERROR: MSRS sound file does not exist! File="..soundfile)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, MSRS.PlaySoundFile, self, Soundfile, 0)
|
self:ScheduleOnce(Delay, MSRS.PlaySoundFile, self, Soundfile, 0)
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Sound file name.
|
|
||||||
local soundfile=Soundfile:GetName()
|
|
||||||
|
|
||||||
-- Get command.
|
-- Get command.
|
||||||
local command=self:_GetCommand()
|
local command=self:_GetCommand()
|
||||||
|
|
||||||
@@ -1102,15 +1124,14 @@ end
|
|||||||
-- @param #number Delay Delay in seconds, before the sound file is played.
|
-- @param #number Delay Delay in seconds, before the sound file is played.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:PlaySoundText(SoundText, Delay)
|
function MSRS:PlaySoundText(SoundText, Delay)
|
||||||
|
self:F( {SoundText, Delay} )
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, MSRS.PlaySoundText, self, SoundText, 0)
|
self:ScheduleOnce(Delay, MSRS.PlaySoundText, self, SoundText, 0)
|
||||||
else
|
else
|
||||||
|
|
||||||
if self.backend==MSRS.Backend.GRPC then
|
if self.backend==MSRS.Backend.GRPC then
|
||||||
|
|
||||||
self:_DCSgRPCtts(SoundText.text, nil, SoundText.gender, SoundText.culture, SoundText.voice, SoundText.volume, SoundText.label, SoundText.coordinate)
|
self:_DCSgRPCtts(SoundText.text, nil, SoundText.gender, SoundText.culture, SoundText.voice, SoundText.volume, SoundText.label, SoundText.coordinate)
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
-- Get command.
|
-- Get command.
|
||||||
@@ -1136,6 +1157,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE Coordinate Coordinate.
|
-- @param Core.Point#COORDINATE Coordinate Coordinate.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:PlayText(Text, Delay, Coordinate)
|
function MSRS:PlayText(Text, Delay, Coordinate)
|
||||||
|
self:F( {Text, Delay, Coordinate} )
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, MSRS.PlayText, self, Text, nil, Coordinate)
|
self:ScheduleOnce(Delay, MSRS.PlayText, self, Text, nil, Coordinate)
|
||||||
@@ -1171,6 +1193,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE Coordinate Coordinate.
|
-- @param Core.Point#COORDINATE Coordinate Coordinate.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:PlayTextExt(Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)
|
function MSRS:PlayTextExt(Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)
|
||||||
|
self:F( {Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate} )
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, MSRS.PlayTextExt, self, Text, 0, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)
|
self:ScheduleOnce(Delay, MSRS.PlayTextExt, self, Text, 0, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate)
|
||||||
@@ -1208,6 +1231,7 @@ end
|
|||||||
-- @param #number Delay Delay in seconds, before the message is played.
|
-- @param #number Delay Delay in seconds, before the message is played.
|
||||||
-- @return #MSRS self
|
-- @return #MSRS self
|
||||||
function MSRS:PlayTextFile(TextFile, Delay)
|
function MSRS:PlayTextFile(TextFile, Delay)
|
||||||
|
self:F( {TextFile, Delay} )
|
||||||
|
|
||||||
if Delay and Delay>0 then
|
if Delay and Delay>0 then
|
||||||
self:ScheduleOnce(Delay, MSRS.PlayTextFile, self, TextFile, 0)
|
self:ScheduleOnce(Delay, MSRS.PlayTextFile, self, TextFile, 0)
|
||||||
@@ -1253,6 +1277,7 @@ end
|
|||||||
-- @return #number Longitude (or 0 if no input coordinate was given).
|
-- @return #number Longitude (or 0 if no input coordinate was given).
|
||||||
-- @return #number Altitude (or 0 if no input coordinate was given).
|
-- @return #number Altitude (or 0 if no input coordinate was given).
|
||||||
function MSRS:_GetLatLongAlt(Coordinate)
|
function MSRS:_GetLatLongAlt(Coordinate)
|
||||||
|
self:F( {Coordinate=Coordinate} )
|
||||||
|
|
||||||
local lat=0.0
|
local lat=0.0
|
||||||
local lon=0.0
|
local lon=0.0
|
||||||
@@ -1284,6 +1309,7 @@ end
|
|||||||
-- @param Core.Point#COORDINATE coordinate Coordinate.
|
-- @param Core.Point#COORDINATE coordinate Coordinate.
|
||||||
-- @return #string Command.
|
-- @return #string Command.
|
||||||
function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, speed, port, label, coordinate)
|
function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, speed, port, label, coordinate)
|
||||||
|
self:F( {freqs, modus, coal, gender, voice, culture, volume, speed, port, label, coordinate} )
|
||||||
|
|
||||||
local path=self:GetPath()
|
local path=self:GetPath()
|
||||||
local exe="DCS-SR-ExternalAudio.exe"
|
local exe="DCS-SR-ExternalAudio.exe"
|
||||||
@@ -1356,82 +1382,83 @@ end
|
|||||||
-- @param #string command Command to executer
|
-- @param #string command Command to executer
|
||||||
-- @return #number Return value of os.execute() command.
|
-- @return #number Return value of os.execute() command.
|
||||||
function MSRS:_ExecCommand(command)
|
function MSRS:_ExecCommand(command)
|
||||||
|
self:F( {command=command} )
|
||||||
|
|
||||||
-- Skip this function if _GetCommand was not able to find the executable
|
-- Skip this function if _GetCommand was not able to find the executable
|
||||||
if string.find(command, "CommandNotFound") then return 0 end
|
if string.find(command, "CommandNotFound") then return 0 end
|
||||||
|
|
||||||
|
local batContent = command.." && exit"
|
||||||
|
-- Create a tmp file.
|
||||||
|
local filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".bat"
|
||||||
|
|
||||||
|
local script=io.open(filename, "w+")
|
||||||
|
script:write(batContent)
|
||||||
|
script:close()
|
||||||
|
|
||||||
|
self:T("MSRS batch file created: "..filename)
|
||||||
|
self:T("MSRS batch content: "..batContent)
|
||||||
|
|
||||||
|
local res=nil
|
||||||
|
if true then
|
||||||
|
|
||||||
local batContent = command.." && exit"
|
|
||||||
-- Create a tmp file.
|
-- Create a tmp file.
|
||||||
local filename=os.getenv('TMP').."\\MSRS-"..MSRS.uuid()..".bat"
|
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
||||||
|
|
||||||
local script=io.open(filename, "w+")
|
-- VBS script
|
||||||
script:write(batContent)
|
local script = io.open(filenvbs, "w+")
|
||||||
|
script:write(string.format('Dim WinScriptHost\n'))
|
||||||
|
script:write(string.format('Set WinScriptHost = CreateObject("WScript.Shell")\n'))
|
||||||
|
script:write(string.format('WinScriptHost.Run Chr(34) & "%s" & Chr(34), 0\n', filename))
|
||||||
|
script:write(string.format('Set WinScriptHost = Nothing'))
|
||||||
|
script:close()
|
||||||
|
self:T("MSRS vbs file created to start batch="..filenvbs)
|
||||||
|
|
||||||
|
-- Run visual basic script. This still pops up a window but very briefly and does not put the DCS window out of focus.
|
||||||
|
local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs)
|
||||||
|
|
||||||
|
-- Debug output.
|
||||||
|
self:T("MSRS execute VBS command="..runvbs)
|
||||||
|
|
||||||
|
-- Play file in 0.01 seconds
|
||||||
|
res=os.execute(runvbs)
|
||||||
|
|
||||||
|
-- Remove file in 1 second.
|
||||||
|
timer.scheduleFunction(os.remove, filename, timer.getTime()+1)
|
||||||
|
timer.scheduleFunction(os.remove, filenvbs, timer.getTime()+1)
|
||||||
|
self:T("MSRS vbs and batch file removed")
|
||||||
|
|
||||||
|
elseif false then
|
||||||
|
|
||||||
|
-- Create a tmp file.
|
||||||
|
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
||||||
|
|
||||||
|
-- VBS script
|
||||||
|
local script = io.open(filenvbs, "w+")
|
||||||
|
script:write(string.format('Set oShell = CreateObject ("Wscript.Shell")\n'))
|
||||||
|
script:write(string.format('Dim strArgs\n'))
|
||||||
|
script:write(string.format('strArgs = "cmd /c %s"\n', filename))
|
||||||
|
script:write(string.format('oShell.Run strArgs, 0, false'))
|
||||||
script:close()
|
script:close()
|
||||||
|
|
||||||
self:T("MSRS batch file created: "..filename)
|
local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs)
|
||||||
self:T("MSRS batch content: "..batContent)
|
|
||||||
|
|
||||||
local res=nil
|
-- Play file in 0.01 seconds
|
||||||
if true then
|
res=os.execute(runvbs)
|
||||||
|
|
||||||
-- Create a tmp file.
|
else
|
||||||
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
-- Play command.
|
||||||
|
command=string.format('start /b "" "%s"', filename)
|
||||||
|
|
||||||
-- VBS script
|
-- Debug output.
|
||||||
local script = io.open(filenvbs, "w+")
|
self:T("MSRS execute command="..command)
|
||||||
script:write(string.format('Dim WinScriptHost\n'))
|
|
||||||
script:write(string.format('Set WinScriptHost = CreateObject("WScript.Shell")\n'))
|
|
||||||
script:write(string.format('WinScriptHost.Run Chr(34) & "%s" & Chr(34), 0\n', filename))
|
|
||||||
script:write(string.format('Set WinScriptHost = Nothing'))
|
|
||||||
script:close()
|
|
||||||
self:T("MSRS vbs file created to start batch="..filenvbs)
|
|
||||||
|
|
||||||
-- Run visual basic script. This still pops up a window but very briefly and does not put the DCS window out of focus.
|
-- Execute command
|
||||||
local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs)
|
res=os.execute(command)
|
||||||
|
|
||||||
-- Debug output.
|
-- Remove file in 1 second.
|
||||||
self:T("MSRS execute VBS command="..runvbs)
|
timer.scheduleFunction(os.remove, filename, timer.getTime()+1)
|
||||||
|
|
||||||
-- Play file in 0.01 seconds
|
end
|
||||||
res=os.execute(runvbs)
|
|
||||||
|
|
||||||
-- Remove file in 1 second.
|
|
||||||
timer.scheduleFunction(os.remove, filename, timer.getTime()+1)
|
|
||||||
timer.scheduleFunction(os.remove, filenvbs, timer.getTime()+1)
|
|
||||||
self:T("MSRS vbs and batch file removed")
|
|
||||||
|
|
||||||
elseif false then
|
|
||||||
|
|
||||||
-- Create a tmp file.
|
|
||||||
local filenvbs = os.getenv('TMP') .. "\\MSRS-"..MSRS.uuid()..".vbs"
|
|
||||||
|
|
||||||
-- VBS script
|
|
||||||
local script = io.open(filenvbs, "w+")
|
|
||||||
script:write(string.format('Set oShell = CreateObject ("Wscript.Shell")\n'))
|
|
||||||
script:write(string.format('Dim strArgs\n'))
|
|
||||||
script:write(string.format('strArgs = "cmd /c %s"\n', filename))
|
|
||||||
script:write(string.format('oShell.Run strArgs, 0, false'))
|
|
||||||
script:close()
|
|
||||||
|
|
||||||
local runvbs=string.format('cscript.exe //Nologo //B "%s"', filenvbs)
|
|
||||||
|
|
||||||
-- Play file in 0.01 seconds
|
|
||||||
res=os.execute(runvbs)
|
|
||||||
|
|
||||||
else
|
|
||||||
-- Play command.
|
|
||||||
command=string.format('start /b "" "%s"', filename)
|
|
||||||
|
|
||||||
-- Debug output.
|
|
||||||
self:T("MSRS execute command="..command)
|
|
||||||
|
|
||||||
-- Execute command
|
|
||||||
res=os.execute(command)
|
|
||||||
|
|
||||||
-- Remove file in 1 second.
|
|
||||||
timer.scheduleFunction(os.remove, filename, timer.getTime()+1)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
@@ -1490,8 +1517,8 @@ end
|
|||||||
function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate)
|
function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate)
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
self:T("MSRS_BACKEND_DCSGRPC:_DCSgRPCtts()")
|
self:F("MSRS_BACKEND_DCSGRPC:_DCSgRPCtts()")
|
||||||
self:T({Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate})
|
self:F({Text, Frequencies, Gender, Culture, Voice, Volume, Label, Coordinate})
|
||||||
|
|
||||||
local options = {} -- #MSRS.GRPCOptions
|
local options = {} -- #MSRS.GRPCOptions
|
||||||
|
|
||||||
@@ -1517,6 +1544,7 @@ function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Lab
|
|||||||
|
|
||||||
-- Provider (win, gcloud, ...)
|
-- Provider (win, gcloud, ...)
|
||||||
local provider = self.provider or MSRS.Provider.WINDOWS
|
local provider = self.provider or MSRS.Provider.WINDOWS
|
||||||
|
self:F({provider=provider})
|
||||||
|
|
||||||
-- Provider options: voice, credentials
|
-- Provider options: voice, credentials
|
||||||
options.provider = {}
|
options.provider = {}
|
||||||
@@ -1549,10 +1577,9 @@ function MSRS:_DCSgRPCtts(Text, Frequencies, Gender, Culture, Voice, Volume, Lab
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _,freq in pairs(Frequencies) do
|
for _,freq in pairs(Frequencies) do
|
||||||
self:T("GRPC.tts")
|
self:F("Calling GRPC.tts with the following parameter:")
|
||||||
self:T(ssml)
|
self:F({ssml=ssml, freq=freq, options=options})
|
||||||
self:T(freq)
|
self:F(options.provider[provider])
|
||||||
self:T(options)
|
|
||||||
GRPC.tts(ssml, freq*1e6, options)
|
GRPC.tts(ssml, freq*1e6, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -523,6 +523,7 @@ ENUMS.ReportingName =
|
|||||||
Hawkeye = "E-2D",
|
Hawkeye = "E-2D",
|
||||||
Sentry = "E-3A",
|
Sentry = "E-3A",
|
||||||
Stratotanker = "KC-135",
|
Stratotanker = "KC-135",
|
||||||
|
Gasstation = "KC-135MPRS",
|
||||||
Extender = "KC-10",
|
Extender = "KC-10",
|
||||||
Orion = "P-3C",
|
Orion = "P-3C",
|
||||||
Viking = "S-3B",
|
Viking = "S-3B",
|
||||||
|
|||||||
Reference in New Issue
Block a user