Global Command: getSoundId: Difference between revisions

From The Official Visionaire Studio: Adventure Game Engine Wiki
EK (talk | contribs)
Created page with "Retrieve the id of a currently active audio file. Use the sound id to stop/pause/resume or edit the linked sound properties. {| class="ts" |- | style="width:15%" | Related fu..."
 
EK (talk | contribs)
No edit summary
 
Line 36: Line 36:
|-
|-
| integer
| integer
| Unique id referencing the requested sound or "-1" if the sound is not active.
| Unique id referencing the requested sound, or -1 if the sound is not active.
|}
|}



Latest revision as of 19:51, 4 May 2023

Retrieve the id of a currently active audio file. Use the sound id to stop/pause/resume or edit the linked sound properties.

Related functions getSoundProperty | setSoundProperty | startSound | stopSound | toggleSoundPause


Syntax

getSoundId(soundfile)


Parameters

Parameter Type Description
soundfile string Relative path to the audio file whose id you want to obtain. Add the "vispath:" prefix.


Return values

Type Description
integer Unique id referencing the requested sound, or -1 if the sound is not active.


Examples

Example 1: Store the sound id into a variable for later use.

local mySoundId = getSoundId("vispath:sounds/example.ogg")