Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged sound changes into sound2 use sound2 from now on

Location:
code/branches/sound2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound2

  • code/branches/sound2/src/orxonox/objects/items/Engine.cc

    r2662 r3013  
    3636#include "objects/worldentities/pawns/SpaceShip.h"
    3737#include "tools/Shader.h"
     38#include "sound/SoundBase.h"
    3839
    3940namespace orxonox
     
    6667        this->setConfigValues();
    6768        this->registerVariables();
     69
     70        this->sound_ = NULL;
    6871    }
    6972
     
    7679            if (this->boostBlur_)
    7780                delete this->boostBlur_;
     81
     82            if(this->sound_ != NULL)
     83                delete this->sound_;
    7884        }
    7985    }
     
    95101        XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
    96102        XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
     103
     104        XMLPortParamLoadOnly(Engine, "sound", loadSound, xmlelement, mode);
    97105    }
    98106
     
    219227    {
    220228        this->ship_ = ship;
     229
    221230        if (ship)
    222231        {
     
    230239                this->boostBlur_ = 0;
    231240            }
     241
     242            if(this->sound_ != NULL)
     243                this->sound_->attachToEntity(ship);
    232244        }
    233245    }
     
    240252            return Vector3::ZERO;
    241253    }
     254
     255    void Engine::loadSound(const std::string filename)
     256    {
     257        if(filename == "") return;
     258        else
     259        {
     260            if(this->sound_ == NULL)
     261            {
     262                this->sound_ = new SoundBase(this->ship_);
     263            }
     264
     265            this->sound_->loadFile(filename);
     266            this->sound_->play(true);
     267        }
     268    }
    242269}
  • code/branches/sound2/src/orxonox/objects/items/Engine.h

    r2662 r3013  
    107107            virtual const Vector3& getDirection() const;
    108108
     109            void loadSound(const std::string filename);
     110
    109111        private:
    110112            void networkcallback_shipID();
     
    129131            Shader* boostBlur_;
    130132            float blurStrength_;
     133
     134            SoundBase* sound_;
    131135    };
    132136}
Note: See TracChangeset for help on using the changeset viewer.