Playing sound using OpenAL
For sound I use OpenAL, it’s free, cross-platform, I’ve managed to get it working on iPhone, Windows and Mac. Setting up OpenAL to play a sound is pretty straight forward, a bit like OpenGL. First you need to create a context. ALCcontext *context; ALCdevice *device; device = alcOpenDevice(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); if (device == NULL) { // Handle Exception } //Create a context context=alcCreateContext(device,NULL); //Set active context alcMakeContextCurrent(context); // Clear Error Code alGetError(); Now for the second part, loading a wav file. You have to open a file, fill buffers with data and then attach it to a source. ...