mirror of
https://github.com/nucular/sfxrlua.git
synced 2024-12-24 18:44:20 +00:00
Default to a love-supported bit depth for SoundData
Fix "Invalid bit depth: 0" error in love when calling generateSoundData without arguments. Love2d 11 (and earlier?) only supports 8 and 16, so don't default to 0 when generating a love object.
This commit is contained in:
parent
949429d461
commit
8c46b82b54
2
sfxr.lua
2
sfxr.lua
@ -858,7 +858,7 @@ end
|
|||||||
-- @raise "invalid sampling rate: x", "invalid bit depth: x"
|
-- @raise "invalid sampling rate: x", "invalid bit depth: x"
|
||||||
function sfxr.Sound:generateSoundData(rate, depth, sounddata)
|
function sfxr.Sound:generateSoundData(rate, depth, sounddata)
|
||||||
rate = rate or 44100
|
rate = rate or 44100
|
||||||
depth = depth or 0
|
depth = depth or 8 -- love supports 8 and 16
|
||||||
assert(sfxr.SAMPLERATE[rate], "invalid sampling rate: " .. tostring(rate))
|
assert(sfxr.SAMPLERATE[rate], "invalid sampling rate: " .. tostring(rate))
|
||||||
assert(sfxr.BITDEPTH[depth] and depth, "invalid bit depth: " .. tostring(depth))
|
assert(sfxr.BITDEPTH[depth] and depth, "invalid bit depth: " .. tostring(depth))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user