[Openal] AL_POSITION affects Doppler Shift
Tim Mahrt
runeedge at gmail.com
Wed Nov 15 21:21:51 PST 2006
I'm currently working with Doppler Shifts and I've run into a bit of a
problem that has confused me.
According to the formula in the OpenAL 1.1 Spec, the position of a
source has no effect with the doppler effect--however, I was playing
around with some code that was referenced on a newsgroup somewhere,
altest.cpp where I derived the following:
//carSirenZPos oscillates between 15 and -15
alDopplerFactor(4.f);
alSource3f(soundSource, AL_VELOCITY, 10.0, 0.0f, 0.0f);
alSource3f(soundSource, AL_POSITION, (float) carSirenZPos / 10, 0.3f, 0.f);
When the position is positive, regardless of whether its increasing or
decreasing, the f' > f. When the position is negative, f' < f.
But I thought the doppler effect was independent of position? Did I
do something wrong?
Also, the listener sits at (0, 0, 0) and doesn't move--the only thing
that changes is the soundSource.
An executable of my code can be found here if that helps:
https://netfiles.uiuc.edu/tmahrt2/shared/OpenGL/OpenAL/OpenAL%20Test.zip
Just extract all of the contents of the file and run the exe. "z" on
the keyboard plays the sound with looping. "x" plays it just once.
Thanks,
Tim
More information about the Openal
mailing list