Skip to content

soundset

Source: base/tealdef/scripts/soundset.d.tl

Notes

Types used by sound-set update scripts (see /scripts/soundset_default.script.tl): the output object that receives track and event gain/pitch values, and the parameter records of custom and curve-based update functions.

SoundTransfOutput

record global base/tealdef/scripts/soundset.d.tl:4

global record SoundTransfOutput

Sound Transformation output, which contains user transformations of events and tracks from transformation lua scripts

Functions

addTrack(soundTransfOutput : SoundTransfOutput, gain : number, pitch : number) base/tealdef/scripts/soundset.d.tl:5

Call as soundTransfOutput:addTrack(…) (method)

Notes

Sets gain and pitch of the next sound track of the sound set.

Parameter Type Description
soundTransfOutput SoundTransfOutput
gain number Volume factor.
pitch number Pitch factor (1 = unchanged).

Details

Tracks are filled in order; the default script notes that the order matters for steam train chuffs.

addEvent(soundTransfOutput : SoundTransfOutput, event : string, gain : number, pitch : number) base/tealdef/scripts/soundset.d.tl:6

Call as soundTransfOutput:addEvent(…) (method)

Notes

Sets gain and pitch of the named sound event.

Parameter Type Description
soundTransfOutput SoundTransfOutput
event string Event key from the sound set.
gain number Volume factor.
pitch number Pitch factor.

triggerEvent(soundTransfOutput : SoundTransfOutput, event : string, gain : number, pitch : number) base/tealdef/scripts/soundset.d.tl:7

Call as soundTransfOutput:triggerEvent(…) (method)

Notes

Triggers the named sound event once with the given gain and pitch.

Parameter Type Description
soundTransfOutput SoundTransfOutput
event string Event key from the sound set.
gain number Volume factor.
pitch number Pitch factor.

CustomUpdateScript

record global base/tealdef/scripts/soundset.d.tl:10

global record CustomUpdateScript

Notes

Script reference for a Custom sound update function that drives a track.

Functions

updateFn(result : GainPitch, customParams : any, currentInfoParams : {string : {string : number}}) base/tealdef/scripts/soundset.d.tl:11

Notes

Computes gain and pitch for a track and writes them into result.

Parameter Type Description
result GainPitch Output, prefilled with gain 1 and pitch 1.
customParams any The customParams given in the sound set.
currentInfoParams {string : {string : number}} Current transformator info (TransformatorParams.currentInfo) as nested tables of numbers.

CustomUpdateEventScript

record global base/tealdef/scripts/soundset.d.tl:13

global record CustomUpdateEventScript

Notes

Script reference for a Custom sound update function that triggers an event.

Functions

updateFn(result : GainPitchTrigger, customParams : any, currentInfoParams : {string : {string : number}}, previousInfoParams : {string : {string : number}}) base/tealdef/scripts/soundset.d.tl:14

Notes

Decides whether to trigger the event and with which gain and pitch.

Parameter Type Description
result GainPitchTrigger Output, prefilled with gain 1, pitch 1 and trigger = false; set trigger = true to fire the event.
customParams any The customParams given in the sound set.
currentInfoParams {string : {string : number}} Current transformator info as nested tables of numbers.
previousInfoParams {string : {string : number}} The info of the previous step, to detect changes.

GainPitch

record global base/tealdef/scripts/soundset.d.tl:17

global record GainPitch

Notes

Gain and pitch of one sound track or event.

Fields

Name Type Description
gain number Volume factor.
pitch number Pitch factor (1 = unchanged).

GainPitchTrigger

record global base/tealdef/scripts/soundset.d.tl:22

global record GainPitchTrigger

Notes

Gain and pitch of a sound event plus whether to trigger it now.

Fields

Name Type Description
gain number Volume factor.
pitch number Pitch factor.
trigger boolean True to trigger the event in this step.

SampleCurveParams

record global base/tealdef/scripts/soundset.d.tl:28

global record SampleCurveParams

Notes

Parameters of the SampleCurve sound update function, which reads values from the transformator info and maps them through curves.

Fields

Name Type Description
gainCurve {{number, number}} List of {x, y} nodes mapping the input value to gain.
pitchCurve {{number, number}} List of {x, y} nodes mapping the input value to pitch.
gainScriptingInfoKey string Key of the info table in currentInfo (e.g. vehicle) that holds the gain input.
gainParamName string Name of the value in that table used as gain input (e.g. speed).
pitchScriptingInfoKey string Key of the info table in currentInfo that holds the pitch input.
pitchParamName string Name of the value in that table used as pitch input.