From 4e859aec86c2c2755f18323c5667c77197359bd4 Mon Sep 17 00:00:00 2001 From: geoffbeier Date: Fri, 5 Jun 2020 03:34:28 -0400 Subject: [PATCH] replace reference to globals freq and bits with rate and depth --- sfxr.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sfxr.lua b/sfxr.lua index 254817d..f36493a 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -868,7 +868,7 @@ function sfxr.Sound:generateSoundData(rate, depth, sounddata) return nil end - local data = sounddata or love.sound.newSoundData(count, freq, bits, 1) + local data = sounddata or love.sound.newSoundData(count, rate, depth, 1) for i = 0, #tab - 1 do data:setSample(i, tab[i + 1]) @@ -1264,10 +1264,10 @@ function sfxr.Sound:exportWAV(f, rate, depth) w32(16) -- chunk size w16(1) -- compression code (1 = PCM) w16(1) -- channel number - w32(freq) -- sampling rate - w32(freq * bits / 8) -- bytes per second - w16(bits / 8) -- block alignment - w16(bits) -- bits per sample + w32(rate) -- sampling rate + w32(rate * depth / 8) -- bytes per second + w16(depth / 8) -- block alignment + w16(depth) -- bits per sample -- Write the header of the data chunk ws("data") @@ -1292,9 +1292,9 @@ function sfxr.Sound:exportWAV(f, rate, depth) -- Seek back to the stored positions seek(pos_fsize) - w32(pos_csize - 4 + samples * bits / 8) -- remaining file size + w32(pos_csize - 4 + samples * depth / 8) -- remaining file size seek(pos_csize) - w32(samples * bits / 8) -- chunk size + w32(samples * depth / 8) -- chunk size if close then f:close()