Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/sound/sound_engine.h @ 5849

Last change on this file since 5849 was 5819, checked in by bensch, 19 years ago

orxonox/trunk: merged branches world_entities to trunk again
merged with command
svn merge -r5795:HEAD branches/world_entities/ trunk/
no conflicts (what a wonder)

File size: 2.6 KB
RevLine 
[4597]1/*!
[4959]2 * @file sound_engine.h
3 * Definition of the SoundEngine singleton Class
4 */
[4504]5
6#ifndef _SOUND_ENGINE_H
7#define _SOUND_ENGINE_H
8
9#include "base_object.h"
10#include "alincl.h"
11
[5386]12#include "sound_buffer.h"
13#include "sound_source.h"
14
[5779]15#include <list>
16
[4506]17#define SOUND_DOPPLER_FACTOR       0.001          //!< A factor for the audible doppler effect
18#define SOUND_DOPPLER_VELOCITY     5000000        //!< A factor for the TravelSpeed of sound
[4504]19
[5405]20// FORWARD DECLARATION
[4504]21class PNode;
[4985]22class IniParser;
[4504]23
24//! A class that handles audio via the openAudioLibrary
25class SoundEngine : public BaseObject {
26
[4959]27  public:
28    virtual ~SoundEngine();
29    /** @returns a Pointer to the only object of this Class */
[5216]30    inline static SoundEngine* getInstance() { if (!SoundEngine::singletonRef) SoundEngine::singletonRef = new SoundEngine();  return SoundEngine::singletonRef; };
[4504]31
[4985]32    void loadSettings(IniParser* iniParser);
33
[4959]34    SoundSource* createSource(const char* fileName, PNode* sourceNode = NULL);
[4504]35
[4961]36    /** @param listener the listener in the scene */
37    void setListener(PNode* listener) { this->listener = listener; };
[4959]38    void setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity);
[4504]39
40
[4985]41    /** @returns the Music Volume in % */
42    inline float getMusicVolume() { return this->musicVolume; };
43    /** @returns the Effects Volume in % */
44    inline float getEffectsVolume() { return this->effectsVolume; };
45
[4961]46    void update();
47
48  // administrative
[4959]49    void addBuffer(SoundBuffer* buffer);
50    void removeBuffer(SoundBuffer* buffer);
51    void addSource(SoundSource* source);
[4504]52
[4959]53    void flushUnusedBuffers();
54    void flushAllBuffers();
55    void flushAllSources();
56    bool initAudio();
[4504]57
58  // error handling:
[4959]59    static void PrintALErrorString(ALenum err);
[4504]60  //  static void PrintALCErrorString(ALenum err);
61
62
[4959]63  private:
64    SoundEngine();
65    void listDevices();
[4504]66
[4959]67  private:
68    static SoundEngine*      singletonRef;             //!< Reference to this class
[4504]69
[5819]70    ALCdevice*               device;                   //!< the used audio-device.
71    ALCcontext*              context;                  //!< the context, currently in use.
72
[4985]73    float                    musicVolume;              //!< the maximum volume of the music in % (0f,1f]
74    float                    effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
[4959]75    PNode*                   listener;                 //!< The listener of the Scene
[5819]76
[5779]77    std::list<BaseObject*>*  bufferList;               //!< A list of buffers
78    std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
[4959]79
[5819]80
[4504]81};
82
83#endif /* _SOUND_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.