Advertisement

OpenAL: Volume stays despite greater distance - no falloff

Started by September 28, 2004 04:05 AM
0 comments, last by Konk 20 years, 1 month ago
Hello everybody! I have an issue about OpenAL: A sound source is moving away from the listener - and initially you can hear how it's getting less intense. But then the volume stays at a certain level, although it is still moving away and should get quieter. I tried all DisctanceModels, some AL_MAX_DISTANCEs, AL_REFERENCE_DISTANCEs, AL_MIN_GAIN and so on, but the output is always the same! (even alDistanceModel(AL_NONE) doesn't affect the sound output in any way; shouldn't there be no decrease at all when I use this?) I hope somebody has an idea what I might have forgotten. The sample code for the initialization is: // for the Soundsource: //.. alSourcef (Source, AL_PITCH, 1.0f ); alSourcef (Source, AL_GAIN, 1.0f ); alSourcefv(Source, AL_POSITION, SourcePos); alSourcefv(Source, AL_VELOCITY, SourceVel); alSourcei (Source, AL_LOOPING, AL_TRUE ); alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); alSourcef (Source, AL_MAX_DISTANCE, 2.0f); alSourcef (Source, AL_REFERENCE_DISTANCE, 1.0f); ... //and for the listener I tried: alListenerf (AL_ROLLOFF_FACTOR, 01.05f);
Ok, I found the mistake myself - when setting the AL_REFERENCE_DISTANCE value, sound isn't attenuated below this distance.
When not setting any of the flags at all (and so everything is on default value) it works just fine...

This topic is closed to new replies.

Advertisement