mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-15 12:37:05 +02:00
Merge pull request #13762 from kencooke/audio-hrtf-bugfix
Fix possible assert in HRTF
This commit is contained in:
commit
5c3ab2c354
1 changed files with 4 additions and 1 deletions
|
@ -840,7 +840,7 @@ static void nearFieldGainCorrection(float azimuth, float distance, float& gainL,
|
|||
// normalized distance factor = [0,1] as distance = [HRTF_NEARFIELD_MAX,HRTF_HEAD_RADIUS]
|
||||
assert(distance < HRTF_NEARFIELD_MAX);
|
||||
assert(distance > HRTF_HEAD_RADIUS);
|
||||
float d = (HRTF_NEARFIELD_MAX - distance) * ( 1.0f / (HRTF_NEARFIELD_MAX - HRTF_HEAD_RADIUS));
|
||||
float d = (HRTF_NEARFIELD_MAX - distance) * (1.0f / (HRTF_NEARFIELD_MAX - HRTF_HEAD_RADIUS));
|
||||
|
||||
// angle of incidence at each ear
|
||||
float angleL = azimuth + HALFPI;
|
||||
|
@ -919,6 +919,9 @@ static void azimuthToIndex(float azimuth, int& index0, int& index1, float& frac)
|
|||
index1 = index0 + 1;
|
||||
frac = azimuth - (float)index0;
|
||||
|
||||
if (index0 >= HRTF_AZIMUTHS) {
|
||||
index0 -= HRTF_AZIMUTHS;
|
||||
}
|
||||
if (index1 >= HRTF_AZIMUTHS) {
|
||||
index1 -= HRTF_AZIMUTHS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue