Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 6, 2009, 11:12:01 PM (15 years ago)
Author:
rgrieder
Message:

Added some basic sound classes: WorldSound (to be used for 3D sound, is a WorldEntity) and AmbientSound (BaseObject, just add it somewhere and it will play with playOnLoad=true).
Also moved the sound listener device updating to the HumanController. We might want to modify this again so that the listener is at the camera position again, not at the space ship.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/orxonox/sound/BaseSound.h

    r5891 r5896  
    2121 *
    2222 *   Author:
    23  *       Erwin 'vaiursch' Herrsche
     23 *      Erwin 'vaiursch' Herrsche
    2424 *   Co-authors:
    25  *      ...
     25 *      Reto Grieder
    2626 *
    2727 */
    28 #ifndef _SoundBase_H__
    29 #define _SoundBase_H__
     28#ifndef _BaseSound_H__
     29#define _BaseSound_H__
    3030
    3131#include "OrxonoxPrereqs.h"
    32 #include <cstring> // define NULL
     32
     33#include <string>
     34#include "core/OrxonoxClass.h"
    3335
    3436namespace orxonox
    3537{
    3638    /**
    37      * The SoundBase class is the base class for all sound file loader classes.
     39     * The BaseSound class is the base class for all sound file loader classes.
    3840     * It server as main interface to the OpenAL library.
    3941     *
    4042     */
    41     class _OrxonoxExport SoundBase
     43    class _OrxonoxExport BaseSound : virtual public OrxonoxClass
    4244    {
    4345    public:
    44         SoundBase(WorldEntity* entity = NULL);
    45         ~SoundBase();
     46        BaseSound();
     47        virtual ~BaseSound();
    4648
    47         void attachToEntity(WorldEntity* entity);
    48         void update();
    49         void play(bool loop = false);
     49        void play();
    5050        void stop();
    5151        void pause();
     
    5555        bool isStopped();
    5656
    57         bool loadFile(const std::string& filename);
     57        void setSoundFile(const std::string& soundFile);
     58        const std::string& getSoundFile() { return this->soundFile_; }
     59
     60        bool getPlayOnLoad() { return this->bPlayOnLoad_; }
     61        void setPlayOnLoad(bool val);
     62
     63        bool getLoop() { return this->bLoop_; }
     64        void setLoop(bool val) { this->bLoop_ = val; }
     65
     66    protected:
     67        //ALuint loadOggFile(const std::string& filename);
     68        ALint getSourceState();
     69
     70        ALuint source_;
     71        ALuint buffer_;
    5872
    5973    private:
    60         ALuint loadOggFile(const std::string& filename);
    61         ALuint source_;
    62         ALuint buffer_;
    63         WorldEntity* entity_;
     74        std::string soundFile_;
     75        bool bPlayOnLoad_;
     76        bool bLoop_;
     77    };
     78}
    6479
    65         ALint getSourceState();
    66     }; // class SoundBase
    67 } // namepsace orxonox
    68 
    69 #endif /* _SoundBase_H__ */
     80#endif /* _BaseSound_H__ */
Note: See TracChangeset for help on using the changeset viewer.