Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4597 in orxonox.OLD for orxonox/trunk/src/lib/sound


Ignore:
Timestamp:
Jun 11, 2005, 12:55:48 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: setClassID implemented in all files

Location:
orxonox/trunk/src/lib/sound
Files:
2 edited

Legend:

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

    r4519 r4597  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    4040SoundBuffer::SoundBuffer(const char* fileName)
    4141{
     42  this->setClassID(CL_SOUND_BUFFER, "SoundBuffer");
     43  this->setName(fileName);
     44
    4245  SoundEngine::getInstance()->addBuffer(this);
    4346
     
    4548  ALvoid* data;
    4649  ALsizei freq;
    47  
     50
    4851  ALenum result;
    4952
     
    5760  if ((result = alGetError()) != AL_NO_ERROR)
    5861    SoundEngine::PrintALErrorString(result);
    59  
     62
    6063  // send the loaded wav data to the buffer
    6164  alBufferData(this->bufferID, format, data, this->size, freq);
     
    8386SoundSource::SoundSource(SoundBuffer* buffer, PNode* sourceNode)
    8487{
     88  this->setClassID(CL_SOUND_SOURCE, "SoundSource");
     89
    8590  ALenum result;
    8691
     
    161166   \brief standard constructor
    162167*/
    163 SoundEngine::SoundEngine ()
    164 {
    165   this->setClassName ("SoundEngine");
    166  
     168SoundEngine::SoundEngine ()
     169{
     170  this->setClassID(CL_SOUND_ENGINE, "SoundEngine");
     171  this->setName("SoundEngine");
     172
    167173  this->listener = NULL;
    168174  this->bufferList = new tList<SoundBuffer>;
     
    179185
    180186*/
    181 SoundEngine::~SoundEngine () 
     187SoundEngine::~SoundEngine ()
    182188{
    183189  SoundEngine::singletonRef = NULL;
     
    262268    {
    263269      if (buffer == enumSource->getBuffer())
    264         delete enumSource;
     270        delete enumSource;
    265271      enumSource = sourceIterator->nextElement();
    266272    }
     
    300306    {
    301307      alListener3f(AL_POSITION,
    302                    this->listener->getAbsCoor().x,
    303                    this->listener->getAbsCoor().y,
    304                    this->listener->getAbsCoor().z);
     308                   this->listener->getAbsCoor().x,
     309                   this->listener->getAbsCoor().y,
     310                   this->listener->getAbsCoor().z);
    305311      alListener3f(AL_VELOCITY,
    306                    this->listener->getVelocity().x,
    307                    this->listener->getVelocity().y,
    308                    this->listener->getVelocity().z);
     312                   this->listener->getVelocity().x,
     313                   this->listener->getVelocity().y,
     314                   this->listener->getVelocity().z);
    309315      Vector absDirV = this->listener->getAbsDirV();
    310316      ALfloat orientation [6] = {1,0,0, absDirV.x, absDirV.y, absDirV.z};
     
    321327      if (likely(enumSource->getNode()!=NULL))
    322328      {
    323         alSource3f(enumSource->getID(), AL_POSITION,
    324                    enumSource->getNode()->getAbsCoor().x,
    325                    enumSource->getNode()->getAbsCoor().y,
    326                    enumSource->getNode()->getAbsCoor().z);
    327         alSource3f(enumSource->getID(), AL_VELOCITY,
    328                    enumSource->getNode()->getVelocity().x,
    329                    enumSource->getNode()->getVelocity().y,
    330                    enumSource->getNode()->getVelocity().z);
     329        alSource3f(enumSource->getID(), AL_POSITION,
     330                   enumSource->getNode()->getAbsCoor().x,
     331                   enumSource->getNode()->getAbsCoor().y,
     332                   enumSource->getNode()->getAbsCoor().z);
     333        alSource3f(enumSource->getID(), AL_VELOCITY,
     334                   enumSource->getNode()->getVelocity().x,
     335                   enumSource->getNode()->getVelocity().y,
     336                   enumSource->getNode()->getVelocity().z);
    331337      }
    332338      enumSource = iterator->nextElement();
     
    347353      SoundSource* enumSource = sourceIterator->nextElement();
    348354      while (enumSource)
    349         {
    350           if (enumBuffer == enumSource->getBuffer())
    351             break;
    352           enumSource = sourceIterator->nextElement();
    353         }
     355        {
     356          if (enumBuffer == enumSource->getBuffer())
     357            break;
     358          enumSource = sourceIterator->nextElement();
     359        }
    354360      delete sourceIterator;
    355361      if (enumSource == NULL)
    356         ResourceManager::getInstance()->unload(enumBuffer);
     362        ResourceManager::getInstance()->unload(enumBuffer);
    357363      enumBuffer = bufferIterator->nextElement();
    358364    }
     
    402408      PRINTF(4)("AL_NO_ERROR\n");
    403409      break;
    404      
     410
    405411    case AL_INVALID_NAME:
    406412      PRINTF(2)("AL_INVALID_NAME\n");
  • orxonox/trunk/src/lib/sound/sound_engine.h

    r4519 r4597  
    1 /*! 
     1/*!
    22    \file sound_engine.h
    3     \brief Definition of the SoundEngine singleton Class 
     3    \brief Definition of the SoundEngine singleton Class
    44*/
    55
     
    2020
    2121//! A class that represents a datastructure to play Sounds.
    22 class SoundBuffer
     22class SoundBuffer : public BaseObject
    2323{
    2424 public:
     
    3737
    3838//! A class that represents a SoundSource
    39 class SoundSource
     39class SoundSource : virtual public BaseObject
    4040{
    4141 public:
    4242  SoundSource(SoundBuffer* buffer, PNode* sourceNode = NULL);
    4343  ~SoundSource(void);
    44  
     44
    4545  // user interaction
    4646  void play();
     
    4848  void pause();
    4949  void rewind();
    50  
     50
    5151  // development functions
    5252  /** \returns The ID of this Source */
    5353  inline ALuint getID(void) const { return this->sourceID; }
    5454  /** \returns the SoundBuffer of this Source */
    55   inline SoundBuffer* getBuffer(void) const { return this->buffer; } 
     55  inline SoundBuffer* getBuffer(void) const { return this->buffer; }
    5656  /** \returns the SourceNode of this Source */
    5757  inline PNode* getNode(void) const { return this->sourceNode;}
Note: See TracChangeset for help on using the changeset viewer.