Difference between revisions of "love.sound.newSoundData"

m (1 revision: Imported docs from potato.)
Line 1: Line 1:
  
 
+
Creates new SoundData from a Decoder.
 +
Fully expands the encoded sound data into raw sound data. Only do this for small files.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
Line 42: Line 43:
 
* [[parent::love.sound]]
 
* [[parent::love.sound]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=}}
+
{{#set:Description=Creates new SoundData from a Decoder.
 +
}}

Revision as of 16:17, 14 February 2010

Creates new SoundData from a Decoder. Fully expands the encoded sound data into raw sound data. Only do this for small files.

Function

Synopsis

sounddata = love.sound.newSoundData( decoder )

Arguments

Decoder decoder
Decode data from this Decoder until EOF.

Returns

SoundData sounddata
A SoundData object.

Function

Synopsis

sd = love.sound.newSoundData( filename )

Arguments

string filename
The filename of the file to load.

Returns

SoundData sd
A new SoundData object.

Function

Synopsis

sounddata = love.sound.newSoundData( samples, rate, bits, channels )

Arguments

number samples
Total number of samples.
number rate
Number of samples per second
number bits
Bits per sample (8 or 16).
number channels
Either 1 for mono, or 2 for stereo

Returns

SoundData sounddata
A new SoundData object, or zero in case of errors.

Examples

Loading SoundData from files

wav = love.sound.newSoundData("doom.wav")
-- Beware: if doom.mp3 is a huge file, it will take 
-- ages to decode.
mp3 = love.sound.newSoundData("doom.mp3")

See Also