C++
kind map
soundscript
{
morning
{
ambient 1
value-range 1, 0.1
volume 0.3
sound
{
0 "sound_day_1.wav"
1 "sound_day_2.wav"
}
}
night
{
ambient 1
value-range 0, 0.9
volume 0.3
sound
{
0 "night_sound_loop.wav"
}
}
}
Display More
DEFAULT | ||
---|---|---|
1 ambient | 0 | If true this is an 'ambient' sound, ambient sounds are played in 2D and do not make use of 3D positioning in the world other than to affect volume. Unlike positional sounds, ambient sounds may be stereo. |
2 attachment | Point to attach the sound source to. Attachment points are specified in the mesh file during creation. | |
3 distance | 50,150 | The minimum distance (first value, in meters) defines the radius within which the sound remains at 100% volume. Beyond that distance, the sound volume will begin to decay naturally. The maximum distance (second value, in meters) defines a radius beyond which the game need no longer play the sound. This does not mean that the sound will fade to zero by the maximum distance, but rather that the sound may cut off abruptly beyond that point. It is up to the content creator to choose an appropriate maximum distance - smaller is better for performance, but overly small values may result in the sound audibly cutting off. Many Trainz editions ignore the configured maximum distance value and instead perform their own optimized calculation of the appropriate value. |
4 nostartdelay | 0 | If added and true this tag specifies that the sound will play immediately once triggered. By default sounds have a random start delay between 0 & 4 seconds. Start delay should be left active in most cases, as turning it off may cause significant audio artifacts when several identical sounds are in proximity. |
5 priority | 1 | Sets the priority of the sound, if their are not enough sound channels available higher priority sounds will be played first. Defaults to 1, can be negative. |
6 repeat-delay | 0,0 | Time range (in seconds) to delay, after the sound finishes playing, before playing the sound again. To set a constant delay either set both these values the same or only provide one of them, otherwise a random value between them will be chosen. When used with a trigger event (see the 'trigger' tag), a positive value indicates that the sound should not repeat, but should wait until triggered again. |
7 sound | Contains list of the sound files to play. If the list has more than one entry then one file will be picked at random from the list. The value of each tag in this container is the filename of a WAV sound file. Filenames are relative to the base directory of the asset, i.e. relative to the location of the config file. Sampling rate can be 22kHz (22,050Hz) or 44kHz (44,100Hz). The higher sampling rate doubles the size of the file for no significant improvement in quality, and is not recommended. For some purposes there are additional requirements - for instance directional sounds must be mono. | |
8 sound-asset | The asset to source the sound files from. Allows the creation of "sound library" assets, so that sound files can be shared between multiple other assets. Defaults to the current asset. | |
9 trigger | The 'trigger' tag gives your sound a name that can allow it to be played from TrainzScript (see: Class MapObject), animations and certain predefined events. (At least one of these "predefined events" is to use the word "toggle" when including a soundscript container in the config.txt of a "MOjunction". This will make the sound fire each time the turnout is switched) | |
10 value-range | 0,0 | 2 numbers, where the numbers are not the same, which set the start and end times for the sound to play. Midnight is 0.5, midday = 0.0 or 1.0. (TBD. This is a bit vague.) |
11 volume | 1 | Specifies the volume gain of the sound. Defaults to 1 (100%). |