Skip to content

Commit

Permalink
fix WAV loading for files with more than one channel (fixes #351)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Feb 16, 2019
1 parent 86b894c commit d2d7c20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libui_sdl/main.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d2d7c20

Please sign in to comment.