Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/branches/openAL: added Buffer to the ResourceManager

File:
1 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/**
Note: See TracChangeset for help on using the changeset viewer.