/*! \file sound_engine.h \brief Definition of the SoundEngine singleton Class */ #ifndef _SOUND_ENGINE_H #define _SOUND_ENGINE_H #include "base_object.h" #include "alincl.h" // FORWARD DEFINITION class PNode; template class tList; //! A class that represents a datastructure to play Sounds. class SoundBuffer { public: SoundBuffer(const char* fileName); ~SoundBuffer(void); private: ALuint bufferID; //!< The address of the Buffer. ALsizei size; //!< The size of the Buffer. ALboolean loop; //!< loop information. }; //! A class that represents a SoundSource class SoundSource { public: SoundSource(SoundBuffer* buffer, PNode* sourceNode = NULL); ~SoundSource(void); /** \retruns The ID of the Source */ inline ALuint getID(void) { return this->sourceID; } /** \returns the SourceNode of this Source */ inline PNode* getNode(void) { return this->sourceNode;} private: ALuint sourceID; //!< The ID of the Source SoundBuffer* buffer; //!< The buffer to play in this source. PNode* sourceNode; //!< The SourceNode represente the position/velocity... of this source. }; //! A class that handles audio via the openAudioLibrary class SoundEngine : public BaseObject { public: static SoundEngine* getInstance(void); virtual ~SoundEngine(void); void setListener(PNode* listener); void addBuffer(SoundBuffer* buffer); void removeBuffer(SoundBuffer* buffer); void addSource(SoundSource* source); void removeSource(SoundSource* source); void update(void); private: SoundEngine(void); static SoundEngine* singletonRef; bool initAudio(void); PNode* listener; //!< The listener of the Scene tList* bufferList; //!< A list of buffers tList* sourceList; //!< A list for all the sources in the scene. }; #endif /* _SOUND_ENGINE_H */