Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2009, 9:25:16 PM (15 years ago)
Author:
bknecht
Message:

merged sound changes into sound2 use sound2 from now on

Location:
code/branches/sound2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound2

  • code/branches/sound2/src/orxonox/objects/Level.cc

    r2911 r3013  
    4141#include "objects/gametypes/Gametype.h"
    4242#include "overlays/OverlayGroup.h"
     43#include "sound/SoundBase.h"
    4344
    4445#include "util/Math.h"
     
    6869            if (this->xmlfile_)
    6970                Loader::unload(this->xmlfile_);
     71
     72            if(this->ambientsound_ != NULL)
     73                delete this->ambientsound_;
    7074        }
    7175    }
     
    7781        XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
    7882        XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
     83
     84        XMLPortParamLoadOnly(Level, "ambientsound", loadAmbientSound, xmlelement, mode);
    7985
    8086        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
     
    148154    }
    149155
     156    void Level::loadAmbientSound(const std::string& filename)
     157    {
     158        if(filename == "") return;
     159        else
     160        {
     161            if(this->ambientsound_ == NULL)
     162            {
     163                this->ambientsound_ = new SoundBase();
     164            }
     165
     166            this->ambientsound_->loadFile(filename);
     167            this->ambientsound_->play(true);
     168        }
     169    }
     170
    150171    void Level::playerEntered(PlayerInfo* player)
    151172    {
Note: See TracChangeset for help on using the changeset viewer.