I've recently been confused about a couple of things on OpenAL so I set out on a quest to clear them up.
1. I was unsure about the structure of OpenAL which I now understand.
2. I was unsure how to load audio data into memory or how audio works in general.
This is where I'm stuck. Here's some code to help explain my meaning:
Code:
GEsound::GEsound(ALint numBuf = 1 )
{
ALCdevice *device = alcOpenDevice(NULL);
if (device != NULL)
{
alGetError(); //Clears error state out.
buffer[numBuf]; //buffer declared private as ALuint *
alGenBuffers(numBuf, buffer);
if (alGetError() == AL_NO_ERROR)
{
//What do I do to load data into the buffers?
}
}
}
The programmers guide explains to simply load PCM audio data into buffers using alBufferData. In the alBufferData function, it explains that you need to pass a void pointer to the audio data. I have not a clue where to begin to generate that pointer to be honest since I can't find many examples on audio programming or the theory behind it. I'm guessing this is where where I decode audio. Anyone care to help?
EDIT: Buffer is an array to unsigned integers which hold names of the buffers. Not the actual buffers.