1
0
forked from 0ad/0ad

Don't detect audio card when audio is disabled, Fix compilation with --without-audio, fix a few warnings.

Reviewed by: @bb
Comments by: @vladislavbelov, @wraitii
Differential Revision: https://code.wildfiregames.com/D2809
This was SVN commit r24079.
This commit is contained in:
Stan 2020-10-02 07:35:59 +00:00
parent e18c305ba2
commit 1273307b58
4 changed files with 20 additions and 16 deletions

View File

@ -20,7 +20,9 @@
#include "scriptinterface/ScriptInterface.h"
#include "lib/ogl.h"
#if CONFIG2_AUDIO
#include "lib/snd.h"
#endif
#include "lib/svn_revision.h"
#include "lib/timer.h"
#include "lib/utf8.h"
@ -199,10 +201,10 @@ void RunHardwareDetection()
scriptInterface.SetProperty(settings, "gfx_card", gfx::CardName());
scriptInterface.SetProperty(settings, "gfx_drv_ver", gfx::DriverInfo());
#if CONFIG2_AUDIO
scriptInterface.SetProperty(settings, "snd_card", snd_card);
scriptInterface.SetProperty(settings, "snd_drv_ver", snd_drv_ver);
#endif
ReportSDL(scriptInterface, settings);
ReportGLLimits(scriptInterface, settings);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -21,7 +21,9 @@
#include "lib/posix/posix_utsname.h"
#include "lib/ogl.h"
#if CONFIG2_AUDIO
#include "lib/snd.h"
#endif
#include "lib/timer.h"
#include "lib/bits.h" // round_up
#include "lib/allocators/shared_ptr.h"
@ -80,10 +82,6 @@ static std::string SplitExts(const char *exts)
void WriteSystemInfo()
{
TIMER(L"write_sys_info");
// get_cpu_info and gfx_detect already called during init - see call site
snd_detect();
struct utsname un;
uname(&un);
@ -137,9 +135,13 @@ void WriteSystemInfo()
fprintf(f, "OpenGL Drivers : %s; %ls\n", glGetString(GL_VERSION), driverInfo.c_str());
fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetXRes(), g_VideoMode.GetYRes(), g_VideoMode.GetBPP());
// sound
#if CONFIG2_AUDIO
snd_detect();
fprintf(f, "Sound Card : %s\n", snd_card.c_str());
fprintf(f, "Sound Drivers : %s\n", snd_drv_ver.c_str());
#else
fprintf(f, "Sound : Game was compiled without audio\n");
#endif
// OpenGL extensions (write them last, since it's a lot of text)
const char* exts = ogl_ExtensionString();

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -125,11 +125,11 @@ namespace JSI_Sound
void ClearPlaylist(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
void StopMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
void StartMusic(ScriptInterface::CxPrivate* UNUSED(pCxPrivate) ){}
void SetMasterGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
void SetMusicGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
void SetAmbientGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float gain){}
void SetMasterGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float UNUSED(gain)){}
void SetMusicGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float UNUSED(gain)){}
void SetAmbientGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float UNUSED(gain)){}
void SetActionGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float UNUSED(gain)){}
void SetUIGain(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), float UNUSED(gain)){}
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -83,11 +83,11 @@ private:
#if CONFIG2_AUDIO
inline u32 FastRand();
// Contains the current sound seed for the generator
u32 m_Seed;
float RandFloat(float min, float max);
// We store the handles so we can load now and play later
std::vector<CSoundData*> m_SoundGroups;
#endif
u32 m_Seed;
// We need the filenames so we can reload when necessary.
std::vector<std::wstring> m_Filenames;
// The file path for the list of sound file resources