This commit is contained in:
Rachael Alexanderson 2017-04-30 16:00:52 -04:00
commit 588d028499
10 changed files with 76 additions and 18 deletions

View file

@ -1267,7 +1267,11 @@ endif()
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# Need to enable intrinsics for this file.
if( SSE_MATTERS )
set_source_files_properties( x86.cpp PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
set_source_files_properties(
x86.cpp
swrenderer/r_all.cpp
polyrenderer/poly_all.cpp
PROPERTIES COMPILE_FLAGS "-msse2 -mmmx" )
endif()
endif()

View file

@ -256,7 +256,7 @@ CCMD(recordmap)
G_DeferedInitNew(mapname);
gameaction = ga_recordgame;
newdemoname = argv[1];
newdemomap = argv[2];
newdemomap = mapname;
}
}
catch (CRecoverableError &error)

View file

@ -1488,9 +1488,11 @@ static void S_LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
DPrintf(DMSG_NOTIFY, "Loading monoized sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
std::pair<SoundHandle, bool> snd;
if (pBuffer->mBuffer.Size() > 0)
{
GSnd->LoadSoundBuffered(pBuffer, true);
snd = GSnd->LoadSoundBuffered(pBuffer, true);
}
else
{
@ -1501,7 +1503,6 @@ static void S_LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
uint8_t *sfxdata = new uint8_t[size];
wlump.Read(sfxdata, size);
int32_t dmxlen = LittleLong(((int32_t *)sfxdata)[1]);
std::pair<SoundHandle, bool> snd;
// If the sound is voc, use the custom loader.
if (strncmp((const char *)sfxdata, "Creative Voice File", 19) == 0)
@ -1526,9 +1527,9 @@ static void S_LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
snd = GSnd->LoadSound(sfxdata, size, true, pBuffer);
}
delete[] sfxdata;
sfx->data3d = snd.first;
}
sfx->data3d = snd.first;
}
//==========================================================================

View file

@ -66,6 +66,7 @@ EXTERN_CVAR (Float, snd_sfxvolume)
CVAR (Int, snd_samplerate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Int, snd_buffersize, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, snd_output, "default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Int, snd_hrtf, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
#if !defined(NO_OPENAL)
#define DEF_BACKEND "openal"

View file

@ -132,6 +132,7 @@ EXTERN_CVAR (Int, snd_channels)
EXTERN_CVAR (Int, snd_samplerate)
EXTERN_CVAR (Bool, snd_waterreverb)
EXTERN_CVAR (Bool, snd_pitched)
EXTERN_CVAR (Int, snd_hrtf)
#define MAKE_PTRID(x) ((void*)(uintptr_t)(x))
@ -722,6 +723,11 @@ OpenALSoundRenderer::OpenALSoundRenderer()
Device = InitDevice();
if (Device == NULL) return;
ALC.EXT_EFX = !!alcIsExtensionPresent(Device, "ALC_EXT_EFX");
ALC.EXT_disconnect = !!alcIsExtensionPresent(Device, "ALC_EXT_disconnect");
ALC.SOFT_HRTF = !!alcIsExtensionPresent(Device, "ALC_SOFT_HRTF");
ALC.SOFT_pause_device = !!alcIsExtensionPresent(Device, "ALC_SOFT_pause_device");
const ALCchar *current = NULL;
if(alcIsExtensionPresent(Device, "ALC_ENUMERATE_ALL_EXT"))
current = alcGetString(Device, ALC_ALL_DEVICES_SPECIFIER);
@ -747,6 +753,16 @@ OpenALSoundRenderer::OpenALSoundRenderer()
attribs.Push(MAX<ALCint>(*snd_channels, 2) - 1);
attribs.Push(ALC_STEREO_SOURCES);
attribs.Push(1);
if(ALC.SOFT_HRTF)
{
attribs.Push(ALC_HRTF_SOFT);
if(*snd_hrtf < 0)
attribs.Push(ALC_FALSE);
else if(*snd_hrtf > 0)
attribs.Push(ALC_TRUE);
else
attribs.Push(ALC_DONT_CARE_SOFT);
}
// Other attribs..?
attribs.Push(0);
@ -768,9 +784,6 @@ OpenALSoundRenderer::OpenALSoundRenderer()
DPrintf(DMSG_SPAMMY, " Version: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION));
DPrintf(DMSG_SPAMMY, " Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS));
ALC.EXT_EFX = !!alcIsExtensionPresent(Device, "ALC_EXT_EFX");
ALC.EXT_disconnect = !!alcIsExtensionPresent(Device, "ALC_EXT_disconnect");
ALC.SOFT_pause_device = !!alcIsExtensionPresent(Device, "ALC_SOFT_pause_device");
AL.EXT_source_distance_model = !!alIsExtensionPresent("AL_EXT_source_distance_model");
AL.EXT_SOURCE_RADIUS = !!alIsExtensionPresent("AL_EXT_SOURCE_RADIUS");
AL.SOFT_deferred_updates = !!alIsExtensionPresent("AL_SOFT_deferred_updates");

View file

@ -35,6 +35,28 @@
#define ALC_CONNECTED 0x313
#endif
#ifndef ALC_SOFT_HRTF
#define ALC_SOFT_HRTF 1
#define ALC_HRTF_SOFT 0x1992
#define ALC_DONT_CARE_SOFT 0x0002
#define ALC_HRTF_STATUS_SOFT 0x1993
#define ALC_HRTF_DISABLED_SOFT 0x0000
#define ALC_HRTF_ENABLED_SOFT 0x0001
#define ALC_HRTF_DENIED_SOFT 0x0002
#define ALC_HRTF_REQUIRED_SOFT 0x0003
#define ALC_HRTF_HEADPHONES_DETECTED_SOFT 0x0004
#define ALC_HRTF_UNSUPPORTED_FORMAT_SOFT 0x0005
#define ALC_NUM_HRTF_SPECIFIERS_SOFT 0x1994
#define ALC_HRTF_SPECIFIER_SOFT 0x1995
#define ALC_HRTF_ID_SOFT 0x1996
typedef const ALCchar* (ALC_APIENTRY*LPALCGETSTRINGISOFT)(ALCdevice *device, ALCenum paramName, ALCsizei index);
typedef ALCboolean (ALC_APIENTRY*LPALCRESETDEVICESOFT)(ALCdevice *device, const ALCint *attribs);
#ifdef AL_ALEXT_PROTOTYPES
ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALCenum paramName, ALCsizei index);
ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCint *attribs);
#endif
#endif
#ifndef AL_EXT_source_distance_model
#define AL_EXT_source_distance_model 1
#define AL_SOURCE_DISTANCE_MODEL 0x200
@ -142,6 +164,7 @@ private:
struct {
bool EXT_EFX;
bool EXT_disconnect;
bool SOFT_HRTF;
bool SOFT_pause_device;
} ALC;
struct {

View file

@ -163,7 +163,10 @@ size_t SndFileDecoder::read(char *buffer, size_t bytes)
while(total < frames)
{
size_t todo = MIN<size_t>(frames-total, 64/SndInfo.channels);
float tmp[64];
// libsndfile uses SSE optimization on Intel platform
// This requires proper read buffer alignment
alignas(16) float tmp[64];
size_t got = (size_t)sf_readf_float(SndFile, tmp, todo);
if(got < todo) frames = total + got;

View file

@ -417,10 +417,13 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC
{
// Strictly speaking this doesn't require a mode switch, but it is the easiest
// way to force a CreateFramebuffer call without a lot of refactoring.
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewBits = DisplayBits;
setmodeneeded = true;
if (currentrenderer == 0)
{
NewWidth = screen->GetWidth();
NewHeight = screen->GetHeight();
NewBits = DisplayBits;
setmodeneeded = true;
}
}
CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)

View file

@ -2141,6 +2141,7 @@ OPENALMNU_ENABLEEFX = "Enable EFX";
// Advanced Sound Options
ADVSNDMNU_TITLE = "ADVANCED SOUND OPTIONS";
ADVSNDMNU_SAMPLERATE = "Sample rate";
ADVSNDMNU_HRTF = "HRTF";
ADVSNDMNU_OPLSYNTHESIS = "OPL Synthesis";
ADVSNDMNU_OPLNUMCHIPS = "Number of emulated OPL chips";
ADVSNDMNU_OPLFULLPAN = "Full MIDI stereo panning";
@ -2220,6 +2221,7 @@ JOYMNU_NOAXES = "No configurable axes";
// Option Values
OPTVAL_OFF = "Off";
OPTVAL_ON = "On";
OPTVAL_AUTO = "Auto";
OPTVAL_MALE = "Male";
OPTVAL_FEMALE = "Female";
OPTVAL_OTHER = "Other";

View file

@ -309,6 +309,13 @@ OptionValue "OffOn"
1, "$OPTVAL_OFF"
}
OptionValue OffAutoOn
{
-1, "$OPTVAL_OFF"
0, "$OPTVAL_AUTO"
1, "$OPTVAL_ON"
}
OptionMenuSettings
{
// These can be overridden if a different menu fonts requires it.
@ -1629,6 +1636,7 @@ OptionMenu AdvSoundOptions
{
Title "$ADVSNDMNU_TITLE"
Option "$ADVSNDMNU_SAMPLERATE", "snd_samplerate", "SampleRates"
Option "$ADVSNDMNU_HRTF", "snd_hrtf", "OffAutoOn"
StaticText " "
StaticText "$ADVSNDMNU_OPLSYNTHESIS", 1
Slider "$ADVSNDMNU_OPLNUMCHIPS", "opl_numchips", 1, 8, 1, 0
@ -1724,11 +1732,11 @@ OptionMenu ModReplayerOptions
{
Title "$MODMNU_TITLE"
Slider "$MODMNU_MASTERVOLUME", "mod_dumb_mastervolume", 1, 16, 0.5, 1
Option "$ADVSNDMNU_SAMPLERATE", "mod_samplerate", "SampleRates", "mod_dumb"
Option "$MODMNU_QUALITY", "mod_interp", "ModQuality", "mod_dumb"
Option "$MODMNU_VOLUMERAMPING", "mod_volramp", "ModVolumeRamps", "mod_dumb"
Option "$ADVSNDMNU_SAMPLERATE", "mod_samplerate", "SampleRates"
Option "$MODMNU_QUALITY", "mod_interp", "ModQuality"
Option "$MODMNU_VOLUMERAMPING", "mod_volramp", "ModVolumeRamps"
StaticText " "
Option "$MODMNU_CHIPOMATIC", "mod_autochip", "OnOff", "mod_dumb"
Option "$MODMNU_CHIPOMATIC", "mod_autochip", "OnOff"
// TODO if the menu system is ever rewritten: Provide a decent
// mechanism to edit the chip-o-matic settings like you can with
// the foo_dumb preferences in foobar2000.