aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-02-23 20:51:30 -0800
committerChris Robinson <[email protected]>2014-02-23 21:02:11 -0800
commit5731534e8d3582c2332a99e7355aa88534aa706b (patch)
tree0dd8fc8318960d8207cdaa603b89823105c500f2 /Alc/hrtf.c
parent9f43de62ab62577a5159789eebcbb76768750418 (diff)
Move the default hrtf table to an external file
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 8aa3718f..08a63f3c 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -79,16 +79,6 @@ struct Hrtf {
static const ALchar magicMarker00[8] = "MinPHR00";
static const ALchar magicMarker01[8] = "MinPHR01";
-/* Define the default HRTF:
- * ALubyte defaultAzCount [DefaultHrtf.evCount]
- * ALushort defaultEvOffset [DefaultHrtf.evCount]
- * ALshort defaultCoeffs [DefaultHrtf.irCount * defaultHrtf.irSize]
- * ALubyte defaultDelays [DefaultHrtf.irCount]
- *
- * struct Hrtf DefaultHrtf
- */
-#include "hrtf_tables.inc"
-
static struct Hrtf *LoadedHrtfs = NULL;
/* Calculate the elevation indices given the polar elevation in radians.
@@ -789,10 +779,9 @@ static FILE *OpenDataFile(const char *fname, const char *subdir)
static struct Hrtf *LoadHrtf(ALuint deviceRate)
{
- const char *fnamelist = NULL;
+ const char *fnamelist = "default-%r.mhr";
- if(!ConfigValueStr(NULL, "hrtf_tables", &fnamelist))
- return NULL;
+ ConfigValueStr(NULL, "hrtf_tables", &fnamelist);
while(*fnamelist != '\0')
{
struct Hrtf *Hrtf = NULL;
@@ -899,9 +888,6 @@ const struct Hrtf *GetHrtf(ALCdevice *device)
Hrtf = LoadHrtf(device->Frequency);
if(Hrtf != NULL)
return Hrtf;
-
- if(device->Frequency == DefaultHrtf.sampleRate)
- return &DefaultHrtf;
}
ERR("Incompatible format: %s %uhz\n",
DevFmtChannelsString(device->FmtChans), device->Frequency);
@@ -910,22 +896,18 @@ const struct Hrtf *GetHrtf(ALCdevice *device)
ALCboolean FindHrtfFormat(const ALCdevice *device, enum DevFmtChannels *chans, ALCuint *srate)
{
- const struct Hrtf *hrtf = &DefaultHrtf;
-
- if(device->Frequency != DefaultHrtf.sampleRate)
+ const struct Hrtf *hrtf = LoadedHrtfs;
+ while(hrtf != NULL)
{
- hrtf = LoadedHrtfs;
- while(hrtf != NULL)
- {
- if(device->Frequency == hrtf->sampleRate)
- break;
- hrtf = hrtf->next;
- }
+ if(device->Frequency == hrtf->sampleRate)
+ break;
+ hrtf = hrtf->next;
+ }
- if(hrtf == NULL)
- hrtf = LoadHrtf(device->Frequency);
- if(hrtf == NULL)
- hrtf = &DefaultHrtf;
+ if(hrtf == NULL)
+ {
+ hrtf = LoadHrtf(device->Frequency);
+ if(hrtf == NULL) return ALC_FALSE;
}
*chans = DevFmtStereo;