pgSoundControl() is the companion function to
pgSoundLoader(). It allows you to set/get the playhead position and the status of any audio loaded with
pgSoundLoader(). The popup help provides all the details to help you set up your audio queries. If you are getting a property of an audio, you must set a variable to store the return value from the function and then check the returned value to determine how your Actions should handle the result.
There are several ways to get the status of an audio using
pgSoundControl().
- Set action =
"status"
Returns undefined or 0 for audio that is not playing and 1 for an audio that is playing. Other possible values indicated in the popup help are 2 or 3, but very rarely are these ever returned. - Set action =
"isPaused"
Returns true (paused) or false (or playing)
Example:

- GET STATUS of audio named "myAudio"
- Image 2.png (49.78 KiB) Viewed 4388 times
When this button is clicked without loading
"myAudio"
first, it displays the alert string "undefined" which is the same as 0 or false.
When the
"myAudio"
is playing or paused, it returns 1 indicating the audio is loaded and available for manipulation by
pgSoundControl().
When the
"myAudio"
has finished playing, it returns 0.
I prefer to catch the
"end" value in the
on user event if that is all that is needed. Otherwise check the
isPaused
property.
Of course,
pgSoundControl() can remotely get/set playhead position, get/set volume too, unload audio files, toggle the pause/play state, stop/resume, etc. It's all in the popup documentation.