mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Handle failing openal init properly, add enable_sound and sound_volume settings
This commit is contained in:
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
|
||||
|
Reference in New Issue
Block a user