diff options
author | Chris Robinson <[email protected]> | 2013-05-31 19:29:32 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-31 19:29:32 -0700 |
commit | 7257aa3ed2c1df75f685ae1fa3dec0316ce32cbf (patch) | |
tree | dee494f22b40d6ddfd5e0f57ede463c001b9e15c /Alc/hrtf.c | |
parent | 69e0c19767c820e9c420c61bd335aa050b4440f4 (diff) |
Allow enabling HRTF through a context creation attribute
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r-- | Alc/hrtf.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -783,6 +783,30 @@ const struct Hrtf *GetHrtf(ALCdevice *device) return NULL; } +void FindHrtfFormat(const ALCdevice *device, enum DevFmtChannels *chans, ALCuint *srate) +{ + const struct Hrtf *hrtf = &DefaultHrtf; + + if(device->Frequency != DefaultHrtf.sampleRate) + { + hrtf = LoadedHrtfs; + while(hrtf != NULL) + { + if(device->Frequency == hrtf->sampleRate) + break; + hrtf = hrtf->next; + } + + if(hrtf == NULL) + hrtf = LoadHrtf(device->Frequency); + if(hrtf == NULL) + hrtf = &DefaultHrtf; + } + + *chans = DevFmtStereo; + *srate = hrtf->sampleRate; +} + void FreeHrtfs(void) { struct Hrtf *Hrtf = NULL; |