From 79654fa15b6a00955867f09ef3f90b13f7cfae93 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 29 Apr 2017 10:27:59 +0300 Subject: [PATCH 1/8] Cleanup after mod_dumb CVAR removal This fixes the following warnings on startup without configuration file: Script error, "gzdoom.pk3:menudef.txt" line 1727: Unknown CVar mod_dumb Script error, "gzdoom.pk3:menudef.txt" line 1728: Unknown CVar mod_dumb Script error, "gzdoom.pk3:menudef.txt" line 1729: Unknown CVar mod_dumb Script error, "gzdoom.pk3:menudef.txt" line 1731: Unknown CVar mod_dumb --- wadsrc/static/menudef.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 039a89cc11..d6bd18cfa4 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1724,11 +1724,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. From be496a89d9dfb8f1ad6b214c9e13262c11d59ac1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 29 Apr 2017 11:44:13 +0300 Subject: [PATCH 2/8] Fixed silent sounds on first play, stereo and precached only https://mantis.zdoom.org/view.php?id=637 --- src/s_sound.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 7f1d9dfb96..d2a830fef1 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -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 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 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; } //========================================================================== From 4c803b6615325d4060d7b0d11e926cbb3eb78943 Mon Sep 17 00:00:00 2001 From: svdijk Date: Sat, 29 Apr 2017 12:46:49 +0200 Subject: [PATCH 3/8] CMake: Fix building on 32-bit Linux (Core 2 Duo). --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 426089610c..95ab613c0a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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() From 8a36bf5c09e6ca2ea6bab336869cf2e9a4ccb1e4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 30 Apr 2017 11:45:57 +0300 Subject: [PATCH 4/8] Fixed potential crash in sndfile reader on Intel platform https://mantis.zdoom.org/view.php?id=640 --- src/sound/sndfile_decoder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sound/sndfile_decoder.cpp b/src/sound/sndfile_decoder.cpp index a46f0146b3..fd89aa2bcf 100644 --- a/src/sound/sndfile_decoder.cpp +++ b/src/sound/sndfile_decoder.cpp @@ -163,7 +163,10 @@ size_t SndFileDecoder::read(char *buffer, size_t bytes) while(total < frames) { size_t todo = MIN(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; From aae9b331989e3e5b0bcf860301ae4a46099a4c01 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 30 Apr 2017 07:37:31 -0400 Subject: [PATCH 5/8] - fixed: Swapping swtruecolor no longer crashes in OpenGL mode after selecting Software in the menu --- src/win32/hardware.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index 7c3127164e..7121738f4c 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -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) From 9a7aa7a7b49bfced3468303073f7a204d0862a61 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 30 Apr 2017 16:35:28 +0300 Subject: [PATCH 6/8] Fixed map name in demos recorded with * argument https://mantis.zdoom.org/view.php?id=642 --- src/g_level.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 3367a348bd..d9d28b72f1 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -256,7 +256,7 @@ CCMD(recordmap) G_DeferedInitNew(mapname); gameaction = ga_recordgame; newdemoname = argv[1]; - newdemomap = argv[2]; + newdemomap = mapname; } } catch (CRecoverableError &error) From aae6ded2ddf99ed012de5a71dbe47f5ff5e35e9b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 30 Apr 2017 06:48:35 -0700 Subject: [PATCH 7/8] Add snd_hrtf back in to allow enabling HRTF again It's now an Int type instead of Bool. Older config files that had it set to "true" or "false" will interpret it as 0, which is Auto (the default). --- src/sound/i_sound.cpp | 1 + src/sound/oalsound.cpp | 19 ++++++++++++++++--- src/sound/oalsound.h | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/sound/i_sound.cpp b/src/sound/i_sound.cpp index 939734e2f8..f80ec68654 100644 --- a/src/sound/i_sound.cpp +++ b/src/sound/i_sound.cpp @@ -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" diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 30aa8b3e12..b1235dfdd8 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -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(*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"); diff --git a/src/sound/oalsound.h b/src/sound/oalsound.h index 212ba5c46e..4a69028dc8 100644 --- a/src/sound/oalsound.h +++ b/src/sound/oalsound.h @@ -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 { From 49449e623e906e53b117fd5d09bce880c810c668 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 30 Apr 2017 06:56:34 -0700 Subject: [PATCH 8/8] Make an advanced sound option for snd_hrtf --- wadsrc/static/language.enu | 2 ++ wadsrc/static/menudef.txt | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index ca45cd1eff..31a66feb35 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -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"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index d6bd18cfa4..12e54978a6 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -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