3

Using OpenAL, I am loading the sound in AL_FORMAT_STEREO16 format. I am trying to set the panning in OpenAL in iOS/iPhone platform? Do I need to set the AL_POSITION for the source? How do I set it?

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70
  • I am loading the sound in AL_FORMAT_STEREO16 format. If I load it in MONO format, i am able to set the pan using `float sourcePosAL[] = {pan, 0.0f, 0.0f}; alSourcefv(sourceID, AL_POSITION, sourcePosAL);` pan value ranging from -1.0f to 1.0f. – Bijoy Thangaraj Feb 08 '12 at 17:23
  • How do I set the pan for a stereo file? – Bijoy Thangaraj Aug 17 '12 at 11:11
  • OpenAL says about AL_CHANNELS: "number of channels in buffer > 1 is valid, but buffer won’t be positioned when played". So it's not possible with a 2-channel file. However, you could split the stereo file into 2 mono buffers and devise your own stereo-panning technique (ie. using AL_POSITION and/or AL_GAIN for each channel). – bio Dec 16 '15 at 14:03

1 Answers1

6

If I load it in MONO format, i am able to set the pan using

float sourcePosAL[] = {pan, 0.0f, 0.0f}; 
alSourcefv(sourceID, AL_POSITION, sourcePosAL); 

pan value ranging from -1.0f to 1.0f.

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70