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

Conversation

debiatan
Copy link
Contributor

@debiatan debiatan commented Nov 9, 2014

Hi!

The size of the long integer type varies across operating systems and compilers. On windows, both the 32-bit and the 64-bit of Microsoft Visual C++ and MinGW use 4 bytes for integers as well as for long integers, while GCC on a 64-bit linux system makes them 8-byte long. That difference breaks the recognition of WAV file headers in src/audio.c under 64-bit linuces, triggering an Invalid RIFF or WAVE Header error.

To ensure compatibility in the recognition of the WAV header, it is preferable to stick to plain integers, which take four bytes under all target systems. That way, both MinGW and GCC behave the same way, regardless of the underlying OS.

Just so you can double check my reasoning, here's a short article detailing Intel's thoughts on the issue. They have their own C compiler that must remain compatible to the dominant compiler of any given platform (Visual C++ for windows, GCC for linux and macosx). MinGW shares those concerns, so the same reasoning applies.

Thanks and keep up the good work!

@raysan5
Copy link
Owner

raysan5 commented Nov 9, 2014

Hi debiatan!

Many thanks for the fix! I was not aware of this issue!

👍

raysan5 added a commit that referenced this pull request Nov 9, 2014
Fixed WAV loading under 64-bit systems.
@raysan5 raysan5 merged commit 45b214d into raysan5:master Nov 9, 2014
@debiatan debiatan deleted the fix_audio_64 branch November 9, 2014 10:57
raysan5 pushed a commit that referenced this pull request Aug 30, 2018
Added OSX launch configurations for debug and release
michaelfiber referenced this pull request in michaelfiber/raylib Sep 21, 2023
Add contribution link on Footer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants