SlashCo Wiki

SoundData

SoundData

Description

Table structure used for SlashCo.AudioSystem.PlaySound

Parameters

string soundPath

This is the only required field.
the sound path for the sound to play

number soundLevel

used to calculate a distance for when the sound fades and cannot be heard from

string identifier

the identifier of the sound, if nil it will use the soundPath field as the identifier

number startTick

the tick in which the sound was started, this value is used to synchronize the sound for all players. Defaults to the current tick

Entity entity

the entity the channel should follow, defaults to the world entity

number volume

the volume of the sound, defaults to 1

boolean looping

if the sound should be looped or not, defaults to false

function callback

the callback function that is called when the channel was created. The channel is given to the callback as the first argument

number minDistance

the minimum distance for the sound to start fading

number maxDistance

the maximum distance after which the sound cannot be heard anymore

number startDistance

the distance at which the sound should begin to be hearable, default 0. Close up the sound is fully audible. This allows you to make sounds only audible at a certain distance, meaning if you're closer than this distance, it cannot be heard

number startEndDistance

the distance at which the sound should be fully audible, default 0

Vector position

a position to play the sound from. If an entity is set it will override this position, however if the entity has not networked yet this ensures the sound starts at the correct position

string modes

any additional modes to pass to SlashCo.AudioSystem.CreateChannel

number playbackRate

the sound playback rate

boolean noplay

won't automatically play the sound

string group

if set, a hook is called allowing you to add a hook that is executed when a sound is played:
hook.Add("SlashCO:AudioSystem:PlaySound:ExampleGroup", "Example", function(soundData, channel) end)

boolean deleteWhenDone

if true, the channel is deleted once the sound finished playing. This ignores the looping flag and still stops it

For sounds played serverside, this will always be set to true when looping is false.

number fadeIn

how many seconds it takes for the sound to fade in at the start

number fadeOut

how many seconds before the ending it should start to fade out, and when it faded out the channel is destroyed

number fadeOutStart

how many seconds after the sound starts it should begin to fade out. Use a negative number to use a time based off the end of the sound instead of the start

boolean forceMono

forces the sound to play as mono. Preferably use forceStereo since it won't reduce sound quality

boolean forceStereo

forces the sound to play as stereo. This does not truly force stereo, but removes mono or 3D flags if they were set

boolean noWorldSpace

if set it will use the entity's EyePos instead of falling back to WorldSpaceCenter

boolean dynamicPan

if set it will calculate the pan for the channel, giving the sound a fake 3D effect

string fallbackSoundPath

the fallback sound when the bound ConVar is disabled

string boundConVar

a ConVar the sound is bound to. When the ConVar is false it will instead play fallbackSoundPath

boolean disableUniqueToEntity

if set, the entity index is not added to the identifier, allowing the sound to only be played once globally instead of once per entity

boolean disableAutoRemove

if set, the channel won't be removed after the entity attached to the channel is removed

boolean raytraced

if set, traces are used to change the volume and position based on the environment. Experimental and performance intensive

string modifyGroup

a string containing all channel groups that should be modified while this channel is playing

number modifyGroupVolumeMult

the volume multiplier that should be enforced onto all channels in modifyGroup

number modifyGroupVolumeFadeTime

not implemented. Time in seconds for the volume to fade to the enforced multiplier. Clamped between 0 and 30

table pulseEffect

a table for the pulse effect. This feature is still experimental and should not be used

Entity pulseEffect.entity

an entity that should pulse

string pulseEffect.entityClass

the class of all entities that should pulse, such as sc_gascan

number pulseEffect.frequency

the sound frequency that should be checked for. Currently unused

boolean isServerside

internal field set if the sound was sent by the server

number sendToTeam

to which team the sound should be sent to.
Important Internally this just sets sendToEntity with the table of players.

table or Entity sendToEntity

The table or the player to send the sound to