Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2009, 11:10:39 AM (14 years ago)
Author:
rgrieder
Message:

Little cleanup in sound stuff and MoodManager.
Caution: Renamed SoundTypes to {All, Music, Effects}!

File:
1 edited

Legend:

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

    r6340 r6370  
    145145    void BaseSound::setVolume(float vol)
    146146    {
    147         if (vol > 1 || vol < 0)
    148         {
    149             COUT(2) << "Sound warning: volume out of range, cropping value." << std::endl;
    150             vol = vol > 1 ? 1 : vol;
    151             vol = vol < 0 ? 0 : vol;
    152         }
    153         this->volume_ = vol;
    154        
     147        this->volume_ = clamp(vol, 0.0f, 1.0f);
     148        if (this->volume_ != vol)
     149            COUT(2) << "Sound warning: volume out of range, clamping value." << std::endl;
    155150        this->updateVolume();
    156151    }
    157152   
    158     float BaseSound::getVolumeGain()
    159     {
    160         assert(GameMode::playsSound());
    161         return SoundManager::getInstance().getVolume(SoundType::none);
    162     }
    163    
    164     void BaseSound::updateVolume(void)
    165     {
    166         if (alIsSource(this->audioSource_))
    167         {
    168             float volume = this->volume_ * this->getVolumeGain();
     153    void BaseSound::updateVolume()
     154    {
     155        if (alIsSource(this->audioSource_))
     156        {
     157            float volume = this->volume_ * this->getRealVolume();
    169158            alSourcef(this->audioSource_, AL_GAIN, volume);
    170159            if (int error = alGetError())
Note: See TracChangeset for help on using the changeset viewer.