Re: Separating channels when recording stereo

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Wednesday, March 16, 2011 6:08:07 AM Alessandro Motta wrote:
> * 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)?

Hi.

Your first suggestion is correct. With AL_FORMAT_STEREO16, OpenAL records 16-
bit samples per channel. Two 16-bit values make up one frame.

> * 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];

This is correct, assuming 'buffer' is an array of shorts, int16_t, or similar 
signed 16-bit integer type. The first sample (index 0) is left, the second is 
right, the third is left, the fourth is right, etc.

Hope that helps.
_______________________________________________
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.