Rev | Line | |
---|
[349] | 1 | #include "AudioBuffer.h" |
---|
| 2 | |
---|
| 3 | namespace audio |
---|
| 4 | { |
---|
| 5 | AudioBuffer::AudioBuffer(std::string fileName) |
---|
| 6 | { |
---|
[350] | 7 | // Load wav data into buffers. |
---|
| 8 | alGenBuffers(1, &buffer); |
---|
| 9 | |
---|
| 10 | if(alGetError() != AL_NO_ERROR) |
---|
| 11 | loaded=AL_FALSE; |
---|
| 12 | |
---|
| 13 | alutLoadWAVFile((ALbyte*)fileName.c_str(), &format, &data, &size, &freq, &loop); |
---|
| 14 | alBufferData(buffer, format, data, size, freq); |
---|
| 15 | alutUnloadWAV(format, data, size, freq); |
---|
| 16 | |
---|
| 17 | // Do another error check and return. |
---|
| 18 | if(alGetError() != AL_NO_ERROR) |
---|
| 19 | loaded=AL_FALSE; |
---|
| 20 | |
---|
| 21 | loaded=AL_TRUE; |
---|
[349] | 22 | } |
---|
| 23 | |
---|
| 24 | AudioBuffer::~AudioBuffer() |
---|
| 25 | { |
---|
| 26 | |
---|
| 27 | } |
---|
| 28 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.