aboutsummaryrefslogtreecommitdiffstats
path: root/alc/hrtf.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-05-21 17:59:15 -0700
committerChris Robinson <[email protected]>2020-05-21 17:59:15 -0700
commit978f32acf70c979a646e1f98ac12aea4288a41e0 (patch)
tree896c06e786a7e49099c833f5794d0251a1ed0bad /alc/hrtf.cpp
parent109875942c429a3c3eabfb873180d3a465e4ec53 (diff)
Round the scaled HRTF delays
Diffstat (limited to 'alc/hrtf.cpp')
-rw-r--r--alc/hrtf.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp
index 7f951f35..a61afcda 100644
--- a/alc/hrtf.cpp
+++ b/alc/hrtf.cpp
@@ -1446,6 +1446,8 @@ HrtfStorePtr GetLoadedHrtf(const std::string &name, const char *devname, const A
if(hrtf->sampleRate != devrate)
{
+ TRACE("Resampling HRTF %s (%uhz -> %uhz)\n", name.c_str(), hrtf->sampleRate, devrate);
+
/* Calculate the last elevation's index and get the total IR count. */
const size_t lastEv{std::accumulate(hrtf->field, hrtf->field+hrtf->fdCount, size_t{0},
[](const size_t curval, const HrtfStore::Field &field) noexcept -> size_t
@@ -1501,7 +1503,7 @@ HrtfStorePtr GetLoadedHrtf(const std::string &name, const char *devname, const A
{
ubyte2 &delays = const_cast<ubyte2&>(hrtf->delays[i]);
for(size_t j{0};j < 2;++j)
- delays[j] = static_cast<ALubyte>(float2int(new_delays[i][j] * delay_scale));
+ delays[j] = static_cast<ALubyte>(float2int(new_delays[i][j]*delay_scale + 0.5f));
}
/* Scale the IR size for the new sample rate and update the stored