SFX volume is now saved to config file, and read from it

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3412 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2009-04-20 18:36:53 +00:00
parent 2f20cb49b1
commit 3a8fc00861
2 changed files with 10 additions and 23 deletions

View File

@@ -50,7 +50,10 @@ SFXManager::SFXManager()
m_sfx_rolloff.resize(NUM_SOUNDS);
m_sfx_gain.resize(NUM_SOUNDS);
if(!m_initialized) return;
loadSfx();
setMasterSFXVolume( user_config->m_sfx_volume );
} // SoundManager
//-----------------------------------------------------------------------------

View File

@@ -347,37 +347,21 @@ namespace StateManager
}
else if(name == "sfx_volume")
{
static SFXBase* sample_sound = NULL;
GUIEngine::GaugeWidget* w = dynamic_cast<GUIEngine::GaugeWidget*>(widget);
// GUIEngine::getCurrentScreen()->getWidget("sfx_volume")
assert(w != NULL);
/*
SFXBase *m_engine_sound;
m_skid_sound = sfx_manager->newSFX( SFXManager::SOUND_SKID );
m_engine_sound->position ( getXYZ() );
m_engine_sound->loop();
m_engine_sound->play();
m_engine_sound->stop();
sfx_manager->deleteSFX(m_engine_sound );
*/
if(sample_sound == NULL)
sample_sound = sfx_manager->newSFX( SFXManager::SOUND_SKID );
sample_sound->volume(1);
// TODO - save value to file, load value from file
sfx_manager->setMasterSFXVolume( w->getValue() );
user_config->m_sfx_volume = w->getValue();
std::cout << "w->getValue()=" << w->getValue() << std::endl;
// play a sample sound to show the user what this volume is like
static SFXBase* sample_sound = NULL;
if(sample_sound == NULL)
{
sample_sound = sfx_manager->newSFX( SFXManager::SOUND_SKID );
}
sample_sound->position ( Vec3(0,0,0) );
if(sample_sound->getStatus() != SFXManager::SFX_PLAYING)