Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4204 in orxonox.OLD for orxonox/branches/openAL/src


Ignore:
Timestamp:
May 17, 2005, 2:05:57 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/openAL: added Buffer to the ResourceManager

Location:
orxonox/branches/openAL/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/openAL/src/lib/sound/sound_engine.cc

    r4203 r4204  
    2424#include "list.h"
    2525#include "AL/alc.h"
    26 
     26#include "resource_manager.h"
    2727using namespace std;
    2828
     
    164164  SoundEngine::singletonRef = NULL;
    165165
    166 }
     166  // deleting all the Resources
     167  tIterator<SoundSource>* sourceIterator = this->sourceList->getIterator();
     168  SoundSource* enumSource = sourceIterator->nextElement();
     169  while (enumSource)
     170    {
     171      delete enumSource;
     172      enumSource = sourceIterator->nextElement();
     173    }
     174  delete sourceIterator;
     175
     176  tIterator<SoundBuffer>* bufferIterator = this->bufferList->getIterator();
     177  SoundBuffer* enumBuffer = bufferIterator->nextElement();
     178  while (enumBuffer)
     179    {
     180      ResourceManager::getInstance()->unload(enumBuffer);
     181      enumBuffer = bufferIterator->nextElement();
     182    }
     183  delete bufferIterator;
     184}
     185
     186/**
     187   \brief creates a new SoundSource.
     188   \param fileName The Name to load the SoundBuffer from
     189   \param The sourceNode to bind this SoundSource to.
     190   \returns The newly created SoundSource
     191
     192   acctualy this is nothing more than a wrapper around the ResourceManager.
     193*/
     194SoundSource* SoundEngine::createSource(const char* fileName, PNode* sourceNode)
     195{
     196  return new SoundSource((SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL), sourceNode);
     197}
     198
    167199
    168200/**
  • orxonox/branches/openAL/src/lib/sound/sound_engine.h

    r4203 r4204  
    7171  virtual ~SoundEngine(void);
    7272
     73  SoundSource* createSource(const char* fileName, PNode* sourceNode);
     74
    7375  void setListener(PNode* listener);
    7476
  • orxonox/branches/openAL/src/story_entities/world.cc

    r4200 r4204  
    491491  SoundEngine::getInstance()->setListener(tn);
    492492  SoundBuffer* tBuffer = new SoundBuffer(ResourceManager::getFullName("sound/explo.wav"));
    493   SoundSource* tSound = new SoundSource(tBuffer, this->localPlayer);
    494   tSound->setRolloffFactor(0.1);
     493  SoundSource* tSound = SoundEngine::getInstance()->createSource("sound/explo.wav", this->localPlayer);
     494  tSound->setRolloffFactor(0);
    495495  tSound->play();
    496496
  • orxonox/branches/openAL/src/util/resource_manager.cc

    r4194 r4204  
    2323#include "texture.h"
    2424#include "text_engine.h"
     25#include "sound_engine.h"
    2526
    2627#include "list.h"
     
    284285          else
    285286            PRINTF(2)("Sorry, %s does not exist. Not loading Font\n", fullName);
     287          break;
     288        case WAV:
     289          if(isFile(fullName))
     290            tmpResource->pointer = new SoundBuffer(fullName);
    286291          break;
    287292        case IMAGE:
     
    369374            case IMAGE:
    370375              delete (Texture*)resource->pointer;
     376              break;
     377            case WAV:
     378              delete (SoundBuffer*)resource->pointer;
    371379              break;
    372380            case TTF:
Note: See TracChangeset for help on using the changeset viewer.