OpenAL not playing on Max OS X 10.6
Posted
by Grimless
on Stack Overflow
See other posts from Stack Overflow
or by Grimless
Published on 2010-06-13T05:25:00Z
Indexed on
2010/06/13
5:32 UTC
Read the original article
Hit count: 281
I've been working on getting a basic audio engine running on my Mac using OpenAL. It seems relatively straightforward after working with OpenGL for a while. However, despite the fact that I believe I have everything in place, my sound will not play. Here is the order of things I am doing:
//Creating a new device
ALCdevice* device = alcOpenDevice(NULL);
//Create a new context with the device
ALCcontext* context = alcCreateContext(device, NULL);
//Make that context current
alcMakeContextCurrent(context);
//Do lots of loading stuff to bring in an AIFF...
voodooAIFF = myAIFFLoader("name");
//Then use that data
ALuint buf;
alGenBuffers(1, &buf);
//Check for errors, but none happen...
//Bind buffer data.
alBufferData(buf, voodooAIFF.format, voodooAIFF.data, voodooAIFF.sizeInBytes, voodooAIFF.frequency);
//Check for errors, none here either...
//Create Source
ALuint src;
alGenSources(1, &src);
//Error check again, no errors.
//Bind source to buffer
alSourcei(src, AL_BUFFER, buf);
//Set reference distance
alSourcei(sourceID, AL_REFERENCE_DISTANCE, 1);
//Set source attributes including gain and pitch to 1 (direction set to 0,0,0)
//Check for errors, nothing...
//Set up listener attributes.
//Check for errors, no errors.
//Begin playing.
alSourcePlay(src);
Observe silence...
Any insight, what steps am I missing here?
© Stack Overflow or respective owner