X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fsound%2Fsoundmgr_openal.cxx;h=6066a560c32d1d22cc49679b387171fe0a8807d9;hb=afb18ca75b90e5a2e0bf791ba2e38812128ab0a8;hp=4cf3a63c3bb3a4c7ed3e3e65a6c865e2d234d2b3;hpb=e3f70b712545bc42a43175a2a88174dacce9ce73;p=simgear.git diff --git a/simgear/sound/soundmgr_openal.cxx b/simgear/sound/soundmgr_openal.cxx index 4cf3a63c..6066a560 100644 --- a/simgear/sound/soundmgr_openal.cxx +++ b/simgear/sound/soundmgr_openal.cxx @@ -133,11 +133,9 @@ void SGSoundMgr::init() { alDopplerFactor(1.0); alDopplerVelocity(340.3); // speed of sound in meters per second. - if ( alIsExtensionPresent((const ALchar*)"EXT_exponent_distance") ) { - alDistanceModel(AL_EXPONENT_DISTANCE); - } else { - alDistanceModel(AL_INVERSE_DISTANCE); - } + // gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + + // AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE)); + alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); testForALError("listener initialization"); @@ -263,7 +261,6 @@ if (isNaN(_at_up_vec)) printf("NaN in listener orientation\n"); if (isNaN(toVec3f(_absolute_pos).data())) printf("NaN in listener position\n"); if (isNaN(_velocity.data())) printf("NaN in listener velocity\n"); #endif - update_pos_and_orientation(); alListenerf( AL_GAIN, _volume ); alListenerfv( AL_ORIENTATION, _at_up_vec ); // alListenerfv( AL_POSITION, toVec3f(_absolute_pos).data() ); @@ -326,6 +323,7 @@ SGSampleGroup *SGSoundMgr::find( const string &refname, bool create ) { // sample group was not found. if (create) { SGSampleGroup* sgrp = new SGSampleGroup(this, refname); + add( sgrp, refname ); return sgrp; } else