]> git.mxchange.org Git - simgear.git/commitdiff
Set to default distance attenuation function but change the parameters a but for...
authorehofman <ehofman>
Tue, 17 Nov 2009 13:06:32 +0000 (13:06 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 18 Nov 2009 22:25:51 +0000 (23:25 +0100)
simgear/sound/sample_group.cxx
simgear/sound/soundmgr_openal.cxx
simgear/sound/xmlsound.cxx

index dfe8d75656f6eaed69c263a7401e7aa022d045ce..bd1bf4851b238176f5c613a2d49a766cf30e034c 100644 (file)
@@ -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");
index ef4a8f153dd0956d07b895acb08151945d278877..b9e86488d0d4651c75585ac6fe1be25294bc3485 100644 (file)
@@ -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");
 
index 79a57c7f618e8764858144917c7be1552534bb32..479e312361d34c7bd631e1266a7034f6f2cf4a0a 100644 (file)
@@ -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
    //