Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4209 in orxonox.OLD for orxonox/branches/openAL


Ignore:
Timestamp:
May 17, 2005, 10:38:59 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/openAL: initAudio saver now

Location:
orxonox/branches/openAL/src
Files:
5 edited

Legend:

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

    r4208 r4209  
    9898}
    9999
     100/**
     101   \brief deletes a SoundSource
     102*/
    100103SoundSource::~SoundSource(void)
    101104{
     
    159162{
    160163  this->setClassName ("SoundEngine");
    161    
    162    this->initAudio();
    163 
    164    this->listener = NULL;
    165    this->bufferList = new tList<SoundBuffer>;
    166    this->sourceList = new tList<SoundSource>;
     164 
     165  this->listener = NULL;
     166  this->bufferList = new tList<SoundBuffer>;
     167  this->sourceList = new tList<SoundSource>;
    167168}
    168169
     
    209210    }
    210211  delete bufferIterator;
     212
     213  // removing openAL from AudioResource
     214  alutExit();
    211215}
    212216
     
    232236  this->listener = listener;
    233237}
     238
     239/**
     240   \brief Sets the doppler values of openAL
     241   \param dopplerFactor the extent of the doppler-effect
     242   \param the Speed the sound travels
     243*/
     244void SoundEngine::setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity)
     245{
     246  alDopplerFactor(dopplerFactor);
     247  alDopplerVelocity(dopplerVelocity);
     248}
     249
    234250
    235251/**
     
    345361bool SoundEngine::initAudio(void)
    346362{
     363  ALenum result;
     364
     365  PRINTF(3)("Initialisazing openAL sound library\n");
     366
    347367  alutInit(NULL, 0);
    348   alGetError();
    349 
    350   alDopplerFactor(SOUND_DOPPLER_FACTOR);
    351   alDopplerVelocity(SOUND_DOPPLER_VELOCITY);
     368  if ((result = alGetError()) != AL_NO_ERROR)
     369    SoundEngine::PrintALErrorString(result);
     370
     371  this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
    352372}
    353373
  • orxonox/branches/openAL/src/lib/sound/sound_engine.h

    r4207 r4209  
    11/*!
    22    \file sound_engine.h
    3     \brief Definition of the SoundEngine singleton Class
    4    
     3    \brief Definition of the SoundEngine singleton Class 
    54*/
    65
     
    7877
    7978  void setListener(PNode* listener);
     79  void setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity);
     80
    8081
    8182  void addBuffer(SoundBuffer* buffer);
     
    8687  void update(void);
    8788
     89  // administrative
    8890  void flushUnusedBuffers(void);
     91  bool initAudio(void);
    8992
    9093  // error handling:
     
    9295  //  static void PrintALCErrorString(ALenum err);
    9396
     97
    9498 private:
    9599  SoundEngine(void);
    96100  static SoundEngine* singletonRef;
    97101
    98   bool initAudio(void);
    99102
    100103  PNode* listener;                 //!< The listener of the Scene
  • orxonox/branches/openAL/src/orxonox.cc

    r4207 r4209  
    123123  if( initVideo() == -1) return -1;
    124124  if( initSound() == -1) return -1;
    125   printf("> Initializing input\n");
     125  PRINT(3)("> Initializing input\n");
    126126  if( initInput() == -1) return -1;
    127   printf("> Initializing networking\n");
     127  PRINT(3)("> Initializing networking\n");
    128128  if( initNetworking () == -1) return -1;
    129129  //printf("> Initializing world\n");
     
    151151int Orxonox::initSound()
    152152{
    153   printf("> Initializing sound\n");
     153  PRINT(3)("> Initializing sound\n");
    154154  // SDL_Init(SDL_INIT_AUDIO);
    155   SoundEngine::getInstance();
     155  SoundEngine::getInstance()->initAudio();
    156156  return 0;
    157157}
  • orxonox/branches/openAL/src/story_entities/world.cc

    r4208 r4209  
    489489  this->spawn(terrain);
    490490
    491   SoundEngine::getInstance()->setListener(tn);
     491  SoundEngine::getInstance()->setListener(this->localCamera);
    492492
    493493  ParticleSystem* system = new ParticleSystem(1000, PARTICLE_SPRITE);
  • orxonox/branches/openAL/src/world_entities/test_gun.cc

    r4208 r4209  
    8888    }
    8989 
    90   this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/explo.wav", WAV);
     90  this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV);
    9191  this->weaponSource = new SoundSource(this->fireSound, this);
    9292}
Note: See TracChangeset for help on using the changeset viewer.