From 8c46b82b54b54fb6b931b084a9f72a7ffb90b56b Mon Sep 17 00:00:00 2001 From: David Briscoe Date: Sat, 8 Jan 2022 09:28:50 -0800 Subject: [PATCH] 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. --- sfxr.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfxr.lua b/sfxr.lua index d1e0342..421ae0e 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -858,7 +858,7 @@ end -- @raise "invalid sampling rate: x", "invalid bit depth: x" function sfxr.Sound:generateSoundData(rate, depth, sounddata) 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.BITDEPTH[depth] and depth, "invalid bit depth: " .. tostring(depth))