Type Sound

Sound

Methods

isPlaying() Checks if the sound is playing
isValid() Checks if the given sound is valid.
play() Plays the sound.
setLevel( level ) Sets the sound level.
setPitch( pitch, delta ) Sets the sound pitch
setVolume( vol, delta ) Sets the sound volume
stop( fade ) Stops or fades out the sound.


Methods

Sound:isPlaying()
Checks if the sound is playing

Environment:

Shared

Return value:

    (boolean) True if the sound is playing, false otherwise.
Sound:isValid()
Checks if the given sound is valid.

Environment:

Shared

Return value:

    (boolean) True if the sound is valid, false otherwise.
Sound:play()
Plays the sound.

Environment:

Shared
Sound:setLevel( level )
Sets the sound level. This determines the sound attenuation. Only works when the sound is not playing. See https://developer.valvesoftware.com/wiki/Soundscripts#SoundLevel for values and more info (use decibel value from the 'code' column, not the actual enum or 'value' column).

Environment:

Shared

Parameters:

  • level: The sound level to set (between 10 and 511).
Sound:setPitch( pitch, delta )
Sets the sound pitch

Environment:

Shared

Parameters:

  • pitch: The sound pitch as a percent from 0 to 255
  • delta: (Optional) The transition time between the current pitch and the new one (in seconds).
Sound:setVolume( vol, delta )
Sets the sound volume

Environment:

Shared

Parameters:

  • vol: Volume as a percent between 0 and 1
  • delta: (Optional) The transition time between the current volume and the new one (in seconds).
Sound:stop( fade )
Stops or fades out the sound.

Environment:

Shared

Parameters:

  • fade: (Optional) Time, in seconds, to fade out the sound. Not given = stop immediately

Valid XHTML 1.0!