What it does
PlaySound makes something happen at once: it plays. It takes soundID (an integer), and answers an integer. That is the first of 4 forms. soundID is the id of a Sound object, the one LoadSound returned: it is how the call knows what to act on.
Syntax
1
PlaySound(soundID integer) → integer2
PlaySound(soundID integer, volume integer) → integer3
PlaySound(soundID integer, volume integer, loop integer) → integer4
PlaySound(soundID integer, volume integer, loop integer, priority integer) → integerParameters
| Name | Type | In forms |
|---|---|---|
| soundID | integer | all |
| volume | integer | 2, 3, 4 |
| loop | integer | 3, 4 |
| priority | integer | 4 |
Every form returns
integer
Example · generated
Form 1, the short one
sound = LoadSound("assets/sound.wav")DO Print(PlaySound(sound)) Sync()LOOPForm 4, with every argument
sound = LoadSound("assets/sound.wav")DO Print(PlaySound(sound, 1, 1, 1)) Sync()LOOPLoadSound is there to give the call something to act on; PlaySound is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.