1 | /*! |
---|
2 | * @file sound_buffer.h |
---|
3 | * @brief Definition of the sound-buffer-class |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _SOUND_BUFFER_H |
---|
7 | #define _SOUND_BUFFER_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "sound_buffer_data.h" |
---|
11 | |
---|
12 | namespace OrxSound |
---|
13 | { |
---|
14 | //! A class that represents a datastructure to play Sounds. |
---|
15 | class SoundBuffer : virtual public BaseObject |
---|
16 | { |
---|
17 | ObjectListDeclaration(SoundBuffer); |
---|
18 | public: |
---|
19 | SoundBuffer(); |
---|
20 | SoundBuffer(const SoundBuffer& buffer); |
---|
21 | SoundBuffer(const SoundBufferData::Pointer& dataPointer); |
---|
22 | SoundBuffer(const std::string& fileName); |
---|
23 | virtual ~SoundBuffer(); |
---|
24 | |
---|
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; }; |
---|
28 | |
---|
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 | |
---|
36 | /** @returns the ID of the buffer used in this SoundBuffer */ |
---|
37 | inline ALuint getID() const { return this->data->getID(); } |
---|
38 | inline bool loaded() const { return this->data->loaded(); } |
---|
39 | |
---|
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; }; |
---|
44 | |
---|
45 | private: |
---|
46 | SoundBufferData::Pointer data; //!< Pointer to the Stored Data |
---|
47 | }; |
---|
48 | } |
---|
49 | #endif /* _SOUND_BUFFER_H */ |
---|