| [4838] | 1 | /*! |
|---|
| [5386] | 2 | * @file sound_buffer.h |
|---|
| 3 | * @brief Definition of the sound-buffer-class |
|---|
| [3245] | 4 | */ |
|---|
| [1853] | 5 | |
|---|
| [5386] | 6 | #ifndef _SOUND_BUFFER_H |
|---|
| 7 | #define _SOUND_BUFFER_H |
|---|
| [1853] | 8 | |
|---|
| [3543] | 9 | #include "base_object.h" |
|---|
| [9869] | 10 | #include "sound_buffer_data.h" |
|---|
| [1853] | 11 | |
|---|
| [7460] | 12 | namespace OrxSound |
|---|
| [5386] | 13 | { |
|---|
| [7460] | 14 | //! A class that represents a datastructure to play Sounds. |
|---|
| [9869] | 15 | class SoundBuffer : virtual public BaseObject |
|---|
| [7460] | 16 | { |
|---|
| [9869] | 17 | ObjectListDeclaration(SoundBuffer); |
|---|
| [5386] | 18 | public: |
|---|
| [9869] | 19 | SoundBuffer(); |
|---|
| 20 | SoundBuffer(const SoundBuffer& buffer); |
|---|
| 21 | SoundBuffer(const SoundBufferData::Pointer& dataPointer); |
|---|
| [7221] | 22 | SoundBuffer(const std::string& fileName); |
|---|
| [6981] | 23 | virtual ~SoundBuffer(); |
|---|
| [3543] | 24 | |
|---|
| [9869] | 25 | /** @brief assignment operator */ |
|---|
| 26 | SoundBuffer& operator=(const SoundBuffer& buffer) { this->data = buffer.data; return *this; }; |
|---|
| 27 | bool operator==(const SoundBuffer& buffer) const {return this->data == buffer.data; }; |
|---|
| [6836] | 28 | |
|---|
| [9869] | 29 | /** @see SoundBufferData::load */ |
|---|
| 30 | inline bool load(const std::string& fileName) { return this->data->load(fileName); }; |
|---|
| 31 | /** @see SoundBufferData::loadWav */ |
|---|
| 32 | inline bool loadWAV(const std::string& fileName) { return this->data->loadWAV(fileName); }; |
|---|
| 33 | /** @see SoundBufferData::loadOgg */ |
|---|
| 34 | inline bool loadOGG(const std::string& fileName) { return this->data->loadOGG(fileName); }; |
|---|
| 35 | |
|---|
| [5386] | 36 | /** @returns the ID of the buffer used in this SoundBuffer */ |
|---|
| [9869] | 37 | inline ALuint getID() const { return this->data->getID(); } |
|---|
| 38 | inline bool loaded() const { return this->data->loaded(); } |
|---|
| [2036] | 39 | |
|---|
| [9869] | 40 | /** @returns the DataPointer */ |
|---|
| 41 | const SoundBufferData::Pointer& dataPointer() const { return data; } |
|---|
| 42 | /** @param dataPointer the data to acquire @brief Buffer shall acquire dataPointers data */ |
|---|
| 43 | void acquireData(const SoundBufferData::Pointer& dataPointer) { data = dataPointer; }; |
|---|
| [6836] | 44 | |
|---|
| 45 | private: |
|---|
| [9869] | 46 | SoundBufferData::Pointer data; //!< Pointer to the Stored Data |
|---|
| [7460] | 47 | }; |
|---|
| 48 | } |
|---|
| [5386] | 49 | #endif /* _SOUND_BUFFER_H */ |
|---|