From: ehofman Date: Tue, 17 Nov 2009 13:06:32 +0000 (+0000) Subject: Set to default distance attenuation function but change the parameters a but for... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6cd8db7b28b675f75ab22c2073832980d9f8d6a4;p=simgear.git Set to default distance attenuation function but change the parameters a but for better sound effects (and most of all quieter sounds at greta distance --- diff --git a/simgear/sound/sample_group.cxx b/simgear/sound/sample_group.cxx index dfe8d756..bd1bf485 100644 --- a/simgear/sound/sample_group.cxx +++ b/simgear/sound/sample_group.cxx @@ -144,7 +144,7 @@ void SGSampleGroup::update( double dt ) { ALboolean looping = sample->is_looping() ? AL_TRUE : AL_FALSE; alSourcei( source, AL_LOOPING, looping ); - alSourcef( source, AL_ROLLOFF_FACTOR, 1.0 ); + alSourcef( source, AL_ROLLOFF_FACTOR, 0.3 ); alSourcei( source, AL_SOURCE_RELATIVE, AL_FALSE ); alSourcePlay( source ); testForALError("sample play"); diff --git a/simgear/sound/soundmgr_openal.cxx b/simgear/sound/soundmgr_openal.cxx index ef4a8f15..b9e86488 100644 --- a/simgear/sound/soundmgr_openal.cxx +++ b/simgear/sound/soundmgr_openal.cxx @@ -133,13 +133,9 @@ void SGSoundMgr::init() { alDopplerFactor(1.0); alDopplerVelocity(340.3); // speed of sound in meters per second. -#if 0 - if ( alIsExtensionPresent((const ALchar*)"EXT_exponent_distance") ) { - alDistanceModel(AL_EXPONENT_DISTANCE); - } else { - alDistanceModel(AL_INVERSE_DISTANCE); - } -#endif + // gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + + // AL_ROLLOFF_FACTOR * (distance - AL_REFERENCE_DISTANCE)); + alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); testForALError("listener initialization"); diff --git a/simgear/sound/xmlsound.cxx b/simgear/sound/xmlsound.cxx index 79a57c7f..479e3123 100644 --- a/simgear/sound/xmlsound.cxx +++ b/simgear/sound/xmlsound.cxx @@ -174,9 +174,10 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node, } - float reference_dist = node->getDoubleValue("reference-dist", 500.0); - float max_dist = node->getDoubleValue("max-dist", 3000.0); - + // rule of thumb: make reference distance a 100th of the maximum distance. + float reference_dist = node->getDoubleValue("reference-dist", 60.0); + float max_dist = node->getDoubleValue("max-dist", 6000.0); + // // set pitch properties //