local soundeffectsutil = require "soundeffectsutil"

function data()
return {
	tracks = {
		{ name = "vehicle/er1/drive.wav", refDist = 25.0 },
		{ name = "vehicle/train/wheels_ringing2.wav", refDist = 25.0 },
		{ name = "vehicle/train/brakes.wav", refDist = 25.0 }
	},
	events = {
		openDoors = { names = { "vehicle/er1/old_open_door.wav" }, refDist = 5.0 },	
		closeDoors = { names = { "vehicle/er1/old_close_door.wav" }, refDist = 5.0 },
		horn = { names = { "vehicle/er1/cp3_horn.wav" }, refDist = 50.0 },
	},

	updateFn = function (input)
		local speed01 = input.speed / input.topSpeed
		local refWeight = 40.0
		local axleRefWeight = 10.0
		
		return {
			tracks = {
				{ 
					gain = soundeffectsutil.sampleCurve({ { .0, .0 },	{ 0.15, 1.0 } }, speed01),
					pitch = soundeffectsutil.sampleCurve({ { .0, .14 }, { .05, .28 }, { .13, .42 }, { .25, .75 }, { .4, 0.95 }, { 0.7, 1.3 } }, speed01)
				},
				soundeffectsutil.squeal(input.speed, input.sideForce, input.maxSideForce),
				soundeffectsutil.brake(input.speed, input.brakeDecel, 0.5)
			},
			events = {
				openDoors = { gain = 1.0, pitch = 1.0 },
				closeDoors = { gain = 1.0, pitch = 1.0 }
			}
		}
	end
}
end 