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 copied

Legend:

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

    r5891 r5896  
    2121 *
    2222 *   Author:
    23  *       Erwin 'vaiursch' Herrsche
     23 *      Reto Grieder
    2424 *   Co-authors:
    2525 *      ...
    2626 *
    2727 */
    28 #ifndef _SoundBase_H__
    29 #define _SoundBase_H__
     28#ifndef _WorldSound_H__
     29#define _WorldSound_H__
    3030
    3131#include "OrxonoxPrereqs.h"
    32 #include <cstring> // define NULL
     32
     33#include "tools/interfaces/Tickable.h"
     34#include "sound/BaseSound.h"
     35#include "worldentities/StaticEntity.h"
    3336
    3437namespace orxonox
    3538{
    36     /**
    37      * The SoundBase class is the base class for all sound file loader classes.
    38      * It server as main interface to the OpenAL library.
    39      *
    40      */
    41     class _OrxonoxExport SoundBase
     39    /*
     40    @brief
     41        The WorldSound class is to be used for sounds with position and orientation.
     42    */
     43    class _OrxonoxExport WorldSound : public StaticEntity, public BaseSound, public Tickable
    4244    {
    4345    public:
    44         SoundBase(WorldEntity* entity = NULL);
    45         ~SoundBase();
     46        WorldSound(BaseObject* creator);
     47        virtual ~WorldSound();
    4648
    47         void attachToEntity(WorldEntity* entity);
    48         void update();
    49         void play(bool loop = false);
    50         void stop();
    51         void pause();
     49        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     50        virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    5251
    53         bool isPlaying();
    54         bool isPaused();
    55         bool isStopped();
     52        virtual void tick(float dt);
    5653
    57         bool loadFile(const std::string& filename);
     54        virtual void processEvent(Event& event);
    5855
    5956    private:
    60         ALuint loadOggFile(const std::string& filename);
    61         ALuint source_;
    62         ALuint buffer_;
    63         WorldEntity* entity_;
     57    };
     58}
    6459
    65         ALint getSourceState();
    66     }; // class SoundBase
    67 } // namepsace orxonox
    68 
    69 #endif /* _SoundBase_H__ */
     60#endif /* _WorldSound_H__ */
Note: See TracChangeset for help on using the changeset viewer.