Classes
Methods
channelPlaying(channelHandle) → {boolean}
Checks if a sound is still playing on a specific channel.
Parameters:
| Name | Type | Description |
|---|---|---|
channelHandle |
number | The channel handle. |
- Source:
Returns:
- Type
- boolean
channelVolume(channelHandle, volume)
Changes the volume of a currently playing sound on a specific channel.
Parameters:
| Name | Type | Description |
|---|---|---|
channelHandle |
number | The channel handle. |
volume |
number | The new volume (0.0 to 1.0). |
- Source:
freeSound(handle)
Releases a sound from memory.
Parameters:
| Name | Type | Description |
|---|---|---|
handle |
number | The sound handle to free. |
- Source:
loadSound(path) → {Object}
Loads a sound effect into memory.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | The path to the sound file. |
- Source:
Returns:
An object containing the sound handle and the loading promise.
- Type
- Object
loopSound(handle, loopopt)
Sets a sound to loop by default.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
handle |
number | The sound handle. | ||
loop |
boolean |
<optional> |
true | True to enable looping. |
- Source:
musicVolume(volume)
Sets the volume for the music stream.
Parameters:
| Name | Type | Description |
|---|---|---|
volume |
number | The volume (0.0 to 1.0). |
- Source:
pauseMusic()
Pauses the currently playing music.
- Source:
playMusic(path, loopopt)
Streams and plays a music file.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
path |
string | The path to the music file. | ||
loop |
boolean |
<optional> |
true | True to loop the music. |
- Source:
playSound(soundHandle) → {number}
Plays a loaded sound.
Parameters:
| Name | Type | Description |
|---|---|---|
soundHandle |
number | The sound handle to play. |
- Source:
Returns:
A channel handle for this playing instance of the sound, or 0 on failure.
- Type
- number
resumeMusic()
Resumes paused music.
- Source:
soundPan(handle, pan)
Sets the default stereo panning for a sound.
Parameters:
| Name | Type | Description |
|---|---|---|
handle |
number | The sound handle. |
pan |
number | The pan value (-1.0 is left, 0.0 is center, 1.0 is right). |
- Source:
soundPitch(handle, pitch)
Sets the default pitch for a sound.
Parameters:
| Name | Type | Description |
|---|---|---|
handle |
number | The sound handle. |
pitch |
number | The pitch multiplier (1.0 is normal). |
- Source:
soundVolume(handle, volume)
Sets the default volume for a sound.
Parameters:
| Name | Type | Description |
|---|---|---|
handle |
number | The sound handle. |
volume |
number | The volume (0.0 to 1.0). |
- Source:
stopChannel(channelHandle)
Stops a playing sound on a specific channel.
Parameters:
| Name | Type | Description |
|---|---|---|
channelHandle |
number | The channel handle returned by `playSound`. |
- Source:
stopMusic()
Stops the currently playing music and rewinds it to the beginning.
- Source: