[Openal] Accessing sound data structures

Garin Hiebert garinh at cheesetoast.net
Sun Feb 12 12:11:56 PST 2006


> I am wondering if the data pointer in alutLoadWAVFile() is pointing
> directly to the data chunk of the sound file or if it just starts at
> the header info of a sound file, in which case I will have to skip
> that info to get directly to the sound.
>   
alutLoadWAVFile will give you a pointer to the raw data in PCM format -- 
the header information isn't there (it's reflected in the format 
information).

> So does this mean that
> If the sample is 8-bit then I should initialize an unsigned ALbyte
> array to hold my data? And increment the pointer to parse through
> sample frames which should each be 8 bits?
> If it is 16-bit, then do i use a signed ALshort array?
>   
I think you've interpreted things correctly -- here's  a rewording:

- 8-bit mono would be unsigned bytes, and you would step one byte at a 
time through the data
- 8-bit stereo would be unsigned bytes, and you would step two byes at a 
time, with each pair representing the left and then the right sample
- 16-bit mono would be signed 16-bit words, and you would step one word 
at a time through the data
- 16-bit stereo would be signed 16-bit words, and you would step two 
words at a time through the data (left sample then right)

Garin




More information about the Openal mailing list