buildOptionHelpers
Definition
-- @/lua/ge/extensions/core/settings/audio.lua:47
local function buildOptionHelpers()
local o = {}
-- SettingsAudioProvider
o.AudioProvider = {
get = function() return TorqueScriptLua.getVar('$pref::SFX::providerName') end,
set = function ( value )
TorqueScriptLua.setVar( '$pref::SFX::providerName', value )
createAudioProviderDevice()
end,
getModes = function()
local keys = {}
local values = {}
local added = {}
local deviceList = be:sfxGetAvailableDevices()
local entries = string.match( deviceList, '(.*)\n')
if entries ~= nil then
entries = split( entries, '\n' )
else
entries = {}
end
for k, v in ipairs(entries) do
local record = split( v, '\t')
--dump(record)
local provider = record[1]
if provider ~= '' and not provider:upper():find('NULL') and not added[provider] then
table.insert(keys, provider)
table.insert(values, provider)
added[provider] = true
end
end
return {keys=keys, values=values}
end
}
-- SettingsAudioMasterVol
o.AudioMasterVol = {
get = function()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelMaster'))
end,
set = function(value)
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelMaster', value)
end
}
-- SettingsAudioPowerVol
o.AudioPowerVol = {
get = function()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelPower'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelPower', value)
end
}
-- SettingsAudioForcedInductionVol
o.AudioForcedInductionVol = {
get = function()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelForcedInduction'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelForcedInduction', value)
end
}
-- SettingsAudioTransmissionVol
o.AudioTransmissionVol = {
get = function()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelTransmission'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelTransmission', value)
end
}
-- SettingsAudioSuspensionVol
o.AudioSuspensionVol = {
get = function()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelSuspension'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelSuspension', value)
end
}
-- AudioSurfaceVol
o.AudioSurfaceVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelSurface'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelSurface', value)
end
}
-- AudioCollisionVol
o.AudioCollisionVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelCollision'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelCollision', value)
end
}
-- AudioAeroVol
o.AudioAeroVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelAero'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelAero', value)
end
}
-- AudioEnvironmentVol
o.AudioEnvironmentVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelEnvironment'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelEnvironment', value)
end
}
-- AudioMusicVol
o.AudioMusicVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelMusic'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelMusic', value)
end
}
-- SettingsAudioUiVol
o.AudioUiVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelUi'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelUi', value)
end
}
-- AudioOtherVol
o.AudioOtherVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelOther'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelOther', value)
end
}
-- AudioLfeVol
o.AudioLfeVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelLfe'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelLfe', value)
end
}
-- AudioIntercomVol
o.AudioIntercomVol = {
get = function ()
return tonumber(TorqueScriptLua.getVar('$pref::SFX::AudioChannelIntercom'))
end,
set = function ( value )
value = clamp(value, 0.0, 1.0)
Engine.Audio.setChannelVolume('AudioChannelIntercom', value)
end
}
-- AudioEnableStereoHeadphones
o.AudioEnableStereoHeadphones = {
enabled = false,
get = function()
return o.AudioEnableStereoHeadphones.enabled
end,
set = function( enabled )
if o.AudioEnableStereoHeadphones.enabled ~= enabled then
TorqueScriptLua.setVar('$pref::SFX::enableHeadphonesMode', enabled)
o.AudioEnableStereoHeadphones.enabled = enabled
core_audio.triggerBankHotloading()
if o.AudioMasterVol then o.AudioMasterVol.set(o.AudioMasterVol.get() or 0) end
if o.AudioInterfaceVol then o.AudioInterfaceVol.set(o.AudioInterfaceVol.get() or 0) end
if o.AudioUiVol then o.AudioUiVol.set(o.AudioUiVol.get() or 0) end
if o.AudioAmbienceVol then o.AudioAmbienceVol.set(o.AudioAmbienceVol.get() or 0) end
if o.AudioMusicVol then o.AudioMusicVol.set(o.AudioMusicVol.get() or 0) end
end
end
}
audioOptions = o
return o
end
Callers
@/lua/ge/extensions/core/settings/rally.lua
local function buildOptionHelpers()
local o = {}
if not rallyOptions then
buildOptionHelpers()
end
@/lua/ge/extensions/core/settings/settings.lua
extensions.load({"core_settings_graphic","core_settings_audio","core_settings_rally"})
tableMerge(options, core_settings_graphic.buildOptionHelpers())
tableMerge(options, core_settings_audio.buildOptionHelpers())
tableMerge(options, core_settings_graphic.buildOptionHelpers())
tableMerge(options, core_settings_audio.buildOptionHelpers())
tableMerge(options, core_settings_rally.buildOptionHelpers())
tableMerge(options, core_settings_audio.buildOptionHelpers())
tableMerge(options, core_settings_rally.buildOptionHelpers())
-- add C++ propagation wherever possible
@/lua/ge/extensions/core/settings/graphic.lua
local function buildOptionHelpers()
local o = {}