Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/volumetric_fog/src/lib/sound/resource_sound_buffer.cc @ 10569

Last change on this file since 10569 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.4 KB
Line 
1
2#include "resource_sound_buffer.h"
3#include "debug.h"
4
5
6namespace 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.