diff options
author | Chris Robinson <[email protected]> | 2022-07-31 09:52:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-08-02 18:26:49 -0700 |
commit | 810821a2216ac786eac602b47c21e638a35f4ace (patch) | |
tree | 1e49d82ae449b77aeac56f8ba1538b214e91305d /core/hrtf.cpp | |
parent | a700edc1716181d899b670826e615969815fa0c8 (diff) |
Simplify calculating nearest HRIR index
Diffstat (limited to 'core/hrtf.cpp')
-rw-r--r-- | core/hrtf.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/core/hrtf.cpp b/core/hrtf.cpp index 38c68cfa..3653c334 100644 --- a/core/hrtf.cpp +++ b/core/hrtf.cpp @@ -301,15 +301,8 @@ void DirectHrtfState::build(const HrtfStore *Hrtf, const uint irSize, ir1offset + ((az1.idx+1) % Hrtf->elev[elev1_idx].azCount) }; - const std::array<double,4> blend{{ - (1.0-elev0.blend) * (1.0-az0.blend), - (1.0-elev0.blend) * ( az0.blend), - ( elev0.blend) * (1.0-az1.blend), - ( elev0.blend) * ( az1.blend) - }}; - /* The largest blend factor serves as the closest HRIR. */ - const size_t irOffset{idx[std::max_element(blend.begin(), blend.end()) - blend.begin()]}; + const size_t irOffset{idx[(elev0.blend >= 0.5f)*2 + (az1.blend >= 0.5f)]}; ImpulseResponse res{Hrtf->coeffs[irOffset], Hrtf->delays[irOffset][0], Hrtf->delays[irOffset][1]}; |