Separating channels when recording stereo

Alessandro Motta <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Hi OpenAL guys

I've started one of my first C++ projects about a week from now.
Before I've already done some sound processing in Java.

Now I'd like to implement some sound capturing in C++ by using the
really simple openAL library. But unfortunately the "OpenAL
Programmers Guide" isn't that precise.

I'd like to capture some stereo microphone input. So I open a capture
device with the AL_FORMAT_STEREO16 value.

But I struggle when evaluating / reading the capture buffer. I've
googled the web but haven't found answers on these two questions:

* What does the 16 in AL_FORMAT_STEREO16 really means?
Does OpenAL record 16 bits per channel (16 bits for left, 16 bits for
right) or does every channel use only 8 bits (8 bits left, 8 bits
right = 16 bits)?

* How are the stereo samples separated from each other?
Some people said that all samples with even index in the buffer array
belong to the left channel. And all samples with odd indexes in the
buffer array are right values. Which means:

int lft = buffer[2*i + 0];
int rgt = buffer[2*i + 1];

Or do I have to apply some byte masking and shifting, like other people suggest:
int lft = buffer[i] & 0x00FF;
int rgt = (buffer[i] & 0xFF00) >> 16;


Thanks for your help in advance.
- Alessandro
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.