Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5683 was 5405, checked in by bensch, 19 years ago

orxonox/trunk: renamed definition to the right term declaration…

File size: 2.4 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
[4506]15#define SOUND_DOPPLER_FACTOR       0.001          //!< A factor for the audible doppler effect
16#define SOUND_DOPPLER_VELOCITY     5000000        //!< A factor for the TravelSpeed of sound
[4504]17
[5405]18// FORWARD DECLARATION
[4504]19class PNode;
20template<class T> class tList;
[4985]21class IniParser;
[4504]22
23//! A class that handles audio via the openAudioLibrary
24class SoundEngine : public BaseObject {
25
[4959]26  public:
27    virtual ~SoundEngine();
28    /** @returns a Pointer to the only object of this Class */
[5216]29    inline static SoundEngine* getInstance() { if (!SoundEngine::singletonRef) SoundEngine::singletonRef = new SoundEngine();  return SoundEngine::singletonRef; };
[4504]30
[4985]31    void loadSettings(IniParser* iniParser);
32
[4959]33    SoundSource* createSource(const char* fileName, PNode* sourceNode = NULL);
[4504]34
[4961]35    /** @param listener the listener in the scene */
36    void setListener(PNode* listener) { this->listener = listener; };
[4959]37    void setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity);
[4504]38
39
[4985]40    /** @returns the Music Volume in % */
41    inline float getMusicVolume() { return this->musicVolume; };
42    /** @returns the Effects Volume in % */
43    inline float getEffectsVolume() { return this->effectsVolume; };
44
[4961]45    void update();
46
47  // administrative
[4959]48    void addBuffer(SoundBuffer* buffer);
49    void removeBuffer(SoundBuffer* buffer);
50    void addSource(SoundSource* source);
[4504]51
[4959]52    void flushUnusedBuffers();
53    void flushAllBuffers();
54    void flushAllSources();
55    bool initAudio();
[4504]56
57  // error handling:
[4959]58    static void PrintALErrorString(ALenum err);
[4504]59  //  static void PrintALCErrorString(ALenum err);
60
61
[4959]62  private:
63    SoundEngine();
64    void listDevices();
[4504]65
[4959]66  private:
67    static SoundEngine*      singletonRef;             //!< Reference to this class
[4504]68
[4985]69    float                    musicVolume;              //!< the maximum volume of the music in % (0f,1f]
70    float                    effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
[4959]71    PNode*                   listener;                 //!< The listener of the Scene
[4960]72    tList<BaseObject>*       bufferList;               //!< A list of buffers
73    tList<BaseObject>*       sourceList;               //!< A list for all the sources in the scene.
[4959]74
[4504]75};
76
77#endif /* _SOUND_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.