Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 17, 2006, 12:41:35 PM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: added loop function in sound_source

File:
1 edited

Legend:

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

    r7326 r7646  
    122122      alSourceStop(this->sourceID);
    123123    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
    124       alSourcePlay(this->sourceID);
     124    alSourcePlay(this->sourceID);
    125125
    126126    if (DEBUG >= 3)
     
    153153  if (DEBUG >= 3)
    154154    SoundEngine::checkError("Play Source", __LINE__);
     155}
     156
     157
     158/**
     159 * @brief Plays back buffer on this Source and loops it
     160 * @param buffer the buffer to play back on this Source
     161 */
     162void SoundSource::loop(const SoundBuffer* buffer)
     163{
     164  if (!this->retrieveSource())
     165  {
     166    PRINTF(2)("No more Free sources (You might consider raising the Source-Count).\n");
     167    return;
     168  }
     169
     170  alSourceStop(this->sourceID);
     171  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
     172  alSourcei (this->sourceID, AL_LOOPING,  AL_TRUE  );
     173
     174  alSourcePlay(this->sourceID);
     175
     176  if (unlikely(this->buffer != NULL))
     177    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
     178  this->bPlay = true;
     179
     180  if (DEBUG >= 3)
     181    SoundEngine::checkError("Play LoopSource", __LINE__);
    155182}
    156183
Note: See TracChangeset for help on using the changeset viewer.