Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2013, 4:06:38 PM (10 years ago)
Author:
thiweber
Message:

A few changes..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sfxThilo/src/orxonox/sound/WorldAmbientSound.cc

    r9667 r9889  
    3333#include "core/XMLPort.h"
    3434#include "AmbientSound.h"
     35#include "core/command/ConsoleCommand.h"
     36#include <exception>
     37
    3538
    3639namespace orxonox
    3740{
     41        SetConsoleCommand("WorldAmbientSound", "nextsong",      &WorldAmbientSound::nextSong);
     42
    3843    RegisterClass(WorldAmbientSound);
    3944
     
    4449        this->ambientSound_ = new AmbientSound();
    4550        this->registerVariables();
     51        soundList_.push_back("Earth.ogg");
     52        soundList_.push_back("Jupiter.ogg");
     53        soundList_.push_back("Mars.ogg");
     54        soundList_.push_back("allgorythm-lift_up.ogg");
     55        soundList_.push_back("allgorythm-resonance_blaster.ogg");
     56        soundList_.push_back("AlphaCentauri.ogg");
     57        soundList_.push_back("Asteroid_rocks.ogg");
     58        soundList_.push_back("Ganymede.ogg");
     59        soundList_.push_back("luke_grey_-_hypermode.ogg");
     60
    4661    }
    47 
    4862    WorldAmbientSound::~WorldAmbientSound()
    4963    {
     
    5165        {
    5266            this->ambientSound_->destroy();
     67            WorldAmbientSound::soundList_.clear();
    5368        }
    5469    }
     
    94109            this->ambientSound_->stop();
    95110    }
     111
     112    void WorldAmbientSound::nextSong()
     113    {
     114
     115        //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used.
     116        for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin();
     117             it != ObjectList<WorldAmbientSound>::end(); ++it)
     118        {
     119                while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
     120                        WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
     121                }
     122                WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
     123        }
     124    }
    96125}
Note: See TracChangeset for help on using the changeset viewer.