GE Lua Documentation

Press F to search!

setEngineSoundParameter

Definition


-- @/lua/ge/extensions/core/sounds.lua:111

local function setEngineSoundParameter(vehicleId, engineId, paramName, paramValue)
  local vehicle = scenetree.findObjectById(vehicleId)
  if not vehicle then return end
  vehicle:engineSoundParameter(engineId, paramName, paramValue)
end

Callers

@/lua/vehicle/powertrain/combustionEngine.lua
    device.compressionBrakeCoefActual = compressionBrakeCoefAdjusted
    device:setEngineSoundParameter(device.engineSoundIDExhaust, "compression_brake_coef", device.compressionBrakeCoefActual, "exhaust")
  end
    device.antiLagCoefActual = antiLagCoefAdjusted
    device:setEngineSoundParameter(device.engineSoundIDExhaust, "triggerAntilag", device.antiLagCoefActual, "exhaust")
    device.turbocharger.setAntilagCoef(device.antiLagCoefActual)
  --local currentCombustionPowerkW = device.combustionTorque * device.outputAV1 * 0.001
  --device:setEngineSoundParameter(device.engineSoundIDExhaust, "currentPower", currentCombustionPowerkW, "exhaust")
  --device:setEngineSoundParameter(device.engineSoundID, "currentPower", currentCombustionPowerkW, "engine")
  --device:setEngineSoundParameter(device.engineSoundIDExhaust, "currentPower", currentCombustionPowerkW, "exhaust")
  --device:setEngineSoundParameter(device.engineSoundID, "currentPower", currentCombustionPowerkW, "engine")
  ---end temp code---
--it also does not update starter sound params
local function setEngineSoundParameter(device, soundID, paramName, paramValue, reference)
  device.soundConfiguration[reference] = device.soundConfiguration[reference] or {}
  params[paramName] = paramValue
  obj:queueGameEngineLua(string.format("core_sounds.setEngineSoundParameter(%d,%d,%q,%f)", objectId, soundID, paramName, paramValue))
end