58 lines
2.9 KiB
Markdown
58 lines
2.9 KiB
Markdown
# 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](https://en.wikipedia.org/wiki/WAV).
|
|
|
|
|
|
|
|
## `~_StaticSound_CreateSoundInstance(staticSoundID)`
|
|
|
|
**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](Functions-(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, bufferSizeInBytes)`
|
|
|
|
**Returns:** Number, a **sound instance ID**
|
|
|
|
|Argument |Datatype|Description |
|
|
|-------------------|--------|-----------------------------------------------------------|
|
|
|`filePath` |string |Path to the audio file to stream |
|
|
|`bufferSizeInBytes`|number |Stream buffer size, passing 0 will pick a sensible default.|
|
|
|
|
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-(Sound-Instances)) functions.
|
|
|
|
To prevent stutters the sound stream will be buffered, the size of the buffer is determined by the `bufferSizeInBytes` argument, passing 0 will pick a sensible default size.
|
|
|
|
?> Audio loaded by this function must be an [.ogg file](https://en.wikipedia.org/wiki/Ogg). 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 at the same time. |