Difference between revisions of "Legacy:Sound"
From Spherical
m (→Notes: fix link) |
(filled, cleanup) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Holds a sound that can be played by Sphere. | + | Holds a sound or piece of music that can be played by Sphere. |
__TOC__ | __TOC__ | ||
==Initializers== | ==Initializers== | ||
− | * [[API:LoadSound|LoadSound]]() | + | * [[API:LoadSound|LoadSound]](''filename'' [, ''streaming'']): Load a sound from ''filename'', ''streaming'' from disk optional. |
==Methods== | ==Methods== | ||
− | * [[API:Sound/play|Sound.play]]() | + | * [[API:Sound/clone|Sound.clone]](): Returns a copy of the sound object. |
− | * [[API:Sound/pause|Sound.pause]]() | + | * [[API:Sound/play|Sound.play]](''repeat''): Play the sound, loop if ''repeat'' is true. |
− | * [[API:Sound/stop|Sound.stop]]() | + | * [[API:Sound/pause|Sound.pause]](): Pause playback of the sound. Call [[API:Sound/play|Sound.play]]() to resume. |
− | * [[API:Sound/isPlaying|Sound.isPlaying]]() | + | * [[API:Sound/stop|Sound.stop]](): Stop playback of the sound. |
− | * [[API:Sound/ | + | |
− | * [[API:Sound/ | + | * [[API:Sound/reset|Sound.reset]](): Resets playback. No effect on MIDIs. |
− | * [[API:Sound/ | + | * [[API:Sound/setRepeat|Sound.setRepeat]](repeat): Sets if the sound should be repeated. |
− | * [[API:Sound/ | + | * [[API:Sound/getRepeat|Sound.getRepeat]](): Returns true if sound is set to repeat, otherwise false. |
− | * [[API:Sound/getVolume|Sound.getVolume]]() | + | |
− | * [[API:Sound/setVolume|Sound.setVolume]]() | + | * [[API:Sound/isPlaying|Sound.isPlaying]](): Check if the sound is currently playing. |
+ | * [[API:Sound/isSeekable|Sound.isSeekable]](): Returns true if the sound is seekable. Not all sound types are seekable, Ogg is. | ||
+ | * [[API:Sound/getLength|Sound.getLength]](): Gets the length of the sound. | ||
+ | * [[API:Sound/getPosition|Sound.getPosition]](): Returns the position of the sound, zero if the sound isn't seekable. | ||
+ | * [[API:Sound/setPosition|Sound.setPosition]](''position''): Sets the position of the sound. Does nothing if the sound isn't seekable. | ||
+ | |||
+ | * [[API:Sound/getVolume|Sound.getVolume]](): Get the volume of the sound (0-255). No effect on MIDIs. | ||
+ | * [[API:Sound/setVolume|Sound.setVolume]](''volume''): Set the volume of the sound (0-255). No effect on MIDIs. | ||
+ | * [[API:Sound/setPan|Sound.setPan]](pan): Pan can be from -255 to 255. -255 = left, 255 = right. No effect on MIDIs. | ||
+ | * [[API:Sound/getPan|Sound.getPan]](): Returns the current pan of the sound. No effect on MIDIs. | ||
+ | * [[API:Sound/setPitch|Sound.setPitch]](''pitch''): Sets the pitch for a sound. No effect on MIDIs. | ||
+ | * [[API:Sound/getPitch|Sound.getPitch]](): Returns the current pitch. No effect on MIDIs. | ||
==Members== | ==Members== | ||
Line 39: | Line 50: | ||
==See also== | ==See also== | ||
* [http://audiere.sf.net Audiere] sound library | * [http://audiere.sf.net Audiere] sound library | ||
+ | |||
+ | |||
+ | {{API:Sound/navbox}} | ||
+ | |||
+ | [[Category:Objects]] |
Latest revision as of 22:38, 30 May 2013
Holds a sound or piece of music that can be played by Sphere.
Initializers
- LoadSound(filename [, streaming]): Load a sound from filename, streaming from disk optional.
Methods
- Sound.clone(): Returns a copy of the sound object.
- Sound.play(repeat): Play the sound, loop if repeat is true.
- Sound.pause(): Pause playback of the sound. Call Sound.play() to resume.
- Sound.stop(): Stop playback of the sound.
- Sound.reset(): Resets playback. No effect on MIDIs.
- Sound.setRepeat(repeat): Sets if the sound should be repeated.
- Sound.getRepeat(): Returns true if sound is set to repeat, otherwise false.
- Sound.isPlaying(): Check if the sound is currently playing.
- Sound.isSeekable(): Returns true if the sound is seekable. Not all sound types are seekable, Ogg is.
- Sound.getLength(): Gets the length of the sound.
- Sound.getPosition(): Returns the position of the sound, zero if the sound isn't seekable.
- Sound.setPosition(position): Sets the position of the sound. Does nothing if the sound isn't seekable.
- Sound.getVolume(): Get the volume of the sound (0-255). No effect on MIDIs.
- Sound.setVolume(volume): Set the volume of the sound (0-255). No effect on MIDIs.
- Sound.setPan(pan): Pan can be from -255 to 255. -255 = left, 255 = right. No effect on MIDIs.
- Sound.getPan(): Returns the current pan of the sound. No effect on MIDIs.
- Sound.setPitch(pitch): Sets the pitch for a sound. No effect on MIDIs.
- Sound.getPitch(): Returns the current pitch. No effect on MIDIs.
Members
None.
Examples
See the examples for Sound.play().
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
As mentioned above, streaming is only supported for certain kinds of audio files.
See also
- Audiere sound library