"Soundscript" container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
(trigger)
Line 42: Line 42:
 
====trigger====
 
====trigger====
 
:Type: String
 
:Type: String
:Desc: The 'trigger' tag gives your sound a name that can allow it to be played from [[Scripting|TrainzScript]], animations and certain predefined events.
+
:Desc: The 'trigger' tag gives your sound a name that can allow it to be played from [[Scripting|TrainzScript]], 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)
  
 
====volume====
 
====volume====

Revision as of 03:53, 26 October 2013

A container type tag for defining asset sounds.

Contents

Supported Tags

Each soundscript subcontainer supports the following tags. Each tag is shown here with its default value.

 repeat-delay  0,0
 distance      50,150
 ambient       0
 attachment    ""
 nostartdelay  0
 priority      1
 trigger       ""
 volume        1
 sound
 {
 }

repeat-delay

Type: Decimal Pair
Desc: 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.

distance

Type: Decimal Pair
Desc: Distance range from the source, in meters, where the sound is audible. The minimum distance 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 defines a radius beyond which the game will 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 will cut off abruptly at that point. It is up to the content creator to choose an appropriate distance - smaller is better for performance.

ambient

Type: Boolean
Desc: 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.

attachment

Type: String
Desc: Point to attach the sound source to. Attachment points are specified in the mesh file during creation.

nostartdelay

Type: Boolean
Desc: 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.

priority

Type: Integer
Desc: 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.

trigger

Type: String
Desc: The 'trigger' tag gives your sound a name that can allow it to be played from TrainzScript, 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)

volume

Type: Decimal
Desc: Specifies the volume gain of the sound. Defaults to 1 (100%).

sound

Type: Container
Desc: Contains a list of the wave files to play. One will be picked at random from the list (assuming the list has more than one entry). The value of each tag in this container is the filename of a wave file - relative to the base directory of the asset, i.e. where the config file is. The key names within the list are not important. Trainz convention for lists like this is to numerically number each option from zero, and while it is strongly recommended to follow this convention, there is no technical requirement to do so.

Example Config.txt

Sample config.txt file for a map asset that has a different day and night background sounds:

 kind map
 kuid <KUID:0:0>
 soundscript
 {
   morning
   {
     ambient 1
     value-range 1, 0.1
     volume 0.3
     sound
     {
       0 ctry_day_1.wav
       1 ctry_day_2.wav
     }
   }
   night
   {
     ambient 1
     value-range 0, 0.9
     volume 0.3
     sound
     {
       0 night_loop.wav
     }
   }
 }


Categories

Personal tools