Difference between revisions of "Legacy:LoadSound"

From Spherical
Jump to: navigation, search
(Created page with "{{subst:functemp}}")
 
Line 6: Line 6:
  
 
==Usage==
 
==Usage==
{{Usage|returns={{{returns}}}|object={{{object}}}|func={{{function}}}|params={{{params}}}}}
+
{{Usage|func=LoadSound|params=file, streaming}}
  
* '''param1''' type. param1 description
+
* '''file''' String. Name of sound file.
* '''param2''' type. param2 description
+
* '''streaming''' boolean. Will stream the file from disk instead of loading the full file into memory. Useful for cutting down loading times when you have large sound files.
* '''paramN''' type. paramN description
 
  
 
==Examples==
 
==Examples==
(examples with syntaxhighlighted code)
+
<syntaxhighlight>
 +
var sound = LoadSound("sound_effect.ogg");
 +
var music = LoadSound("music.ogg", true);
 +
sound.play(); //Play the sound effect.
 +
music.play(true); //true makes the music loop.
 +
</syntaxhighlight>
  
 
==Notes==
 
==Notes==
(notes)
+
 
 +
Supported filetypes are:
 +
 
 +
* Ogg
 +
* WAV
 +
* MP3 (not in minisphere)
 +
* IT
 +
* MOD
 +
* Various other module tracker formats.
 +
* MIDI (original Sphere only; use is discouraged)
 +
 
 +
Streaming works only for streaming formats like wav, ogg and mp3.
 +
 
  
 
==See also==
 
==See also==
* see also
+
* [[API:Sound.play|Sound.play]]()
* see also
 
* see also
 
* etc
 

Revision as of 03:01, 20 December 2015


{{{preamble}}}

Usage

LoadSound(file, streaming);


  • file String. Name of sound file.
  • streaming boolean. Will stream the file from disk instead of loading the full file into memory. Useful for cutting down loading times when you have large sound files.

Examples

var sound = LoadSound("sound_effect.ogg");
var music = LoadSound("music.ogg", true);
sound.play(); //Play the sound effect.
music.play(true); //true makes the music loop.

Notes

Supported filetypes are:

  • Ogg
  • WAV
  • MP3 (not in minisphere)
  • IT
  • MOD
  • Various other module tracker formats.
  • MIDI (original Sphere only; use is discouraged)

Streaming works only for streaming formats like wav, ogg and mp3.


See also