tags:

views:

48

answers:

1

Hi Guys,

First time i've worked with OpenAL, and for the life of my i can't figure out why setting the position of the source doesn't have any effect on the sound. The sounds are in stero format, i've made sure i set the listener position, the sound is not realtive to the listener and OpenAL isn't giving out any error.

Can anyone shed some light?

Create Audio device

ALenum result;

mDevice = alcOpenDevice(NULL);
if((result = alGetError()) != AL_NO_ERROR)
{
    std::cerr << "Failed to create Device. " << GetALError(result) << std::endl;
    return;
}

mContext = alcCreateContext(mDevice, NULL);
if((result = alGetError()) != AL_NO_ERROR)
{
    std::cerr << "Failed to create Context. " << GetALError(result) << std::endl;
    return;
}
alcMakeContextCurrent(mContext);

SoundListener::SetListenerPosition(0.0f, 0.0f, 0.0f);
SoundListener::SetListenerOrientation(0.0f, 0.0f, -1.0f);

The two listener functions call

alListener3f(AL_POSITION, x, y, z);
Real vec[6] = {x, y, z, 0.0f, 1.0f, 0.0f};
alListenerfv(AL_ORIENTATION, vec);

I set the sources position to 1,0,0 which should be to the right of the listener but it has no effect

alSource3f(mSourceHandle, AL_POSITION, x, y, z);

Any guidance would be much appreciated

A: 

Arrrr, I'm a idiot.

Stero isn't localised. It all makes sense now because steros channels are already computed where mono isn't so panning is calculated by openAL.

Ben E