From 79ef40e872efd72eb9b4df0984090ad68193ed03 Mon Sep 17 00:00:00 2001 From: Olivier Goguel Date: Thu, 9 Nov 2017 23:32:08 +0100 Subject: [PATCH] Fix Wav support on 64Bits architecture --- kegs/Src/openalasync_snddriver.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/kegs/Src/openalasync_snddriver.cpp b/kegs/Src/openalasync_snddriver.cpp index 746e3a7..0cddadc 100644 --- a/kegs/Src/openalasync_snddriver.cpp +++ b/kegs/Src/openalasync_snddriver.cpp @@ -529,33 +529,38 @@ int x_is_sound_playing(enum_sound _hSound) #if 1 +#pragma push() +#pragma pack(1) /* * Struct to hold fmt subchunk data for WAVE files. */ struct WAVE_Format { char subChunkID[4]; - long subChunkSize; + int subChunkSize; short audioFormat; short numChannels; - long sampleRate; - long byteRate; + int sampleRate; + int byteRate; short blockAlign; short bitsPerSample; -}; +} __attribute__((packed)); /* * Struct to hold the data of the wave file */ struct WAVE_Data { char subChunkID[4]; //should contain the word data - long subChunk2Size; //Stores the size of the data block -}; + int subChunk2Size; //Stores the size of the data block +} __attribute__((packed)); struct RIFF_Header { char chunkID[4]; - long chunkSize;//size not including chunkSize or chunkID + int chunkSize;//size not including chunkSize or chunkID char format[4]; -}; +} __attribute__((packed)); + +#pragma pop() + bool loadWavFile(const char* filename, unsigned char** buffer, unsigned int* size, int* frequency,