Commit Graph

92 Commits

Author SHA1 Message Date
Chris Robinson 292de73c75 Use a template to read integers with endian awareness 2021-01-06 17:10:03 -08:00
Chris Robinson 8a86ec8ac5 Add a crossover frequency field for the device
Used when upsampling low-order ambisonic signals to higher order. Rather than a
hardcoded 400hz, it ensures a consistent crossover point when an ambdec
configuration is used. It can also allow for an alsoft config option.
2020-12-26 05:23:08 -08:00
Chris Robinson 5f233a2c24 Use more constexpr variables instead of macros 2020-12-25 20:52:18 -08:00
Chris Robinson d578bc6cb1 Move logging to core 2020-12-17 02:47:03 -08:00
Chris Robinson 1bb7f575f0 Don't modify the IR size of loaded HRTFs 2020-12-11 15:08:50 -08:00
Chris Robinson 50e33ce8f4 Change some macros into constexpr variables 2020-12-04 13:53:56 -08:00
Chris Robinson 69d55d7e03 Move the filters to core 2020-12-04 11:15:50 -08:00
Chris Robinson 534c487f14 Avoid AL types in hrtf.cpp/h 2020-11-22 17:27:22 -08:00
Jan Niklas Hasse bd9d5d7bf0 Silence warning about unused return values
warning C4834: discarding return value of function with 'nodiscard'
attribute
2020-10-20 18:33:53 +02:00
Chris Robinson 8724c1ce4b Remove extraneous parenthesis 2020-08-28 23:28:20 -07:00
Chris Robinson da25557ed6 Remove dead code 2020-06-30 16:44:14 -07:00
Chris Robinson 03eb6a01b9 Use a better type for array access 2020-06-07 11:00:19 -07:00
Chris Robinson 978f32acf7 Round the scaled HRTF delays 2020-05-21 17:59:15 -07:00
Chris Robinson c5e90ed6c7 Use an enum for FamCount 2020-05-19 12:15:57 -07:00
Chris Robinson 825206bfa2 Apply the ambisonic HF scaling in real-time with HRTF
Rather than applying the HF scale to the IRs necessitating them to be truncated
along with increasing the IR size, it can be applied to the input signal for
the same results. Consequently, the IR size can be notably shortened while
avoiding the extra truncation. In its place, the delayed reversed all-pass
technique can still be used on the input for maintaining phase when applying
the bandsplit/hfscalar filter to the input signal.
2020-05-19 10:27:52 -07:00
Chris Robinson 8acf16fc82 Make BuildBFormatHrtf a member of DirectHrtfState 2020-05-01 10:28:16 -07:00
Chris Robinson d67cba99bd Clean up some more unnecessary uses of AL types 2020-04-08 10:15:43 -07:00
Chris Robinson 9ce182228d Avoid some pre-C++14 workarounds 2020-03-22 08:51:06 -07:00
Chris Robinson 3e1a2c0f77 Use an intrusive_ptr for the device's HrtfStore 2020-03-01 17:16:09 -08:00
Chris Robinson 1d91e282c8 Update the MHR format
This update removes the 16/24-bit sample type enum, now always being 24-bit
(other than a very small size saving, there's no practical benefit to storing
16-bit samples). This also reverses the field storage, so no on-load fixup is
needed, and stores the IR delays with 2 bits of sub-sample precision, allowing
for slightly better timing (after resampling, blending, etc).
2020-02-11 00:37:21 -08:00
Chris Robinson 3ee0906c81 Use std::array and span for the HRTF delays 2020-02-08 15:00:58 -08:00
Chris Robinson e960276a47 Try harder to find the closest HRIR for the B-Format decoder 2020-01-26 01:23:39 -08:00
Chris Robinson a1a107f576 Return immediately on error when loading HRTFs 2020-01-13 18:13:05 -08:00
Chris Robinson a56a6116c0 Make a separate function for duplicate code 2020-01-13 15:55:31 -08:00
Chris Robinson 174e48fe8f Use the Field and Elevation structs directly when loading 2020-01-13 14:23:11 -08:00
Chris Robinson bc946b004e Don't assume the total length of certain arrays 2020-01-13 10:59:15 -08:00
Chris Robinson 7551242143 Use a span for a fixed-size array reference 2020-01-13 08:55:10 -08:00
Chris Robinson a866aece46 Add missing include 2020-01-12 19:28:12 -08:00
Chris Robinson 2f1a2ce242 Scale the resampled HRTF delays if they exceed the max 2020-01-12 14:49:11 -08:00
Chris Robinson 00d80497d8 Warn when resampled HRIR delays get clamped 2020-01-12 11:24:30 -08:00
Chris Robinson c182a3376a Blend the whole IR for the interpolated HRIR
The SIMD mixers may use a few more elements beyond the irSize, so not limiting
the blend to that size can slightly improve the quality for resampled HRIRs.
2020-01-12 11:08:05 -08:00
Chris Robinson b31886ad73 Fix blending for the right IR delay 2020-01-08 17:00:48 -08:00
Chris Robinson 1a2438b09c Don't blend the B-Format decoder HRIRs
Though fine in theory, an issue arises with extra phase interference since the
frequency phases aren't aligned for each response. It would be better to do the
blending before minimum phase reconstruction, where it can blend just the
frequency magnitudes, essentially allowing makemhr to increase the resolution
of the dataset.
2020-01-07 00:40:38 -08:00
Chris Robinson cdd24c7d01 Combine identical arrays 2020-01-04 00:59:49 -08:00
Chris Robinson 8b3a1ed9e4 Use an array type for the HRIR delay pair 2019-12-30 21:04:10 -08:00
Chris Robinson cfc8a82951 Load the HRIRs directly into HrirArrays 2019-12-30 20:49:19 -08:00
Chris Robinson d9e3f0edf6 Avoid declaring a variable early 2019-12-30 19:17:33 -08:00
Chris Robinson 28d2294b07 Workaround for MSVC 2015 2019-12-29 21:49:29 -08:00
Chris Robinson 3b3d3d3a03 Use a span for the band-splitter input 2019-12-25 21:48:58 -08:00
Chris Robinson 053de62398 Don't force the HRIR length to a rounded value
The coefficient and accumulation buffers are guaranteed large enough for the
full size, and the SIMD handlers will behave the same either way.
2019-12-11 02:24:44 -08:00
Chris Robinson 7d0c01050a Fix MHR limits 2019-12-11 01:20:00 -08:00
Chris Robinson d6bc56d7c1 Use proper array types instead of C-style arrays 2019-12-09 20:55:54 -08:00
Chris Robinson a1de05fed7 Avoid global macros for format-secific types 2019-12-09 20:45:11 -08:00
Chris Robinson e43c2bba61 Don't re-sort the enumerated HRTF list 2019-12-08 22:09:21 -08:00
Chris Robinson a280373dc1 Improve blended IR delay precision for the B-Format decoder 2019-12-08 16:46:11 -08:00
Chris Robinson c9a6527121 Use doubles for blending the B-Format decoder HRIRs 2019-12-06 22:31:30 -08:00
Chris Robinson fcf03705e6 Clear the resampler after use 2019-11-29 18:19:01 -08:00
Chris Robinson a8d06c0731 Store HRTF delays with some fractional precision
Since the delays get bilinearly filtered before use, maintaining a bit of extra
precision can help accuracy even if it ultimately gets rounded to the nearest
integer before use. This should help with resampled HRTFs, which need to scale
the delays that are already rounded, and can also be leveraged by an updated
MHR format.
2019-11-29 14:01:39 -08:00
Chris Robinson 2453f4ec14 Avoid a shadow declaration warning 2019-11-29 08:41:20 -08:00
Chris Robinson 7ff165b095 Use unsigned for array indices 2019-11-29 08:33:46 -08:00