Last change
on this file since 6146 was
5930,
checked in by bensch, 19 years ago
|
orxonox/trunk: remake of the SoundEngine (faster, and millions of SoundSources can be defined, as Many are not needed for playing
|
File size:
1.5 KB
|
Rev | Line | |
---|
[4838] | 1 | /*! |
---|
[5386] | 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 SoundBuffer; |
---|
| 14 | class PNode; |
---|
[3543] | 15 | |
---|
[5386] | 16 | //! A class that represents a SoundSource |
---|
| 17 | class SoundSource : public BaseObject |
---|
| 18 | { |
---|
| 19 | public: |
---|
| 20 | SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL); |
---|
| 21 | ~SoundSource(); |
---|
[3543] | 22 | |
---|
[5386] | 23 | // user interaction |
---|
| 24 | void play(); |
---|
| 25 | void play(const SoundBuffer* buffer); |
---|
| 26 | void stop(); |
---|
| 27 | void pause(); |
---|
| 28 | void rewind(); |
---|
[2036] | 29 | |
---|
[5386] | 30 | // development functions |
---|
| 31 | /** @returns The ID of this Source */ |
---|
| 32 | inline ALuint getID() const { return this->sourceID; } |
---|
[5930] | 33 | /** @returns true, if the Source is Playing */ |
---|
| 34 | inline bool isPlaying() const { return this->bPlay; }; |
---|
[5386] | 35 | /** @returns the SoundBuffer of this Source */ |
---|
| 36 | inline const SoundBuffer* getBuffer() const { return this->buffer; } |
---|
| 37 | /** @returns the SourceNode of this Source */ |
---|
| 38 | inline const PNode* getNode() const { return this->sourceNode;} |
---|
[1853] | 39 | |
---|
[5386] | 40 | void setRolloffFactor(ALfloat rolloffFactor); |
---|
[1853] | 41 | |
---|
[5386] | 42 | private: |
---|
[5917] | 43 | bool bPlay; //!< If the Source is Playing. |
---|
[5386] | 44 | ALuint sourceID; //!< The ID of the Source |
---|
| 45 | const SoundBuffer* buffer; //!< The buffer to play in this source. |
---|
| 46 | const PNode* sourceNode; //!< The SourceNode represente the position/velocity... of this source. |
---|
[1853] | 47 | }; |
---|
[5386] | 48 | #endif /* _SOUND_SOURCE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.