Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7810 in orxonox.OLD for trunk/src/lib/sound/sound_source.cc


Ignore:
Timestamp:
May 24, 2006, 3:57:04 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the Weather effects back here

File:
1 edited

Legend:

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

    r7729 r7810  
    122122        alSourceStop(this->sourceID);
    123123      alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
    124       alSourcePlay(this->sourceID);
     124    alSourcei (this->sourceID, AL_LOOPING,  AL_FALSE  );
     125    alSourcePlay(this->sourceID);
    125126
    126127      if (DEBUG_LEVEL >= 3)
     
    143144    }
    144145
    145     alSourceStop(this->sourceID);
    146     alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
    147     alSourcePlay(this->sourceID);
     146  alSourceStop(this->sourceID);
     147  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
     148  alSourcei (this->sourceID, AL_LOOPING,  AL_FALSE  );
     149  alSourcePlay(this->sourceID);
    148150
    149151    if (unlikely(this->buffer != NULL))
     
    156158
    157159
    158   /**
    159    * @brief Stops playback of a SoundSource
    160    */
    161   void SoundSource::stop()
     160/**
     161 * @brief Plays and loops buffer on this Source
     162 * @param buffer the buffer to play back on this Source
     163 */
     164void SoundSource::loop(const SoundBuffer* buffer)
     165{
     166  if (this->buffer && this->retrieveSource())
     167  {
     168    if (this->bPlay)
     169      alSourceStop(this->sourceID);
     170
     171    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
     172    alSourcei (this->sourceID, AL_LOOPING,  AL_TRUE  );
     173    alSourcePlay(this->sourceID);
     174
     175    if (DEBUG_LEVEL >= 3)
     176      SoundEngine::checkError("Play LoopSource", __LINE__);
     177    this->bPlay = true;
     178  }
     179}
     180
     181
     182/**
     183 * @brief Stops playback of a SoundSource
     184 */
     185void SoundSource::stop()
     186{
     187  this->bPlay = false;
     188  if (this->sourceID != 0)
    162189  {
    163190    this->bPlay = false;
     
    173200    }
    174201  }
    175 
     202}
    176203
    177204  /**
Note: See TracChangeset for help on using the changeset viewer.