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");
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");
}
- 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
//