Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7291 in orxonox.OLD for trunk


Ignore:
Timestamp:
Apr 14, 2006, 10:28:24 AM (19 years ago)
Author:
bensch
Message:

trunk: fixed a soundSource bug. The SoundSource did not release its alSource on Stop.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r7290 r7291  
    7575  while(!this->ALSources.empty())
    7676  {
    77     alDeleteSources(1, &this->ALSources.top());
    78     SoundEngine::checkError("Deleting Source", __LINE__);
     77    if (alIsSource(this->ALSources.top()))
     78    {
     79      alDeleteSources(1, &this->ALSources.top());
     80      SoundEngine::checkError("Deleting Source", __LINE__);
     81    }
     82    else
     83      PRINTF(1)("%d is not a Source\n", this->ALSources.top());
     84
    7985    this->ALSources.pop();
    8086  }
     
    169175    ALfloat orientation [6] = {1,0,0, absDirV.x, absDirV.y, absDirV.z};
    170176    alListenerfv(AL_ORIENTATION, orientation);
     177    SoundEngine::checkError("SoundEngine::update() - Listener Error", __LINE__);
    171178  }
    172179  else
     
    185192        int play = 0x000;
    186193        alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
     194        if (DEBUG > 2)
     195          SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
    187196        if(play == AL_PLAYING)
    188197        {
     
    193202                       source->getNode()->getAbsCoor().y,
    194203                       source->getNode()->getAbsCoor().z);
     204            if (DEBUG > 2)
     205              SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
    195206            alSource3f(source->getID(), AL_VELOCITY,
    196207                       source->getNode()->getVelocity().x,
    197208                       source->getNode()->getVelocity().y,
    198209                       source->getNode()->getVelocity().z);
     210            if (DEBUG > 2)
     211              SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
    199212          }
    200213        }
  • trunk/src/lib/sound/sound_source.cc

    r7290 r7291  
    4646SoundSource::~SoundSource()
    4747{
    48   SoundEngine::getInstance()->pushALSource(this->sourceID);
     48  this->stop();
    4949}
    5050
     
    6969{
    7070  if (unlikely(this->sourceID == 0))
     71  {
    7172    SoundEngine::getInstance()->popALSource(this->sourceID);
     73    if (sourceID == 0)
     74    {
     75      PRINTF(2)("No more Free source\n");
     76      return;
     77    }
     78  }
    7279//  assert (this->sourceID != 0);
    7380
     
    9097{
    9198  this->bPlay = false;
    92   alSourceStop(this->sourceID);
    93   SoundEngine::getInstance()->pushALSource(this->sourceID);
     99  if (this->sourceID != 0)
     100  {
     101    alSourceStop(this->sourceID);
     102    if (DEBUG >= 3)
     103      SoundEngine::checkError("StopSource", __LINE__);
     104    SoundEngine::getInstance()->pushALSource(this->sourceID);
     105    this->sourceID = 0;
     106  }
    94107}
    95108
  • trunk/src/story_entities/game_world.cc

    r7290 r7291  
    136136int GameWorld::createAudioThread(void* gameWorld)
    137137{
    138 /*  GameWorld* gw = (GameWorld*)gameWorld;
     138  GameWorld* gw = (GameWorld*)gameWorld;
    139139  printf("STARTIG AUDIO THREAD\n");
    140140  if(gw->dataTank && gw->dataTank->music != NULL)
     
    146146      gw->dataTank->music->update();
    147147    SDL_Delay(1);
    148   }*/
     148  }
    149149  printf("End the AudioThread\n");
    150150}
Note: See TracChangeset for help on using the changeset viewer.