aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c3
-rw-r--r--Alc/hrtf.c8
-rw-r--r--OpenAL32/Include/alMain.h1
3 files changed, 10 insertions, 2 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b84aa6e0..f95a2ac7 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1335,8 +1335,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(!device->IsLoopbackDevice && GetConfigValueBool(NULL, "hrtf", AL_FALSE))
device->Flags |= DEVICE_USE_HRTF;
- if((device->FmtChans != DevFmtStereo || device->Frequency != 44100) &&
- (device->Flags&DEVICE_USE_HRTF))
+ if((device->Flags&DEVICE_USE_HRTF) && !IsHrtfCompatible(device))
{
AL_PRINT("HRTF disabled (format is %uhz %s)\n", device->Frequency, DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_USE_HRTF;
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 43cfb80b..801e26b9 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -27,6 +27,7 @@
#define HRIR_COUNT 828
+static const ALuint sampleRate = 44100;
static const ALubyte evCount = 19;
static const ALushort evOffset[19] = { 0, 1, 13, 37, 73, 118, 174, 234, 306, 378, 450, 522, 594, 654, 710, 755, 791, 815, 827 };
static const ALubyte azCount[19] = { 1, 12, 24, 36, 45, 56, 60, 72, 72, 72, 72, 72, 60, 56, 45, 36, 24, 12, 1 };
@@ -68,6 +69,13 @@ void GetHrtfCoeffs(ALfloat elevation, ALfloat angle, const ALshort **left, const
*right = Hrtf.coeffs[ridx];
}
+ALCboolean IsHrtfCompatible(ALCdevice *device)
+{
+ if(device->FmtChans == DevFmtStereo && device->Frequency == sampleRate)
+ return ALC_TRUE;
+ return ALC_FALSE;
+}
+
void InitHrtf(void)
{
const char *str;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 0c95177f..3264d5ed 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -502,6 +502,7 @@ ALboolean IsValidChannels(ALenum type);
#define HRIR_LENGTH (1<<HRIR_BITS)
#define HRIR_MASK (HRIR_LENGTH-1)
void InitHrtf(void);
+ALCboolean IsHrtfCompatible(ALCdevice *device);
void GetHrtfCoeffs(ALfloat elevation, ALfloat angle, const ALshort **left, const ALshort **right, ALuint *ldelay, ALuint *rdelay);
void al_print(const char *fname, unsigned int line, const char *fmt, ...)