Line | |
---|
1 | |
---|
2 | #include "resource_sound_buffer.h" |
---|
3 | #include "debug.h" |
---|
4 | |
---|
5 | |
---|
6 | namespace OrxSound |
---|
7 | { |
---|
8 | ObjectListDefinition(ResourceSoundBuffer); |
---|
9 | |
---|
10 | ResourceSoundBuffer::ResourceSoundBuffer(const std::string& soundName, const Resources::KeepLevel& keepLevel) |
---|
11 | : SoundBuffer(), Resource(&ResourceSoundBuffer::type) |
---|
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()); |
---|
25 | std::string fileName = this->Resource::locateFile(soundName); |
---|
26 | this->SoundBuffer::load(fileName); |
---|
27 | this->Resource::addResource(new ResourceSoundBuffer::SoundBufferResourcePointer(soundName, keepLevel, this->SoundBuffer::dataPointer())); |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | Resources::tType<ResourceSoundBuffer> ResourceSoundBuffer::type("SoundBuffer"); |
---|
33 | |
---|
34 | ResourceSoundBuffer::SoundBufferResourcePointer::SoundBufferResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const SoundBufferData::Pointer& data) |
---|
35 | : Resources::StorePointer(loadString, keepLevel) , pointer(data) |
---|
36 | {}} |
---|
Note: See
TracBrowser
for help on using the repository browser.