Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 11, 2009, 5:55:26 PM (15 years ago)
Author:
youngk
Message:

Made a big change to the sound system: Implemented cross-fading for multiple changing sources.
Compiles, however the game doesn't load sounds properly in the main menu and on entering a level.
It can load a sound via DistanceTrigger and fades in/out correctly, but second loading fails.

Please test.

File:
1 edited

Legend:

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

    r6031 r6046  
    6565    {
    6666        COUT(3) << this->getSource() << ": Playing" << std::endl;
    67         SoundManager::getInstance().registerAmbientSound(this);
    68         SUPER(AmbientSound, play);
     67        if(GameMode::playsSound())
     68        {
     69            SoundManager::getInstance().registerAmbientSound(this);
     70            this->BaseSound::play();
     71        }
    6972    }
    7073
    7174    void AmbientSound::replay()
    7275    {
    73         SUPER(AmbientSound, play);
     76        this->BaseSound::play();
    7477    }
    7578
    7679    void AmbientSound::stop()
    7780    {
    78         SUPER(AmbientSound, stop);
    79         SoundManager::getInstance().unregisterAmbientSound(this);
     81        if(GameMode::playsSound())
     82        {
     83            SoundManager::getInstance().unregisterAmbientSound(this);
     84        }
    8085    }
    8186
    82     void AmbientSound::pause()
     87    void AmbientSound::doStop()
    8388    {
    84         SUPER(AmbientSound, pause);
     89        this->BaseSound::stop();
    8590    }
    8691
    8792    void AmbientSound::setSource(const std::string& source)
    8893    {
    89         if(source.find('/') == std::string.npos)
     94        if(source.find('/') == std::string.npos && GameMode::playsSound())
    9095        {
    9196            std::string filePath = SoundManager::getInstance().getAmbientPath(source);
    9297            if(!(filePath.empty()))
    9398            {
    94                 BaseSound::setSource(filePath);
     99                this->BaseSound::setSource(filePath);
    95100                return;
    96101            }
     
    102107    {
    103108        COUT(3) << this->getSource() << ": ChangedActivity: " << this->isActive() << std::endl;
    104         SUPER(AmbientSound, changedActivity);
     109        this->BaseObject::changedActivity();
    105110        if(this->isActive())
    106111        {
     
    112117        }
    113118    }
    114 
    115119}
Note: See TracChangeset for help on using the changeset viewer.