Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2009, 9:20:47 AM (15 years ago)
Author:
rgrieder
Message:

Merged pch branch back to trunk.

Location:
code/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/sound/CMakeLists.txt

    r3078 r3196  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    2     SoundManager.h
    3     SoundBase.h
    4     SoundMainMenu.h
    5 
    62    SoundManager.cc
    73    SoundBase.cc
  • code/trunk/src/orxonox/sound/SoundBase.cc

    r3108 r3196  
    2626 *
    2727 */
     28
     29#include "SoundBase.h"
     30
     31#include <string>
    2832#include <vector>
    2933#include <AL/alut.h>
    3034#include <vorbis/vorbisfile.h>
    3135
     36#include "util/Math.h"
     37#include "core/Core.h"
    3238#include "orxonox/objects/worldentities/WorldEntity.h"
    33 #include "util/Math.h"
    34 #include "SoundBase.h"
    3539#include "SoundManager.h"
    36 #include "core/Core.h"
    3740
    3841namespace orxonox
    3942{
    40     SoundManager* SoundBase::soundmanager_s = NULL;
    41 
    4243    SoundBase::SoundBase(WorldEntity* entity)
    4344    {
    44         if(SoundBase::soundmanager_s == NULL)
    45         {
    46             SoundBase::soundmanager_s = new SoundManager();
    47         }
    48 
    4945        this->source_ = 0;
    5046        this->buffer_ = 0;
    5147        this->entity_ = entity;
    5248
    53         SoundBase::soundmanager_s->addSound(this);
     49        SoundManager::getInstance().addSound(this);
    5450    }
    5551
     
    141137        filename = Core::getMediaPathString() + "/audio/" + filename;
    142138
    143         if(!SoundBase::soundmanager_s->isSoundAvailable())
     139        if(!SoundManager::getInstance().isSoundAvailable())
    144140        {
    145141            COUT(3) << "Sound: not available, skipping " << filename << std::endl;
     
    179175    }
    180176
    181     ALuint SoundBase::loadOggFile(std::string filename)
     177    ALuint SoundBase::loadOggFile(const std::string& filename)
    182178    {
    183179        char inbuffer[4096];
  • code/trunk/src/orxonox/sound/SoundBase.h

    r3078 r3196  
    2626 *
    2727 */
    28 #ifndef _SOUNDBASE_H__
    29 #define _SOUNDBASE_H__
    30 
    31 #include <AL/al.h>
    32 #include <string>
     28#ifndef _SoundBase_H__
     29#define _SoundBase_H__
    3330
    3431#include "OrxonoxPrereqs.h"
     32#include <cstring> // define NULL
    3533
    3634namespace orxonox
     
    6058
    6159    private:
    62         ALuint loadOggFile(std::string filename);
     60        ALuint loadOggFile(const std::string& filename);
    6361        ALuint source_;
    6462        ALuint buffer_;
     
    6664
    6765        ALint getSourceState();
    68 
    69         static SoundManager* soundmanager_s;
    7066    }; // class SoundBase
    7167} // namepsace orxonox
    7268
    73 #endif // _SOUNDBASE_H__
     69#endif /* _SoundBase_H__ */
  • code/trunk/src/orxonox/sound/SoundMainMenu.cc

    r3078 r3196  
    2828
    2929#include "SoundMainMenu.h"
     30
    3031#include "core/CoreIncludes.h"
    3132#include "core/ConfigValueIncludes.h"
  • code/trunk/src/orxonox/sound/SoundMainMenu.h

    r3078 r3196  
    2727 */
    2828
    29 #ifndef _SOUNDMAINMENU_H__
    30 #define _SOUNDMAINMENU_H__
     29#ifndef _SoundMainMenu_H__
     30#define _SoundMainMenu_H__
     31
     32#include "OrxonoxPrereqs.h"
    3133
    3234#include <string>
    33 
    3435#include "core/OrxonoxClass.h"
    35 #include "OrxonoxPrereqs.h"
    3636#include "SoundBase.h"
    3737
     
    4848    };
    4949}
    50 #endif
     50
     51#endif /* _SoundMainMenu_H__ */
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r3108 r3196  
    2727 */
    2828
     29#include "SoundManager.h"
     30
    2931#include <AL/alut.h>
    3032
     33#include "util/Math.h"
    3134#include "orxonox/CameraManager.h"
    3235#include "orxonox/objects/worldentities/Camera.h"
    33 #include "util/Math.h"
    3436#include "SoundBase.h"
    35 #include "SoundManager.h"
    3637
    3738namespace orxonox
    3839{
     40    SoundManager* SoundManager::singletonRef_s = NULL;
    3941    ALCdevice* SoundManager::device_s = NULL;
    4042
     
    4446    SoundManager::SoundManager()
    4547    {
     48        assert(singletonRef_s == NULL);
     49        singletonRef_s = this;
     50
    4651        this->soundavailable_ = true;
    4752        if(!alutInitWithoutContext(NULL,NULL))
     
    9095    SoundManager::~SoundManager()
    9196    {
     97        assert(singletonRef_s != NULL);
     98        singletonRef_s = NULL;
     99
    92100        alcDestroyContext(this->context_);
    93101        alcCloseDevice(SoundManager::device_s);
  • code/trunk/src/orxonox/sound/SoundManager.h

    r3078 r3196  
    2525 *      ...
    2626 */
    27 #ifndef _SOUNDMANGER_H__
    28 #define _SOUNDMANGER_H__
    29 
    30 #include <AL/al.h>
    31 #include <AL/alc.h>
     27#ifndef _SoundManager_H__
     28#define _SoundManager_H__
    3229
    3330#include "OrxonoxPrereqs.h"
    34 #include "orxonox/objects/Tickable.h"
     31
     32#include <cassert>
     33#include <list>
     34#include "interfaces/Tickable.h"
    3535
    3636namespace orxonox
     
    4949        void addSound(SoundBase* sound);
    5050        void removeSound(SoundBase* sound);
    51         virtual void tick(float dt);
     51        void tick(float dt);
    5252        bool isSoundAvailable();
     53
     54        static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    5355
    5456    private:
     
    5860        bool soundavailable_;
    5961
     62        static SoundManager* singletonRef_s;
    6063    }; // class SoundManager
    6164} // namespace orxonox
    6265
    63 #endif // _SOUNDMANAGER_H__
     66#endif /* _SoundManager_H__ */
Note: See TracChangeset for help on using the changeset viewer.