diff options
author | Sven Gothel <[email protected]> | 2014-01-26 07:06:02 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-26 07:06:02 +0100 |
commit | e6f4251945c228a775649b5ccd7f11dd4519c28d (patch) | |
tree | 8454b34363358cf9bb502021a68c6985c97daac4 /Alc/hrtf.c | |
parent | 389ae1f767bfad6116e21306fc3cdf89a4cbcc0a (diff) | |
parent | 49baa9128dd98e986639def4f24c7522d9ec6b56 (diff) |
Merge branch 'UPSTREAM'
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r-- | Alc/hrtf.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -92,7 +92,7 @@ static void CalcEvIndices(const struct Hrtf *Hrtf, ALfloat ev, ALuint *evidx, AL */ static void CalcAzIndices(const struct Hrtf *Hrtf, ALuint evidx, ALfloat az, ALuint *azidx, ALfloat *azmu) { - az = (F_PI*2.0f + az) * Hrtf->azCount[evidx] / (F_PI*2.0f); + az = (F_2PI + az) * Hrtf->azCount[evidx] / (F_2PI); azidx[0] = fastf2u(az) % Hrtf->azCount[evidx]; azidx[1] = (azidx[0] + 1) % Hrtf->azCount[evidx]; *azmu = az - floorf(az); @@ -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; |