Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/sound/resource_sound_buffer.cc @ 10663

Last change on this file since 10663 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
RevLine 
[9811]1
2#include "resource_sound_buffer.h"
3#include "debug.h"
4
5
6namespace 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.