-
Notifications
You must be signed in to change notification settings - Fork 7
Audio
CCL will automatically add the basic audio to your car (wheels, brakes, collisions...).
Locomotives will also include those sounds automatically.
For locomotives (slugs included), you will need to create an audio prefab. Each child of this prefab should be for 1 sound.
Clips are single use sounds that happen on certain events. For these, you use an AudioClipPortReader component. You can use all clips together on the same GameObject.
Examples of usage are:
- Turning off a diesel engine
- Contactors changing on the TMs
- Compressor finished charging reservoirs
These are used for any sounds that are constantly affected by ports.
Layered audio uses layers for complex output. The DE6's engine at idle has 3 layers, the engine itself, the shaft, and the compressor's whine.
Each layer has its own audio source. Position them where you want the sound to come from.
Each sound source you want affected by the doppler effect needs to have a component named DopplerProxy.
To actually affect the LayeredAudioProxy component, you'll need LayeredAudioPortReaderProxy components on the same object. Multiple can affect the same audio.
It is also possible to simply use an audio system from one of the base game's locomotives. Using the component CopyVanillaAudioSystem, you only need to position the GameObject where you want the sound to come from, and assign the correct port(s).
Some sound systems with multiple layers allow you to also change the position of each of them (like the DE6's mentioned above).
Cylinder cocks require a bit more setup than your usual sound, and have a dedicated component.
It is important to note the order in which you assing each cylinder's audio. The first cylinder should have its piston at one of the ends.

Warning
The GameObjects assigned must have either a LayeredAudioProxy or a CopyVanillaAudioSystem!