Audio library availability is checked, and corresponding options are disabled when unavailable.
This commit is contained in:
parent
25b8a2f53d
commit
06374c59f9
@ -692,6 +692,16 @@ namespace spades {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ALDevice::TryLoad() {
|
||||||
|
try {
|
||||||
|
al::Link();
|
||||||
|
return true;
|
||||||
|
}catch(...){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ALDevice::~ALDevice() {
|
ALDevice::~ALDevice() {
|
||||||
SPADES_MARK_FUNCTION();
|
SPADES_MARK_FUNCTION();
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ namespace spades {
|
|||||||
ALDevice();
|
ALDevice();
|
||||||
virtual ~ALDevice();
|
virtual ~ALDevice();
|
||||||
|
|
||||||
|
static bool TryLoad();
|
||||||
|
|
||||||
virtual client::IAudioChunk *RegisterSound(const char *name);
|
virtual client::IAudioChunk *RegisterSound(const char *name);
|
||||||
|
|
||||||
virtual void SetGameMap(client::GameMap *);
|
virtual void SetGameMap(client::GameMap *);
|
||||||
|
@ -218,6 +218,18 @@ namespace spades {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool YsrDevice::TryLoadYsr() {
|
||||||
|
try {
|
||||||
|
if(!library){
|
||||||
|
library = new spades::DynamicLibrary(s_ysrDriver.CString());
|
||||||
|
SPLog("'%s' loaded", s_ysrDriver.CString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}catch(...){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
YsrDriver::~YsrDriver() {
|
YsrDriver::~YsrDriver() {
|
||||||
ctx.Destroy();
|
ctx.Destroy();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,8 @@ namespace spades {
|
|||||||
public:
|
public:
|
||||||
YsrDevice();
|
YsrDevice();
|
||||||
|
|
||||||
|
static bool TryLoadYsr();
|
||||||
|
|
||||||
virtual client::IAudioChunk *RegisterSound(const char *name);
|
virtual client::IAudioChunk *RegisterSound(const char *name);
|
||||||
|
|
||||||
virtual void SetGameMap(client::GameMap *);
|
virtual void SetGameMap(client::GameMap *);
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <Core/Settings.h>
|
#include <Core/Settings.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <Audio/YsrDevice.h>
|
||||||
|
#include <Audio/ALDevice.h>
|
||||||
|
|
||||||
#include "../Imports/OpenGL.h" //for gpu info
|
#include "../Imports/OpenGL.h" //for gpu info
|
||||||
#include "../Imports/SDL.h"
|
#include "../Imports/SDL.h"
|
||||||
@ -84,6 +86,39 @@ namespace spades {
|
|||||||
void StartupScreenHelper::ExamineSystem() {
|
void StartupScreenHelper::ExamineSystem() {
|
||||||
SPADES_MARK_FUNCTION();
|
SPADES_MARK_FUNCTION();
|
||||||
|
|
||||||
|
// check audio device availability
|
||||||
|
// Note: this only checks whether these libraries can be loaded.
|
||||||
|
|
||||||
|
SPLog("Checking YSR availability");
|
||||||
|
if(!audio::YsrDevice::TryLoadYsr()) {
|
||||||
|
incapableConfigs.insert
|
||||||
|
(std::make_pair
|
||||||
|
("s_audioDriver",
|
||||||
|
[](std::string value) -> std::string {
|
||||||
|
if(EqualsIgnoringCase(value, "ysr")) {
|
||||||
|
return "YSR library couldn't be loaded.";
|
||||||
|
}else{
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
SPLog("Checking OpenAL availability");
|
||||||
|
if(!audio::ALDevice::TryLoad()) {
|
||||||
|
incapableConfigs.insert
|
||||||
|
(std::make_pair
|
||||||
|
("s_audioDriver",
|
||||||
|
[](std::string value) -> std::string {
|
||||||
|
if(EqualsIgnoringCase(value, "openal")) {
|
||||||
|
return "OpenAL library couldn't be loaded.";
|
||||||
|
}else{
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: check OpenAL availability somehow
|
||||||
|
|
||||||
// check GL capabilities
|
// check GL capabilities
|
||||||
|
|
||||||
SPLog("Performing ecapability query");
|
SPLog("Performing ecapability query");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user