Rev | Line | |
---|
[9811] | 1 | |
---|
| 2 | #include "resource_sound_buffer.h" |
---|
| 3 | #include "debug.h" |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | namespace OrxSound |
---|
| 7 | { |
---|
| 8 | ObjectListDefinition(ResourceSoundBuffer); |
---|
| 9 | |
---|
[9854] | 10 | ResourceSoundBuffer::ResourceSoundBuffer(const std::string& soundName, const Resources::KeepLevel& keepLevel) |
---|
[9847] | 11 | : SoundBuffer(), Resource(&ResourceSoundBuffer::type) |
---|
[9811] | 12 | { |
---|
| 13 | this->registerObject(this, ResourceSoundBuffer::_objectList); |
---|
| 14 | Resources::StorePointer* ptr = this->acquireResource(soundName); |
---|
| 15 | |
---|
| 16 | if (ptr) |
---|
| 17 | { |
---|
| 18 | assert(!static_cast<ResourceSoundBuffer::SoundBufferResourcePointer*>(ptr)->ptr().isNull()); |
---|
| 19 | PRINTF(5)("FOUND SOUND: %s\n", soundName.c_str()); |
---|
| 20 | this->acquireData(static_cast<ResourceSoundBuffer::SoundBufferResourcePointer*>(ptr)->ptr()); |
---|
| 21 | } |
---|
| 22 | else |
---|
| 23 | { |
---|
| 24 | PRINTF(5)("SOUND NOT FOUND: %s\n", soundName.c_str()); |
---|
[9847] | 25 | std::string fileName = this->Resource::locateFile(soundName); |
---|
[9811] | 26 | this->SoundBuffer::load(fileName); |
---|
[9854] | 27 | this->Resource::addResource(new ResourceSoundBuffer::SoundBufferResourcePointer(soundName, keepLevel, this->SoundBuffer::dataPointer())); |
---|
[9811] | 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | |
---|
[9823] | 32 | Resources::tType<ResourceSoundBuffer> ResourceSoundBuffer::type("SoundBuffer"); |
---|
[9811] | 33 | |
---|
| 34 | ResourceSoundBuffer::SoundBufferResourcePointer::SoundBufferResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const SoundBufferData::Pointer& data) |
---|
| 35 | : Resources::StorePointer(loadString, keepLevel) , pointer(data) |
---|
[9823] | 36 | {}} |
---|
Note: See
TracBrowser
for help on using the repository browser.