mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Handle failing openal init properly, add enable_sound and sound_volume settings
This commit is contained in:
parent
a67540807a
commit
6a57eabb14
5 changed files with 31 additions and 6 deletions
13
src/game.cpp
13
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue