diff options
author | Chris Robinson <[email protected]> | 2019-01-22 21:36:40 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-22 21:36:40 -0800 |
commit | e332ac852892327d913ce8adfbb85bf30c8ccd24 (patch) | |
tree | ea86a43b78eeb5e8b5f17b22e239ade8ee4c8353 /Alc/hrtf.cpp | |
parent | 3ab4bc51865d89728bf7e8fee3a1eadd08131c96 (diff) |
Use the farthest of multi-field HRTFs
Diffstat (limited to 'Alc/hrtf.cpp')
-rw-r--r-- | Alc/hrtf.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Alc/hrtf.cpp b/Alc/hrtf.cpp index 75e00448..5996c947 100644 --- a/Alc/hrtf.cpp +++ b/Alc/hrtf.cpp @@ -823,10 +823,16 @@ HrtfEntry *LoadHrtf02(std::istream &data, const char *filename) if(distance[f] < MIN_FD_DISTANCE || distance[f] > MAX_FD_DISTANCE) { - ERR("Unsupported field distance[%d]: distance=%d (%dmm to %dmm)\n", f, + ERR("Unsupported field distance[%d]=%d (%dmm to %dmm)\n", f, distance[f], MIN_FD_DISTANCE, MAX_FD_DISTANCE); failed = AL_TRUE; } + if(f > 0 && distance[f] <= distance[f-1]) + { + ERR("Field distance[%d] is not after previous (%dmm > %dmm)\n", f, distance[f], + distance[f-1]); + failed = AL_TRUE; + } if(evCount[f] < MIN_EV_COUNT || evCount[f] > MAX_EV_COUNT) { ERR("Unsupported elevation count: evCount[%d]=%d (%d to %d)\n", f, @@ -983,9 +989,10 @@ HrtfEntry *LoadHrtf02(std::istream &data, const char *filename) } } + const ALsizei ebase{std::accumulate(evCount.begin(), evCount.end()-1, 0)}; return CreateHrtfStore(rate, irSize, - static_cast<ALfloat>(distance[0]) / 1000.0f, evCount[0], irCount, azCount.data(), - evOffset.data(), &reinterpret_cast<ALfloat(&)[2]>(coeffs[0]), + static_cast<ALfloat>(distance[fdCount-1]) / 1000.0f, evCount[fdCount-1], irTotal, + azCount.data()+ebase, evOffset.data()+ebase, &reinterpret_cast<ALfloat(&)[2]>(coeffs[0]), &reinterpret_cast<ALubyte(&)[2]>(delays[0]), filename); } |