Client
Manipulate the sound
Play
local soundId = exports['mx-surround']:Play(soundId, url, coords, loop, volume, panner)Parameters
soundId?:
stringIf not provided, will be created automatically
url:
stringcoords?:
vector3If not provided, its means that the sound is not dynamic. So player can hear it from everywhere
loop?:
booleanvolume?:
numberOverride default volume (even if sound profile is enabled) (0.0 | 1.0)
panner?:
PannerNode
Returns
soundId | false
Play Async
Attach To Entity
Parameters
soundId:
stringnetworkId:
number
Detach From Entity
Parameters
soundId:
string
Attach To Player
Parameters
soundId:
stringplayerId:
number
Detach From Player
Parameters
soundId:
string
Stop
Parameters
soundId:
string
Pause
Parameters
soundId:
string
Resume
Parameters
soundId:
string
Destroy
Parameters
soundId:
string
Destroy All
Repeat
Parameters
soundId:
string
Add Filter
Parameters
soundId:
stringtype:
stringfilter:
{frequency: number, Q: number, gain:number}
Remove Filter
Parameters
soundId:
string
On Loop
Fires each time a looping sound wraps back to the start.
Parameters
soundId:
string | numberfn:
function
Register Deafening Sound
Register a loud event so it rings the listener's ears. Explosions already do this on their own; use it for anything else loud enough to deserve it.
Requires Config.Environment.Deafening.
Parameters
coords:
vector3Where the blast happened. Distance to the listener is taken into account
volume:
numberRough loudness on the game's own scale — an explosion is about
16.0
Set Duck Scene
Pull music and ambience down while something more important is happening. Phone calls, the pause menu and death already do this; use it for your own systems.
Several scenes can be active at once and the most aggressive one wins.
Parameters
name:
stringYour own id, so several systems can duck at the same time without fighting
apply:
number0.0-1.0, how hard this scene ducks.0.0clears the scene
options?:
tablefloor?:
number— gain at full apply. Default0.25rate?:
number— how fast it ramps in and out. Default2.0
Clear Duck Scene
Ends a scene started with setDuckScene.
Parameters
name:
string
To better manage sounds, see these three section
SetGetHandlersLast updated