Global Command: setSoundProperty

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Redirected from SetSoundProperty)

Set properties of a sound.

Related functions getSoundId | getSoundProperty | startSound | stopSound | toggleSoundPause


Syntax

setSoundProperty(soundId, flags)


Parameters

Parameter Type/Structure Description
soundId integer Id of the sound to set the properties.
flags table flags = 1 indicates flags table
balance (int) Set left/right audio balance value in the range of -100 (100% left channel) to 100 (100% right channel).
loop (bool) Set to true to loop the sound.
offset (int) Set the playtime position in milliseconds.
volume (int) Set the volume in the range of 0 (mute) to 100 (full volume).


Return values

Type Description
boolean True if properties were set successfully, false if setting failed.


Examples

Example 1: Set the properties of an active sound.

-- Sound id can only be retrieved if the sound is active
local mySoundId = getSoundId("vispath:sounds/example.ogg")

setSoundProperty(mySoundId, {flags=1, balance=20, loop=true, offset=100, volume=80})