Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4885 in orxonox.OLD for orxonox/trunk/src/lib/sound/sound_engine.cc


Ignore:
Timestamp:
Jul 18, 2005, 3:36:18 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the weaponSystem back to the trunk, because it seems safe
merged with command:
svn merge -r 4847:HEAD branches/weaponSystem/ trunk/
conflict in file src/world-entities/weapons/weapon.h resolved in favor of the weaponSystem

File:
1 edited

Legend:

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

    r4836 r4885  
    9191 *  creates a SoundSource at position sourceNode with the SoundBuffer buffer
    9292*/
    93 SoundSource::SoundSource(SoundBuffer* buffer, PNode* sourceNode)
     93SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer)
    9494{
    9595  this->setClassID(CL_SOUND_SOURCE, "SoundSource");
     
    106106  if ((result = alGetError()) != AL_NO_ERROR)
    107107    SoundEngine::PrintALErrorString(result);
    108   alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
     108  if (this->buffer != NULL)
     109    alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
    109110  alSourcef (this->sourceID, AL_PITCH,    1.0      );
    110111  alSourcef (this->sourceID, AL_GAIN,     1.0      );
     
    121122}
    122123
    123 
    124124/**
    125125 *  Plays back a SoundSource
     
    128128{
    129129  alSourcePlay(this->sourceID);
     130}
     131
     132/**
     133 * Plays back buffer on this Source
     134 * @param buffer the buffer to play back on this Source
     135 */
     136void SoundSource::play(const SoundBuffer* buffer)
     137{
     138  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
     139  alSourcePlay(this->sourceID);
     140
     141  if (unlikely(this->buffer != NULL))
     142    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
    130143}
    131144
     
    230243SoundSource* SoundEngine::createSource(const char* fileName, PNode* sourceNode)
    231244{
    232   return new SoundSource((SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL), sourceNode);
     245  return new SoundSource(sourceNode, (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL));
    233246}
    234247
Note: See TracChangeset for help on using the changeset viewer.