aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-07-15 23:45:03 -0700
committerChris Robinson <[email protected]>2011-07-15 23:45:03 -0700
commit7381b1a69696c2e1dc2161e85f9488b4cdef1198 (patch)
tree6473625fd9bdf398f8e873b7a24e1f0f567f1abf /Alc/hrtf.c
parent99bcb7a0f6ccce2fe673016f702a85b62bfb6805 (diff)
Make the sample rate part of the HRTF struct
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 7932689d..cc383163 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -27,15 +27,16 @@
#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 };
-static struct HRTF {
+static struct Hrtf {
+ ALuint sampleRate;
ALshort coeffs[HRIR_COUNT][HRIR_LENGTH];
ALubyte delays[HRIR_COUNT];
} Hrtf = {
+ 44100,
#include "hrtf_tables.inc"
};
@@ -88,7 +89,7 @@ void GetLerpedHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALflo
// Calculate azimuth indices and interpolation factor for the second
// elevation.
- CalcAzIndices (evidx[1], azimuth, azidx, &mu[1]);
+ CalcAzIndices(evidx[1], azimuth, azidx, &mu[1]);
// Calculate the second set of linear HRIR indices for left and right
// channels.
@@ -133,7 +134,7 @@ void GetLerpedHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALflo
ALCboolean IsHrtfCompatible(ALCdevice *device)
{
- if(device->FmtChans == DevFmtStereo && device->Frequency == sampleRate)
+ if(device->FmtChans == DevFmtStereo && device->Frequency == Hrtf.sampleRate)
return ALC_TRUE;
return ALC_FALSE;
}
@@ -154,9 +155,10 @@ void InitHrtf(void)
{
const ALubyte maxDelay = SRC_HISTORY_LENGTH;
ALboolean failed = AL_FALSE;
- struct HRTF newdata;
+ struct Hrtf newdata;
size_t i, j;
+ newdata.sampleRate = 44100;
for(i = 0;i < HRIR_COUNT;i++)
{
for(j = 0;j < HRIR_LENGTH;j++)