Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4985 in orxonox.OLD for orxonox/trunk/src/lib/sound


Ignore:
Timestamp:
Aug 12, 2005, 12:55:21 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: loading some stuff from ths sound-engine

Location:
orxonox/trunk/src/lib/sound
Files:
4 edited

Legend:

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

    r4961 r4985  
    2020
    2121#include "ogg_player.h"
     22
     23#include "sound_engine.h"
    2224
    2325#include "debug.h"
     
    7577    alSourcef (source, AL_ROLLOFF_FACTOR,  0.0          );
    7678    alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE      );
     79    alSourcef (source, AL_GAIN,            SoundEngine::getInstance()->getMusicVolume());
    7780}
    7881
  • orxonox/trunk/src/lib/sound/ogg_player.h

    r4969 r4985  
    1919
    2020
    21 #define BUFFER_SIZE (16384 * 4)
     21#define BUFFER_SIZE (4096 * 4)
    2222
    2323
  • orxonox/trunk/src/lib/sound/sound_engine.cc

    r4984 r4985  
    2828#include "resource_manager.h"
    2929#include "debug.h"
     30#include "ini_parser.h"
    3031
    3132using namespace std;
    32 
    3333
    3434//////////////////
     
    110110    alSourcei (this->sourceID, AL_BUFFER,   this->buffer->getID());
    111111  alSourcef (this->sourceID, AL_PITCH,    1.0      );
    112   alSourcef (this->sourceID, AL_GAIN,     1.0      );
     112  alSourcef (this->sourceID, AL_GAIN,     SoundEngine::getInstance()->getEffectsVolume() );
    113113  alSourcei (sourceID, AL_LOOPING,  AL_FALSE     );
    114114}
     
    239239  alutExit();
    240240}
     241
     242/**
     243 * loads the settings of the SoundEngine from an ini-file
     244 * @param iniParser the IniParser of the inifile
     245 */
     246void SoundEngine::loadSettings(IniParser* iniParser)
     247{
     248  const char* musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "80");
     249  this->musicVolume = atof(musicVolume)/100.0;
     250
     251  const char* effectsVolume = iniParser->getVar(CONFIG_NAME_EFFECTS_VOLUME, CONFIG_SECTION_AUDIO, "80");
     252  this->effectsVolume = atof(effectsVolume)/100.0;
     253}
     254
     255
    241256
    242257/**
  • orxonox/trunk/src/lib/sound/sound_engine.h

    r4961 r4985  
    1616class PNode;
    1717template<class T> class tList;
     18class IniParser;
    1819
    1920
     
    7576    inline static SoundEngine* getInstance() { if (!singletonRef) singletonRef = new SoundEngine();  return singletonRef; };
    7677
     78    void loadSettings(IniParser* iniParser);
     79
    7780    SoundSource* createSource(const char* fileName, PNode* sourceNode = NULL);
    7881
     
    8184    void setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity);
    8285
     86
     87    /** @returns the Music Volume in % */
     88    inline float getMusicVolume() { return this->musicVolume; };
     89    /** @returns the Effects Volume in % */
     90    inline float getEffectsVolume() { return this->effectsVolume; };
    8391
    8492    void update();
     
    106114    static SoundEngine*      singletonRef;             //!< Reference to this class
    107115
    108 
     116    float                    musicVolume;              //!< the maximum volume of the music in % (0f,1f]
     117    float                    effectsVolume;            //!< the maximum volume of sound-effects in % (0f,1f]
    109118    PNode*                   listener;                 //!< The listener of the Scene
    110119    tList<BaseObject>*       bufferList;               //!< A list of buffers
Note: See TracChangeset for help on using the changeset viewer.