mirror of
https://github.com/nucular/sfxrlua.git
synced 2024-12-24 18:44:20 +00:00
Return undefined from Sound.generateSoundData if no sample data was yielded
This commit is contained in:
parent
d7c314dc18
commit
39a001a1a4
5
sfxr.lua
5
sfxr.lua
@ -442,6 +442,11 @@ end
|
|||||||
function sfxr.Sound:generateSoundData(freq, bits)
|
function sfxr.Sound:generateSoundData(freq, bits)
|
||||||
freq = freq or sfxr.FREQ_44100
|
freq = freq or sfxr.FREQ_44100
|
||||||
local tab = self:generateTable(freq, sfxr.BITS_FLOAT)
|
local tab = self:generateTable(freq, sfxr.BITS_FLOAT)
|
||||||
|
|
||||||
|
if #tab == 0 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
local data = love.sound.newSoundData(#tab, freq, bits, 1)
|
local data = love.sound.newSoundData(#tab, freq, bits, 1)
|
||||||
|
|
||||||
for i = 0, #tab - 1 do
|
for i = 0, #tab - 1 do
|
||||||
|
Loading…
Reference in New Issue
Block a user