mirror of
https://github.com/nucular/sfxrlua.git
synced 2024-12-24 18:44:20 +00:00
Added Sound.play
This commit is contained in:
parent
e2b2cf5e4b
commit
51e8617ef7
10
sfxr.lua
10
sfxr.lua
@ -457,6 +457,16 @@ function sfxr.Sound:generateSoundData(freq, bits)
|
|||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function sfxr.Sound:play(freq, bits)
|
||||||
|
local data = self:generateSoundData(freq, bits)
|
||||||
|
|
||||||
|
if data then
|
||||||
|
local source = love.audio.newSource(data)
|
||||||
|
source:play()
|
||||||
|
return source
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function sfxr.Sound:randomize(seed)
|
function sfxr.Sound:randomize(seed)
|
||||||
if seed then setseed(seed) end
|
if seed then setseed(seed) end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user