PJBootstraps PJBootstraps - 1 year ago 72
C++ Question

Play MP3/WAV files without using libraries?

I am using an application called Eclipse (Oxygen Release (4.7.0)), and I am using it on MacOS Sierra. A few days ago, I downloaded source code from a replica Mario game that was made with C++ and OpenGL.

I was gonna use that source code to reference and play .mp3/.wav files in my game/program, until I realized that I can't do that because the source code for the Mario replica uses SDL2 and SDL2_Mixer to play all the audio that is used in the replica Mario game.

It is too much of a pain in the butt to import SDL2 and SDL2_Mixer into my C++ game/program, especially since it is harder to do on a Mac. I've tried doing it before, and failed. :(

I noticed that in the Mario replica source code, there were .wav files in the source code, which means that in the code, those .wav files were referenced and used to play the audio.

Is there any way to reference and play audio files in my game/program? I know it will be hard to do, because I am using a Mac, so I cannot use

#include windows(.h);
and other stuff like that.

Answer Source

I'd take a look at Apple's Core Audio Framework. See SO question here:

iPhone SDK: play a sound with coreAudio

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download