love.audio.newSource (한국어)

파일, 디코더, SoundData로부터 새로운 오디오 소스를 생성합니다. SoundData를 통해 만들어진 오디오 소스의 메모리 등재 방식은 그 특성상 "static"으로 강제됩니다.

O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused!  



함수

형식

source = love.audio.newSource( filename, type )

매개변수

string (한국어) filename
오디오 파일의 이름.
SourceType (한국어) type ("stream")
메모리 등재 방식.

리턴값

Source (한국어) source
새 오디오 소스.

함수

형식

source = love.audio.newSource( file, type )

매개변수

File (한국어) file
오디오 파일을 가리키는 File.
SourceType (한국어) type ("stream")
메모리 등재 방식.

리턴값

Source (한국어) source
새 오디오 소스.

함수

형식

source = love.audio.newSource( decoder, type )

매개변수

Decoder (한국어) decoder
오디오 소스에 사용할 디코더 객체.
SourceType (한국어) type ("stream")
메모리 등재 방식.

Returns

Source (한국어) source
새 오디오 소스.

함수

형식

source = love.audio.newSource( data )

매개변수

SoundData (한국어) data
The SoundData to create a Source from.

리턴값

Source (한국어) source
새 오디오 소스. 메모리 등재 방식은 강제로 "static"으로 지정.

예제

배경음을 불러와 재생하기

bgm = love.audio.newSource("bgm.ogg", "stream")
love.audio.play(bgm)

효과음을 불러와 재생하기

sfx = love.audio.newSource("sfx.wav", "static")
love.audio.play(sfx)

SoundData로 새 오디오 소스 만들기

data = love.sound.newSoundData("sfx.wav")
sfx = love.audio.newSource(data)

디코더로 새 오디오 소스 만들기

decoder = love.sound.newDecoder("bgm.ogg")
bgm = love.audio.newSource(decoder)

같이 보기


다른 언어