Difference between revisions of "love.audio.newSource"
m (description error fixed) |
|||
Line 47: | Line 47: | ||
sfx = love.audio.newSource(data) | sfx = love.audio.newSource(data) | ||
</source> | </source> | ||
− | === Load | + | === Load Decoder and create a Source === |
<source lang="lua"> | <source lang="lua"> | ||
decoder = love.sound.newDecoder("bgm.ogg") | decoder = love.sound.newDecoder("bgm.ogg") |
Revision as of 11:05, 6 January 2011
Creates a new Source from a file. Sources created from SoundData are always static.
Function
Synopsis
source = love.audio.newSource( file, type )
Arguments
string file
- The file to create a Source from.
SourceType type
- Streaming or static source.
Returns
Source source
- A new Source that can play the specified audio.
Function
Synopsis
source = love.audio.newSource( data )
Arguments
SoundData data
- The SoundData to create a Source from.
Returns
Source source
- A new Source that can play the specified audio. The SourceType of the returned audio is "static".
Function
Synopsis
source = love.audio.newSource( decoder, type )
Arguments
Decoder decoder
- The Decoder to create a Source from.
SourceType type
- Streaming or static source.
Returns
Source source
- A new Source that can play the specified audio.
Examples
Load background music and play it
bgm = love.audio.newSource("bgm.ogg", "stream")
love.audio.play(bgm)
Load a sound effect and play it
sfx = love.audio.newSource("sfx.wav", "static")
love.audio.play(sfx)
Load SoundData and create a Source
data = love.sound.newSoundData("sfx.wav")
sfx = love.audio.newSource(data)
Load Decoder and create a Source
decoder = love.sound.newDecoder("bgm.ogg")
bgm = love.audio.newSource(decoder)
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info