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

This commit is contained in:
ehofman
2009-11-17 13:06:32 +00:00
committed by Tim Moore
parent bb46d91bc6
commit 6cd8db7b28
3 changed files with 8 additions and 11 deletions

View 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");

View 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");

View 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
//