From b82d2cf05555999a4b8597e2b23799b5b7023c63 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 23 Oct 2017 13:26:35 -0700 Subject: Store the HRTF distance in the Hrtf handle --- Alc/hrtf.c | 19 +++++++++++-------- Alc/hrtf.h | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'Alc') diff --git a/Alc/hrtf.c b/Alc/hrtf.c index 4f0465de..8959a0f8 100644 --- a/Alc/hrtf.c +++ b/Alc/hrtf.c @@ -305,10 +305,10 @@ void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei N } -static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, ALsizei evCount, ALsizei irCount, - const ALubyte *azCount, const ALushort *evOffset, - const ALfloat (*coeffs)[2], const ALubyte (*delays)[2], - const char *filename) +static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, + ALfloat distance, ALsizei evCount, ALsizei irCount, const ALubyte *azCount, + const ALushort *evOffset, const ALfloat (*coeffs)[2], const ALubyte (*delays)[2], + const char *filename) { struct Hrtf *Hrtf; size_t total; @@ -337,6 +337,7 @@ static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, ALsizei evCount InitRef(&Hrtf->ref, 0); Hrtf->sampleRate = rate; Hrtf->irSize = irSize; + Hrtf->distance = distance; Hrtf->evCount = evCount; /* Set up pointers to storage following the main HRTF struct. */ @@ -570,7 +571,7 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const char * } } - Hrtf = CreateHrtfStore(rate, irSize, evCount, irCount, azCount, + Hrtf = CreateHrtfStore(rate, irSize, 0.0f, evCount, irCount, azCount, evOffset, coeffs, delays, filename); } @@ -718,7 +719,7 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const char * } } - Hrtf = CreateHrtfStore(rate, irSize, evCount, irCount, azCount, + Hrtf = CreateHrtfStore(rate, irSize, 0.0f, evCount, irCount, azCount, evOffset, coeffs, delays, filename); } @@ -963,8 +964,10 @@ static struct Hrtf *LoadHrtf02(const ALubyte *data, size_t datalen, const char * } } - Hrtf = CreateHrtfStore(rate, irSize, evCount, irCount, azCount, - evOffset, coeffs, delays, filename); + Hrtf = CreateHrtfStore(rate, irSize, + (ALfloat)distance / 1000.0f, evCount, irCount, azCount, evOffset, + coeffs, delays, filename + ); } free(evOffset); diff --git a/Alc/hrtf.h b/Alc/hrtf.h index 0c47ded9..4fd774a7 100644 --- a/Alc/hrtf.h +++ b/Alc/hrtf.h @@ -22,6 +22,8 @@ struct Hrtf { ALuint sampleRate; ALsizei irSize; + + ALfloat distance; ALubyte evCount; const ALubyte *azCount; -- cgit v1.2.3