Global Command: getSoundId

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 20:19, 4 May 2023 by 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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")