aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-02-16 04:14:15 +0100
committerArisotura <thetotalworm@gmail.com>2019-02-16 04:14:15 +0100
commitd2d7c20208847f4230b406189a90195e708dfc72 (patch)
treef9432d4853f41f77a5fc1b00e5c57985f8f0e4c6 /src
parent86b894ca71199922d5c37f85b1b99e12dd04e766 (diff)
fix WAV loading for files with more than one channel (fixes #351)
Diffstat (limited to 'src')
-rw-r--r--src/libui_sdl/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index cd8e033..b0d2504 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -173,7 +173,7 @@ void MicLoadWav(char* name)
if (format.format == AUDIO_S16 || format.format == AUDIO_U16)
{
int srcinc = format.channels;
- len /= 2;
+ len /= (2 * srcinc);
MicWavLength = (len * dstfreq) / format.freq;
if (MicWavLength < 735) MicWavLength = 735;
@@ -201,6 +201,7 @@ void MicLoadWav(char* name)
else if (format.format == AUDIO_S8 || format.format == AUDIO_U8)
{
int srcinc = format.channels;
+ len /= srcinc;
MicWavLength = (len * dstfreq) / format.freq;
if (MicWavLength < 735) MicWavLength = 735;