- Timestamp:
- Aug 12, 2005, 12:55:21 AM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/sound/ogg_player.cc
r4961 r4985 20 20 21 21 #include "ogg_player.h" 22 23 #include "sound_engine.h" 22 24 23 25 #include "debug.h" … … 75 77 alSourcef (source, AL_ROLLOFF_FACTOR, 0.0 ); 76 78 alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE ); 79 alSourcef (source, AL_GAIN, SoundEngine::getInstance()->getMusicVolume()); 77 80 } 78 81 -
orxonox/trunk/src/lib/sound/ogg_player.h
r4969 r4985 19 19 20 20 21 #define BUFFER_SIZE ( 16384* 4)21 #define BUFFER_SIZE (4096 * 4) 22 22 23 23 -
orxonox/trunk/src/lib/sound/sound_engine.cc
r4984 r4985 28 28 #include "resource_manager.h" 29 29 #include "debug.h" 30 #include "ini_parser.h" 30 31 31 32 using namespace std; 32 33 33 34 34 ////////////////// … … 110 110 alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID()); 111 111 alSourcef (this->sourceID, AL_PITCH, 1.0 ); 112 alSourcef (this->sourceID, AL_GAIN, 1.0);112 alSourcef (this->sourceID, AL_GAIN, SoundEngine::getInstance()->getEffectsVolume() ); 113 113 alSourcei (sourceID, AL_LOOPING, AL_FALSE ); 114 114 } … … 239 239 alutExit(); 240 240 } 241 242 /** 243 * loads the settings of the SoundEngine from an ini-file 244 * @param iniParser the IniParser of the inifile 245 */ 246 void 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 241 256 242 257 /** -
orxonox/trunk/src/lib/sound/sound_engine.h
r4961 r4985 16 16 class PNode; 17 17 template<class T> class tList; 18 class IniParser; 18 19 19 20 … … 75 76 inline static SoundEngine* getInstance() { if (!singletonRef) singletonRef = new SoundEngine(); return singletonRef; }; 76 77 78 void loadSettings(IniParser* iniParser); 79 77 80 SoundSource* createSource(const char* fileName, PNode* sourceNode = NULL); 78 81 … … 81 84 void setDopplerValues(ALfloat dopplerFactor, ALfloat dopplerVelocity); 82 85 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; }; 83 91 84 92 void update(); … … 106 114 static SoundEngine* singletonRef; //!< Reference to this class 107 115 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] 109 118 PNode* listener; //!< The listener of the Scene 110 119 tList<BaseObject>* bufferList; //!< A list of buffers -
orxonox/trunk/src/orxonox.cc
r4982 r4985 177 177 // SDL_Init(SDL_INIT_AUDIO); 178 178 SoundEngine::getInstance()->initAudio(); 179 180 SoundEngine::getInstance()->loadSettings(this->iniParser); 179 181 return 0; 180 182 }
Note: See TracChangeset
for help on using the changeset viewer.