Setting Position of source and listener has no effect
Posted
by Ben E
on Stack Overflow
See other posts from Stack Overflow
or by Ben E
Published on 2010-04-25T23:47:22Z
Indexed on
2010/04/25
23:53 UTC
Read the original article
Hit count: 374
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
© Stack Overflow or respective owner