| [4838] | 1 | /*! | 
|---|
| [8255] | 2 | * @file sound_source.h | 
|---|
 | 3 | * @brief Definition of the SoundSource. | 
|---|
| [3245] | 4 | */ | 
|---|
| [1853] | 5 |  | 
|---|
| [5386] | 6 | #ifndef _SOUND_SOURCE_H | 
|---|
 | 7 | #define _SOUND_SOURCE_H | 
|---|
| [1853] | 8 |  | 
|---|
| [3543] | 9 | #include "base_object.h" | 
|---|
| [5386] | 10 | #include "alincl.h" | 
|---|
| [1853] | 11 |  | 
|---|
| [4838] | 12 | // FORWARD DECLARATION | 
|---|
| [5386] | 13 | class PNode; | 
|---|
| [7460] | 14 | namespace OrxSound | 
|---|
| [5386] | 15 | { | 
|---|
| [8255] | 16 |         class SoundBuffer; | 
|---|
 | 17 |         //! A class that represents a SoundSource | 
|---|
 | 18 |         class SoundSource : public BaseObject | 
|---|
 | 19 |         { | 
|---|
 | 20 |                 public: | 
|---|
 | 21 |                         SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL); | 
|---|
 | 22 |                         SoundSource(const SoundSource& source); | 
|---|
 | 23 |                         SoundSource& operator=(const SoundSource& source); | 
|---|
 | 24 |                         bool operator==(const SoundSource& source); | 
|---|
 | 25 |                          | 
|---|
 | 26 |                         virtual ~SoundSource(); | 
|---|
 | 27 |                          | 
|---|
 | 28 |                         // user interaction | 
|---|
 | 29 |                         void play(); | 
|---|
 | 30 |                         void play(const SoundBuffer* buffer); | 
|---|
 | 31 |                         void play(const SoundBuffer* buffer, float gain); | 
|---|
| [8495] | 32 |       void play(const SoundBuffer* buffer, float gain, bool loop);    | 
|---|
 | 33 |  | 
|---|
| [8255] | 34 |                         void stop(); | 
|---|
 | 35 |                         void pause(); | 
|---|
 | 36 |                         void rewind(); | 
|---|
 | 37 |                         void fadein(const SoundBuffer* buffer, ALfloat duration); | 
|---|
 | 38 |                          | 
|---|
 | 39 |                          | 
|---|
 | 40 |                         // development functions | 
|---|
 | 41 |                         /** @returns The ID of this Source */ | 
|---|
 | 42 |                         inline ALuint getID() const { return this->sourceID; }; | 
|---|
 | 43 |                         /** @returns true, if the Source is Playing */ | 
|---|
 | 44 |                         inline bool   isPlaying() const { return this->bPlay; }; | 
|---|
 | 45 |                         void setSourceNode(const PNode* sourceNode); | 
|---|
 | 46 |                         /** @returns the SoundBuffer of this Source */ | 
|---|
 | 47 |                         inline const SoundBuffer* getBuffer() const { return this->buffer; }; | 
|---|
 | 48 |                         /** @returns the SourceNode of this Source */ | 
|---|
 | 49 |                         inline const PNode* getNode() const { return this->sourceNode; }; | 
|---|
 | 50 |                         /** @param resident if the Source is Resident */ | 
|---|
 | 51 |                         inline void setResident(bool resident) { this->resident = resident; }; | 
|---|
 | 52 |                         /** @returns true if the alSource is Resident */ | 
|---|
 | 53 |                         inline bool isResident() const { return this->resident; }; | 
|---|
 | 54 |                          | 
|---|
 | 55 |                         void setRolloffFactor(ALfloat rolloffFactor); | 
|---|
 | 56 |                          | 
|---|
 | 57 |                         static void resetSource(ALuint sourceID); | 
|---|
 | 58 |                  | 
|---|
 | 59 |                 private: | 
|---|
 | 60 |                         bool retrieveSource(); | 
|---|
 | 61 |                          | 
|---|
 | 62 |                 private: | 
|---|
 | 63 |                         bool                   bPlay;           //!< If the Source is Playing. | 
|---|
 | 64 |                         bool                   resident;        //!< If the alSource should be resident (if true, the alSource will be returned on deletion). | 
|---|
 | 65 |                         ALuint                 sourceID;        //!< The ID of the Source | 
|---|
 | 66 |                         const SoundBuffer*     buffer;          //!< The buffer to play in this source. | 
|---|
 | 67 |                         const PNode*           sourceNode;      //!< The SourceNode representing the position/velocity... of this source. | 
|---|
 | 68 |         }; | 
|---|
| [7460] | 69 | } | 
|---|
| [5386] | 70 | #endif /* _SOUND_SOURCE_H */ | 
|---|