Update Functions-(Loading-Sound-Assets).md

main
Juju Adams 2021-11-02 22:08:03 +00:00
parent e82fcd593e
commit a5a8e8015e
1 changed files with 21 additions and 9 deletions

View File

@ -4,7 +4,11 @@
|Argument |Datatype|Description | |Argument |Datatype|Description |
|----------|--------|------------------------------------------------------| |----------|--------|------------------------------------------------------|
|`filePath`|string | | |`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).
   
@ -12,9 +16,11 @@
**Returns:** Number, a **sound instance ID** **Returns:** Number, a **sound instance ID**
|Argument |Datatype|Description | |Argument |Datatype|Description |
|---------------|--------|------------------------------------------------------| |---------------|--------|-------------------------------------------------------------------------|
|`staticSoundID`|number | | |`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.
   
@ -22,9 +28,13 @@
**Returns:** N/A (`undefined`) **Returns:** N/A (`undefined`)
|Argument |Datatype|Description | |Argument |Datatype|Description |
|---------------|--------|------------------------------------------------------| |---------------|--------|---------------------------------------------------------------------|
|`staticSoundID`|number | | |`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.
   
@ -34,8 +44,10 @@
|Argument |Datatype|Description | |Argument |Datatype|Description |
|----------|--------|------------------------------------------------------| |----------|--------|------------------------------------------------------|
|`filePath`|string | | |`filePath`|string |Path to the audio file to stream |
?> Please note that this function returns a sound instance ID rather than a static sound ID. 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.
?> 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. !> It is not recommended to try to stream the same .ogg file twice.