VE Lua Documentation

Press F to search!

getEngineSoundData

Definition


-- @/lua/vehicle/sounds.lua:1378

local function getEngineSoundData()
  --windowOpen[0] = true
  local engineSoundData = {}
  local engineNameStrings = {}

  local engines = powertrain.getDevicesByCategory("engine")
  local count = 0
  for index, engine in ipairs(engines) do
    if engine.getSoundConfiguration then
      local soundConfig = engine:getSoundConfiguration()
      if soundConfig then
        for name, data in pairs(soundConfig) do
          local blendFileName = data.blendFile:match("^.+/(.+)$")
          local configName = string.format("%s (%s) -> %s", name, engine.name, blendFileName)
          engineSoundData[count] = {
            reference = name,
            data = data,
            fundamentalFrequencyRPMCoef = engine.fundamentalFrequencyRPMCoef,
            engineIndex = index
          }
          table.insert(engineNameStrings, configName)
          count = count + 1
        end
      end
    end
  end
  return engineSoundData, engineNameStrings
end

Callers

@/lua/ge/extensions/editor/engineAudioDebug.lua
    veh:queueLuaCommand([[
      local data, names = sounds.getEngineSoundData();
      data = serialize(data);

          local data, names = sounds.getEngineSoundData();
          data = serialize(data);