Store the HRTF distance in the Hrtf handle

This commit is contained in:
Chris Robinson
2017-10-23 13:26:35 -07:00
parent 7d4028b2df
commit b82d2cf055
2 changed files with 13 additions and 8 deletions
+11 -8
View File
@@ -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);
+2
View File
@@ -22,6 +22,8 @@ struct Hrtf {
ALuint sampleRate;
ALsizei irSize;
ALfloat distance;
ALubyte evCount;
const ALubyte *azCount;