Legacy:Sound/pause

From Spherical
< Legacy:Sound
Revision as of 22:39, 30 May 2013 by Apollolux (talk | contribs) (navboxed)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Play a loaded sound.

Usage

sound.pause();


  • sound Sphere Sound object. The sound to pause.

Examples

Pausing a sound with the enter key:

var my_music = LoadSound("your_sound.ogg");
var toggle = false;

my_music.play(true);

while (!IsKeyPressed(KEY_ESCAPE))
{
    while (AreKeysLeft()) {
        if (GetKey() == KEY_ENTER) toggle ? my_music.play() : my_music.pause();
    }
}

Note that the above is different from stop which will restart the sound on play.

See also


API:Sound/navbox