Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed WAV loading under 64-bit systems. #3

Merged
merged 1 commit into from
Nov 9, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,24 +683,24 @@ static Wave LoadWAV(const char *fileName)
// Basic WAV headers structs
typedef struct {
char chunkID[4];
long chunkSize;
int chunkSize;
char format[4];
} RiffHeader;

typedef struct {
char subChunkID[4];
long subChunkSize;
int subChunkSize;
short audioFormat;
short numChannels;
long sampleRate;
long byteRate;
int sampleRate;
int byteRate;
short blockAlign;
short bitsPerSample;
} WaveFormat;

typedef struct {
char subChunkID[4];
long subChunkSize;
int subChunkSize;
} WaveData;

RiffHeader riffHeader;
Expand All @@ -722,8 +722,8 @@ static Wave LoadWAV(const char *fileName)
fread(&riffHeader, sizeof(RiffHeader), 1, wavFile);

// Check for RIFF and WAVE tags
if (((riffHeader.chunkID[0] != 'R') || (riffHeader.chunkID[1] != 'I') || (riffHeader.chunkID[2] != 'F') || (riffHeader.chunkID[3] != 'F')) ||
((riffHeader.format[0] != 'W') || (riffHeader.format[1] != 'A') || (riffHeader.format[2] != 'V') || (riffHeader.format[3] != 'E')))
if (strncmp(riffHeader.chunkID, "RIFF", 4) ||
strncmp(riffHeader.format, "WAVE", 4))
{
TraceLog(WARNING, "[%s] Invalid RIFF or WAVE Header", fileName);
}
Expand Down Expand Up @@ -825,4 +825,4 @@ static Wave LoadOGG(char *fileName)
static void UnloadWave(Wave wave)
{
free(wave.data);
}
}