Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 21, 2009, 5:28:13 PM (15 years ago)
Author:
youngk
Message:

Ambient Sounds are now locationally triggerable, i.e if the player comes close to an object, it's own ambient sound starts playing, while the sound of the outer object is paused. Upon leaving proximity of that object, the old sound is resumed. —> Triggerable by changing active state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound3/src/orxonox/sound/SoundManager.cc

    r5946 r5982  
    3636#include "core/GameMode.h"
    3737#include "core/ScopedSingletonManager.h"
     38#include "BaseSound.h"
    3839
    3940namespace orxonox
     
    114115            COUT(2) << "Sound: OpenAL: Invalid listener orientation" << std::endl;
    115116    }
     117
     118    void SoundManager::registerAmbientSound(BaseSound* newAmbient)
     119    {
     120        if (!(this->ambientSounds_.empty()))
     121        {
     122            this->ambientSounds_.front()->pause();
     123        }
     124        this->ambientSounds_.push_front(newAmbient);
     125    }
     126
     127    void SoundManager::unregisterAmbientSound(BaseSound* currentAmbient)
     128    {
     129        if(this->ambientSounds_.front() == currentAmbient)
     130        {
     131            this->ambientSounds_.pop_front();
     132            this->ambientSounds_.front()->replay();
     133        }
     134        else
     135        {
     136            for(std::list<BaseSound*>::iterator it= this->ambientSounds_.begin(); it != this->ambientSounds_.end(); it++)
     137            {
     138                if(*it == currentAmbient)
     139                {
     140                    this->ambientSounds_.erase(it);
     141                    break;
     142                }
     143            }
     144        }
     145    }
    116146}
Note: See TracChangeset for help on using the changeset viewer.