Difference between revisions of "love.sound.newSoundData"

m (1 revision: Importing from potato (again).)
m
Line 1: Line 1:
 
 
Creates new SoundData from a Decoder.  
 
Creates new SoundData from a Decoder.  
 
Fully expands the encoded sound data into raw sound data. Only do this for small files.
 
Fully expands the encoded sound data into raw sound data. Only do this for small files.
Line 45: Line 44:
 
{{#set:Description=Creates new SoundData from a Decoder.  
 
{{#set:Description=Creates new SoundData from a Decoder.  
 
}}
 
}}
 +
== Other Languages ==
 +
{{i18n|love.sound.newSoundData}}

Revision as of 20:34, 18 November 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

Other Languages