FAudioGMS-Docs/docs/latest/Functions-(Loading-Sound-As...

2.5 KiB

Loading Sound Assets

~_StaticSound_LoadWAV(filePath)

Returns: Number, a static sound ID

Argument Datatype Description
filePath string Path to the audio file to load

Loads an audio file from disk into memory, ready to be instantiated as a sound instance and played. This is analogous to a GameMaker object that's used to spawn instances which can then be individually controlled.

?> Audio loaded by this function must be a .wav file.

 

~_StaticSound_CreateSoundInstance()

Returns: Number, a sound instance ID

Argument Datatype Description
staticSoundID number Static sound to instantiate, as created by FAudio_StaticSound_LoadWav()

Creates a sound instance that can be manipulated individually. Please see the Sound Instances page for commands specific to sound instances.

 

~_StaticSound_Destroy(staticSoundID)

Returns: N/A (undefined)

Argument Datatype Description
staticSoundID number Static sound to destroy, as created by FAudio_StaticSound_LoadWav()

Frees memory associated with the given static sound.

!> If you're sure you're not going to need a static sound again for a while, you should free its memory. This avoids memory leaks which can lead to nasty, unrecoverable crashes.

 

~_StreamingSound_LoadOGG(filePath)

Returns: Number, a sound instance ID

Argument Datatype Description
filePath string Path to the audio file to stream

Sets up an audio file on disk to be streamed. This is immediately converted into a sound instance ID that you can manipulate and play using the Sound Instance functions.

?> Audio loaded by this function must be an .ogg file. Please note that this function returns a sound instance ID (rather than a static sound ID).

!> It is not recommended to try to stream the same .ogg file twice.