initEngineSound
Definition
-- @/lua/ge/extensions/core/sounds.lua:82
local function initEngineSound(vehicleId, engineId, jsonPath, nodeIdArray, noloadVol, loadVol)
local vehicle = scenetree.findObjectById(vehicleId)
if vehicle then
if type(nodeIdArray) ~= 'table' then
nodeIdArray = {nodeIdArray}
end
vehicle:engineSoundInit(engineId, jsonPath, nodeIdArray, noloadVol or 1, loadVol or 1)
vehicle:engineSoundParameterList(engineId, {wet_level = 0, dry_level = 1})
end
end
Callers
@/lua/vehicle/powertrain/combustionEngine.lua
local function initEngineSound(device, soundID, samplePath, engineNodeIDs, offLoadGain, onLoadGain, reference)
device.soundConfiguration[reference] = device.soundConfiguration[reference] or {}
obj:queueGameEngineLua(string.format("core_sounds.initEngineSound(%d,%d,%q,%s,%f,%f)", objectId, soundID, samplePath, serialize(engineNodeIDs), offLoadGain, onLoadGain))
end
local engineNodeIDs = {device.engineNodeID} --Hardcode intake sound location to a single node, no need for multiple
device:initEngineSound(device.engineSoundID, samplePath, engineNodeIDs, offLoadGain, onLoadGain, "engine")
@/lua/vehicle/powertrain/electricMotor.lua
local function initEngineSound(device, soundID, samplePath, engineNodeIDs, offLoadGain, onLoadGain, reference)
device.soundConfiguration[reference] = device.soundConfiguration[reference] or {}
device.soundConfiguration[reference].blendFile = samplePath
obj:queueGameEngineLua(string.format("core_sounds.initEngineSound(%d,%d,%q,%s,%f,%f)", objectId, soundID, samplePath, serialize(engineNodeIDs), offLoadGain, onLoadGain))
local samplePath = sampleFolder .. sampleName .. ".sfxBlend2D.json"
device:initEngineSound(device.engineSoundID, samplePath, {device.engineNodeID}, offLoadGain, onLoadGain, "motor")