Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2009, 4:52:45 PM (15 years ago)
Author:
rgrieder
Message:

Added new XML parameter for the Scene: soundReferenceDistance.
This value represents the distance to a sound source where the gain is still 1.0. Further away it will decrease with 1/(distance - soundReferenceDistance).
Default value is 20.

Location:
code/branches/presentation2/src/orxonox/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/sound/BaseSound.cc

    r6370 r6372  
    132132        alSource3f(this->audioSource_, AL_VELOCITY,  0, 0, 0);
    133133        alSource3f(this->audioSource_, AL_DIRECTION, 0, 0, 0);
    134         alSourcei(this->audioSource_, AL_REFERENCE_DISTANCE, 20);
    135         alSourcei(this->audioSource_, AL_MAX_DISTANCE, 10000);
    136134        if (ALint error = alGetError())
    137135            COUT(2) << "Sound Warning: Setting source parameters to 0 failed: "
  • code/branches/presentation2/src/orxonox/sound/WorldSound.cc

    r6370 r6372  
    3535#include "core/EventIncludes.h"
    3636#include "core/XMLPort.h"
     37#include "Scene.h"
    3738#include "SoundManager.h"
    3839#include <core/ConsoleCommandCompilation.h>
     
    7980    {
    8081        BaseSound::initialiseSource();
     82        if (this->getScene())
     83        {
     84            float refDist = this->getScene()->getSoundReferenceDistance();
     85            alSourcei(this->audioSource_, AL_REFERENCE_DISTANCE, refDist);
     86            // TODO: 500 is very magical here. Derive something better
     87            alSourcei(this->audioSource_, AL_MAX_DISTANCE, refDist * 500);
     88        }
    8189        this->tick(0); // update position, orientation and velocity
    8290    }
Note: See TracChangeset for help on using the changeset viewer.