volume changes in the options menu have instant effect when pressing OK

This commit is contained in:
Titus Tscharntke
2010-05-20 21:32:25 +00:00
parent 5c0c68cd49
commit 3308aebb9f
4 changed files with 11 additions and 2 deletions

View File

@@ -468,8 +468,9 @@ void MenuStateOptions::saveConfig(){
}
config.save();
Renderer::getInstance().loadConfig();
SoundRenderer::getInstance().loadConfig();
SoundRenderer::getInstance().setMusicVolume(CoreData::getInstance().getMenuMusic());
Renderer::getInstance().loadConfig();
}
void MenuStateOptions::setActiveInputLable(GraphicLabel *newLable)

View File

@@ -105,6 +105,10 @@ void SoundRenderer::playMusic(StrSound *strSound){
}
}
void SoundRenderer::setMusicVolume(StrSound *strSound){
strSound->setVolume(musicVolume);
}
void SoundRenderer::stopMusic(StrSound *strSound){
if(soundPlayer != NULL) {
if(runThreadSafe == true) mutex.p();

View File

@@ -62,6 +62,7 @@ public:
//music
void playMusic(StrSound *strSound);
void setMusicVolume(StrSound *strSound);
void stopMusic(StrSound *strSound);
//fx

View File

@@ -200,7 +200,10 @@ void StreamSoundSource::update()
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(fadeState == NoFading){
alSourcef(source, AL_GAIN, sound->getVolume());
}
ALint processed = 0;
alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
while(processed > 0) {