The soundinfo( function returns a dictionary that contains all of the properties of a sound.
Parameters
This function has one parameter:identifier – identifier of the sound (must have been set up with the PlaySound statement).
Description
This function returns a dictionary that contains all of the properties of the specified sound. You can then use these functions to extract the property values:
These are the properties returned by this function:
Identifier – the identifier of the sound. (This is a bit redundant since you already had to specify the identifier to get these results.)
Code – the code that will be run when the sound is finished (if any).
Paused – true/false (boolean) flag indicating whether playback is currently paused.
Looping – true/false (boolean) flag indicating whether the sound will loop over and over again.
Duration – normal duration of the sound, in seconds (floating point value).
Position – current playback position, in seconds (floating point value).
Volume – volume of the sound, from 0 (muted) to 1 (maximum volume according to current computer volume settings). This is a floating point value.
This example will calculate how much of the sound has played so far, from 0 to 1.
let soundDictionary = soundinfo(Identifier)
let soundDuration = val(getdictionaryvalue(soundDictionary,"Duration","0"))
let soundPosition = val(getdictionaryvalue(soundDictionary,"Position","0"))
let soundProgress = divzero(soundPosition,soundDuration)
Error Messages
soundinfo( function error: timer does not exist – There is no sound being played with the specified name
See Also
History
Version | Status | Notes |
10.2 | New | New in this version. |