diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-04-06 15:30:36 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-04-06 15:30:36 +0300 |
commit | 6a57eabb145e5000427e38ab0c8d3bb435b2c596 (patch) | |
tree | fb67244b0e56cc4de092f5301da68d9a91ef6792 /src/game.cpp | |
parent | a67540807a051c39d79203832383e8fc8829b5d6 (diff) | |
download | minetest-6a57eabb145e5000427e38ab0c8d3bb435b2c596.tar.gz minetest-6a57eabb145e5000427e38ab0c8d3bb435b2c596.tar.bz2 minetest-6a57eabb145e5000427e38ab0c8d3bb435b2c596.zip |
Handle failing openal init properly, add enable_sound and sound_volume settings
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp index ec5881d25..7d049edf0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -955,10 +955,14 @@ void the_game( ISoundManager *sound = NULL; bool sound_is_dummy = false; #if USE_SOUND - infostream<<"Attempting to use OpenAL audio"<<std::endl; - sound = createOpenALSoundManager(&soundfetcher); - if(!sound) - infostream<<"Failed to initialize OpenAL audio"<<std::endl; + if(g_settings->getBool("enable_sound")){ + infostream<<"Attempting to use OpenAL audio"<<std::endl; + sound = createOpenALSoundManager(&soundfetcher); + if(!sound) + infostream<<"Failed to initialize OpenAL audio"<<std::endl; + } else { + infostream<<"Sound disabled."<<std::endl; + } #endif if(!sound){ infostream<<"Using dummy audio."<<std::endl; @@ -2082,6 +2086,7 @@ void the_game( v3f(0,0,0), // velocity camera.getDirection(), camera.getCameraNode()->getUpVector()); + sound->setListenerGain(g_settings->getFloat("sound_volume")); /* Update sound maker |