[Openal] Accessing sound data structures
unjust at gmail.com
Sun Feb 12 11:53:41 PST 2006
After not being able to access the buffer data, I am trying to catch
the data before I initialize a buffer, so I am putting code after the
loadWav call in an attempt to copy and parse though the sound file
(for FFT) - then give it to a buffer for playing.
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.
I also don't know how to organize my array... I know that stereo data
is interleaved, and that the type of array I initialize depends on the
format of the PCM data (I think).
How do I retrieve and printf the format info (PCM info)?
The OpenAL manual says the following :
8-bit PCM data is expressed as an unsigned value over the range 0 to
255, 128 being an audio output level of zero. 16-bit PCM data is
expressed as a signed value over the range -32768 to 32767, 0 being an
audio output level of zero. Stereo data is expressed in interleaved
format, left channel first.
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?
More information about the Openal