LoadSound
From Spheriki
Load an audio file so that Sphere can play it later.
Contents |
[edit]
Usage
Sound LoadSound(filename[, streaming]);
- filename String. The path to the audio file, relative to the game's
sounds/directory. - streaming boolean, optional. If true, Sphere will load the file in pieces while it is playing. Good for large audio files, but may not be supported for all sound file formats.
- Sphere Sound is returned, holding the sound.
[edit]
Examples
This game script may or may not be annoying, depending on what audio is inside my_sound.ogg:
function game()
{
var font = GetSystemFont();
var sound = LoadSound("my_sound.ogg");
sound.play(true);
while (!IsAnyKeyPressed())
{
font.drawText(0, 0, "Press any key to end.");
FlipScreen();
}
}
Note that Sphere supports many more audio file formats apart from Ogg Vorbis. See the notes for more details.
[edit]
Notes
- Sphere uses Audiere, a library that supports many sound formats. The sound formats supported include:
- Uncompressed WAV (seek supported)
- Uncompressed AIFF (seek supported)
- Ogg Vorbis (seek supported)
- FLAC (seek supported)
- MP3
- MOD, S3M, IT, XM (module music formats)
- MIDI
[edit]
See also
- Sphere Sound object

