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/AmbientSound.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 _AmbientSound_H__
     29#define _AmbientSound_H__
    3030
    3131#include "OrxonoxPrereqs.h"
    32 #include <cstring> // define NULL
     32
     33#include "core/BaseObject.h"
     34#include "sound/BaseSound.h"
    3335
    3436namespace orxonox
    3537{
    3638    /**
    37      * The SoundBase class is the base class for all sound file loader classes.
     39     * The AmbientSound 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 AmbientSound : public BaseSound, public BaseObject
    4244    {
    4345    public:
    44         SoundBase(WorldEntity* entity = NULL);
    45         ~SoundBase();
     46        AmbientSound(BaseObject* creator);
     47        virtual ~AmbientSound();
    4648
    47         void attachToEntity(WorldEntity* entity);
    48         void update();
    49         void play(bool loop = false);
    50         void stop();
    51         void pause();
    52 
    53         bool isPlaying();
    54         bool isPaused();
    55         bool isStopped();
    56 
    57         bool loadFile(const std::string& filename);
     49        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     50        virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    5851
    5952    private:
    60         ALuint loadOggFile(const std::string& filename);
    61         ALuint source_;
    62         ALuint buffer_;
    63         WorldEntity* entity_;
     53    };
     54}
    6455
    65         ALint getSourceState();
    66     }; // class SoundBase
    67 } // namepsace orxonox
    68 
    69 #endif /* _SoundBase_H__ */
     56#endif /* _AmbientSound_H__ */
Note: See TracChangeset for help on using the changeset viewer.