global_soundPan.scr

Dependencies

None.

Function

Randomly pick a sound from a passed in list, and then pan that sound around as it plays.

How To Use

Call the Init function to initialize the system. Use the AddSound function to input a list of sounds to choose from. YOU MUST ADD ALL THE SOUNDS BEFORE RUNNING THE SYSTEM! If a sound is added after the system is running, it could cause some timing issues and bork the whole thing. Then call the start function to begin running the system, call the stop function to hault the system.

There should only be ONE of these systems initialized / running per level! Initializing / running multiple systems will cause weird and unexpected behavior!

External Functions

globalSoundPan_Init()

Purpose:
Initializes the system so it can function

Parms:
None.

globalSoundPan_AddSound( _sound, _channel, _volume, _mindist, _chance, _length, _offset, _pause )

Purpose:
Add sounds into the system. Must be done BEFORE the system is running.

    Parms:
  • _sound (string)
    Path of the sound.

  • _channel (float)
    The channel to play the sound on, should be 5 for most cases.

  • _volume (float)
    0 - 1 scale of how loud it should play, 1 being the loudest.

  • _mindist (float)
    Distance before it starts to fall off.

  • _chance (float)
    0 - 1 chance of the sound playing when chosen, 1 means 'always'.

  • _length (float)
    Amount of time the panner should be moving (in general should match the approx length of the sound file).

  • _offset (float)
    Distance for the panner to move.

  • _pause (float)
    Number of seconds to wait before choosing another sound.

globalSoundPan_Start()

Purpose:
Begins running the system

Parms:
None.

globalSoundPan_Stop()

Purpose:
Stops running the system

Parms:
None.