Difference between revisions of "love.sound.newSoundData"

m
Line 41: Line 41:
 
== See Also ==
 
== See Also ==
 
* [[parent::love.sound]]
 
* [[parent::love.sound]]
 +
* [[Constructs::SoundData]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Creates new SoundData from a Decoder.  
+
{{#set:Description=Creates new SoundData from a Decoder. }}
}}
+
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.sound.newSoundData}}
 
{{i18n|love.sound.newSoundData}}

Revision as of 17:57, 25 March 2011

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


Other Languages