Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2005, 2:53:43 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/avi_play: merged the trunk back to the avi_play branche again
merged with command
svn merge -r 5924:HEAD ../trunk/ avi_play/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/lib/sound/sound_source.cc

    r5924 r5961  
    3434
    3535  // adding the Source to the SourcesList of the SoundEngine
    36   SoundEngine::getInstance()->addSource(this);
    37 
    3836  this->buffer = buffer;
    3937  this->sourceNode = sourceNode;
    4038
    41   alGenSources(1, &this->sourceID);
    42   if ((result = alGetError()) != AL_NO_ERROR)
    43     SoundEngine::PrintALErrorString(result);
    44   if (this->buffer != NULL)
    45     alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
    46   alSourcef (this->sourceID, AL_PITCH,    1.0      );
    47   alSourcef (this->sourceID, AL_GAIN,     SoundEngine::getInstance()->getEffectsVolume() );
    48   alSourcei (sourceID, AL_LOOPING,  AL_FALSE     );
     39  this->sourceID = 0;
     40  this->bPlay = false;
    4941}
    5042
     
    5446SoundSource::~SoundSource()
    5547{
    56   //SoundEngine::getInstance()->removeSource(this);
    57   alDeleteSources(1, &this->sourceID);
     48  SoundEngine::getInstance()->pushALSource(this->sourceID);
    5849}
    5950
     
    6354void SoundSource::play()
    6455{
     56  if (this->sourceID == 0)
     57    SoundEngine::getInstance()->popALSource(this->sourceID);
    6558  alSourcePlay(this->sourceID);
     59  this->bPlay = true;
    6660}
    6761
     
    7266void SoundSource::play(const SoundBuffer* buffer)
    7367{
     68  if (unlikely(this->sourceID == 0))
     69    SoundEngine::getInstance()->popALSource(this->sourceID);
     70
     71  printf("%d\n",sourceID);
    7472  alSourceStop(this->sourceID);
    7573  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
     
    7876  if (unlikely(this->buffer != NULL))
    7977    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
     78  this->bPlay = true;
    8079}
    8180
     
    8584void SoundSource::stop()
    8685{
     86  this->bPlay = false;
    8787  alSourceStop(this->sourceID);
     88  SoundEngine::getInstance()->pushALSource(this->sourceID);
    8889}
    8990
Note: See TracChangeset for help on using the changeset viewer.