Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 4, 2009, 3:40:08 PM (16 years ago)
Author:
erwin
Message:

ambient sound loading for levels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound/src/orxonox/objects/Level.cc

    r2826 r2950  
    7777        XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
    7878        XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
     79       
     80        XMLPortParamLoadOnly(Level, "ambientsound", loadAmbientSound, xmlelement, mode);
    7981
    8082        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
     
    148150    }
    149151
     152    void Level::loadAmbientSound(const std::string& filename)
     153    {
     154        if(filename == "") return;
     155        else
     156        {
     157            if(this->ambientsound_ == NULL)
     158            {
     159                this->ambientsound_ = new SoundBase();
     160                this->sndmgr_.addSound(this->ambientsound_);
     161            }
     162
     163            this->ambientsound_->loadFile(filename);
     164            this->ambientsound_->play();
     165        }
     166    }
     167
    150168    void Level::playerEntered(PlayerInfo* player)
    151169    {
Note: See TracChangeset for help on using the changeset viewer.