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:
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?
GEsound::GEsound(ALint numBuf = 1 )
ALCdevice *device = alcOpenDevice(NULL);
if (device != NULL)
alGetError(); //Clears error state out.
buffer[numBuf]; //buffer declared private as ALuint *
if (alGetError() == AL_NO_ERROR)
//What do I do to load data into the buffers?
EDIT: Buffer is an array to unsigned integers which hold names of the buffers. Not the actual buffers.
You can use freealut library to load in WAV files. Google for it.
No! That's exactly what I don't want to do! The point of this is to learn, not to use a utility class that does it for you.
Alright. Well thanks for spending your time on me. *cough* I found my answer: GameDev.net - Introduction to Ogg Vorbis
Ogg Vorbis will load the Ogg format for you. What is the difference between having freealut load WAV files or using Ogg to load it's various formats?
They are the same thing. A third party helper library. I would still use freealut to load WAV files and Ogg to load music files. Queueing buffers in OpenAL looks straightforward enough once you know how to get the raw data loaded and streamed in which is pretty trivial when a library is loading the data for you.
I would try with a circular buffer of about 256 bytes. Always play the portion of the buffer you just loaded and always load into the portion of the buffer you just played.
It's hard to explain. Your right though, but I was confused about a couple of things. Anyways, thanks for the help.
I was confused about how audio is decoded in general. I thought that it used some special magic that summoned a decoding god which decoded the audio then returned a pointer to the buffered data. I'm still confused about how decoding works, but I'm more clear on the process of decoding.
You could always use DirectSound or XACT and that way you wouldn't have to ship additional dll's with your application :)
Closed. Please do not bump old threads.