Commit Graph

3241 Commits

Author SHA1 Message Date
Chris Robinson
5ec11a017c Add casts for assigning the SSE bsinc filter pointers 2017-10-07 15:28:35 -07:00
Chris Robinson
296abf03de Avoid a separate function to query ambisonic mode support
Now FuMa and ACN channel orders are required, as are FuMa, SN3D, and N3D
normalization schemes. An integer query (alcGetIntegerv) is added for the
maximum ambisonic order.
2017-09-27 11:58:36 -07:00
Chris Robinson
1ab8902621 Re-update effect slots when context properties change
Also keep all free property update structs together in the context instead of
per-object.
2017-09-27 11:13:18 -07:00
Chris Robinson
fd70b0bca6 Don't update context and listener props unnecessarily 2017-09-27 09:36:34 -07:00
Chris Robinson
101d284a18 Update the context state properties separately
The context state properties are less likely to change compared to the listener
state, and future changes may prefer more infrequent updates to the context
state.

Note that this puts the MetersPerUnit in as a context state, even though it's
handled through the listener functions. Considering the infrequency that it's
updated at (generally set just once for the context's lifetime), it makes more
sense to put it there than with the more frequently updated listener
properties. The aforementioned future changes would also prefer MetersPerUnit
to not be updated unnecessarily.
2017-09-27 08:55:42 -07:00
Chris Robinson
c5a917b401 Restore the original JACK message callback when possible 2017-09-23 03:56:45 -07:00
Chris Robinson
369f52a0d7 Add an option to ignore the app's speed of sound for reverb decay 2017-09-22 05:42:04 -07:00
kcat
9007b77355 Merge pull request #149 from dscharrer/master
Fix build on Gentoo FreeBSD with freebsd-lib 9.1
2017-09-21 10:28:04 -07:00
Chris Robinson
fc9cb2fbd8 Use the app-specified speed of sound for reverb decay
Specifically, the initial reverb decay as determined by the source distance,
and the reverb decayhf limit from air absorption.
2017-09-21 10:20:59 -07:00
Daniel Scharrer
46b9efc5a2 Fix build on Gentoo FreeBSD with freebsd-lib 9.1 2017-09-21 17:37:10 +02:00
Chris Robinson
90cedbea49 Pass the context to the auxiliary effect update method 2017-09-21 05:42:35 -07:00
Chris Robinson
bc386af5c5 Manually save and restore the FPU rounding mode on Windows
Apparently there is a bug with at least MinGW-W64 where fegetenv and fesetenv
do not properly save and restore the FPU rounding mode, resulting in the
rounding mode remaining as round-to-zero after certain function calls. I do not
know if this also affects MSVC, but better safe than sorry for now.
2017-09-19 03:42:00 -07:00
Chris Robinson
cd15b1775e Avoid some extraneous load calls
This likely doesn't change anything given a working optimizer, but it cleans up
the code some.
2017-08-30 11:30:19 -07:00
Chris Robinson
2916efee21 Automatically generate the bsinc table when building
This makes bsincgen a native tool like bin2h, so it can run automatically when
compiling.
2017-08-28 10:31:23 -07:00
Chris Robinson
6c367cad6e Ensure some macros have the correct size 2017-08-28 05:56:57 -07:00
Chris Robinson
a4d357de06 Add a higher quality bsinc resampler using 24 sample points
This improves the transition width, allowing more of the higher frequencies
remain audible. It would be preferrable to have an upper limit of 32 points
instead of 48, to reduce the overall table size and the CPU cost for down-
sampling.
2017-08-27 10:16:36 -07:00
Chris Robinson
561e95528f Rename the bsinc resampler to bsinc12 2017-08-25 05:52:19 -07:00
Chris Robinson
9ea32713b5 Constify some pointers 2017-08-23 23:01:11 -07:00
Chris Robinson
921a820867 Meters per unit can't be 0 2017-08-21 00:30:14 -07:00
Chris Robinson
e7c4681e9a 0 meters per unit is invalid 2017-08-21 00:27:52 -07:00
Chris Robinson
3e56e7f562 Properly clear the extra ChannelsPerOrder entries 2017-08-19 23:52:24 -07:00
Chris Robinson
5f50d085ad Pass the filter entry to apply to resample_fir4 2017-08-18 19:20:30 -07:00
Chris Robinson
5048956ff0 Keep bsinc filter quality more consistent between scales
This generates the filters using the proper size and scale. The 'a' divisor
should represent the +/- sample range (and thus be a whole number), with the
number of sample points being double that. Increasing the filter size to a
multiple of 4 (for SIMD) can be done by padding in 0s afterward.
2017-08-17 23:21:41 -07:00
Chris Robinson
9fd3e5f529 Correct the bsinc filter order
Despite the claim that it was an 11th order filter, the transition width was
generated by specifying 12th order. A 12th order filter would need 14 sample
points rather than the 12 it had.
2017-08-17 05:51:18 -07:00
Chris Robinson
e0408d8edf Make the sinc4 table static 2017-08-16 18:19:04 -07:00
Chris Robinson
5008024e73 Store the sinc4 table in the filter state
Also rename the resampler functions to remove the unnecessary '32' token.
2017-08-16 18:09:53 -07:00
Chris Robinson
f9c09cc845 Simplify bsinc filter storage in the filter state
Rather than storing individual pointers to filter, scale delta, phase delta,
and scale  phase delta entries, per phase index, the new table layout makes it
trivial to access the per-phase filter and delta entries given the base offset
and coefficient count.
2017-08-16 02:45:25 -07:00
Chris Robinson
520dd5c779 Make the bsinc table layout more efficient
The old layout separated filters, scale deltas, phase deltas, and scale phase
deltas into separate segments that each contained a numbers of scale and phase
entries, Since processing a sample needed a filter and one of each delta entry
relating to a particular scale and phase, the memory needed would be spread
across the whole table. And since subsequent samples would use a different
phase, it would jump around the table a whole lot as well.

The new layout packs the data in a way more consistent with its use. The
filters, scale deltas, phase deltas, and scale phase deltas are interleaved,
such that for a particular scale and phase, the filter and delta entries used
are contiguous. And the phase entries for a particular scale are kept together,
so the ~500 to ~1000 samples processed per source update stay within the same
3KB to 6KB area of the 70+KB table, which is much more cache friendly.
2017-08-16 02:05:10 -07:00
Chris Robinson
4dd53ab942 Keep bsinc info together in a struct 2017-08-15 04:15:50 -07:00
Chris Robinson
0604b00360 Check the source type once when mixing 2017-08-14 22:58:24 -07:00
Chris Robinson
a931314d3f Add restrict to a few more parameters 2017-08-10 00:14:55 -07:00
Chris Robinson
2987c87645 Check the right size for the in-progress mhr update 2017-08-09 20:42:22 -07:00
Chris Robinson
649bf575e2 Declare that a couple arrays are aligned 2017-08-09 14:57:01 -07:00
Chris Robinson
ad3c4b81e2 Add experimental support for 24-bit, dual-ear HRTFs
Currently makehrtf only handles 24-bit output, not dual-ear, and only when
given the --experimental switch. Files produced this way will not be guaranteed
future compatibility. When the mhr format is also updated with multi-distance
measurements, the experimental switch can go away.
2017-08-08 20:30:26 -07:00
Chris Robinson
530002e168 Avoid re-selecting the direct HRTF mix function 2017-08-07 01:38:26 -07:00
Chris Robinson
8a735d0ba9 Add a front-stablizer config option for surround sound modes
This improves a stereo (front-left + front-right) sound "image" by generating a
front-center channel signal. Done correctly, it helps reduce the comb effects
and phase errors associated with using only two speakers to simulate center
sounds.

Note that it shouldn't be used if the front-center channel is already included
in the positional audio mix (the dialog effect is okay). In general, it may
actually be better to exclude the front-center channel from the positional
audio mix and use this to generate front-center output.
2017-07-31 23:49:48 -07:00
Chris Robinson
88c0d22e7c Don't bother returning the IR length for B-Format decoding 2017-07-31 01:20:42 -07:00
Chris Robinson
e5431bbef7 Print an error if the input channel isn't in the device
Rather than the other way around, if a device channel isn't in the channel map.
2017-07-31 01:11:36 -07:00
Chris Robinson
de51ba088e Update default 5.1 and 6.1 coefficients to exclude front-center
Not all speaker kits have a front-center speaker capable of outputing full-
range content. It's best to err on the side of caution and not include front-
center for normal positional sound by default, leaving it instead for the
dedicated dialog effect.
2017-07-30 23:39:06 -07:00
Chris Robinson
12db67f548 Cleanup output write functions 2017-07-27 19:07:02 -07:00
Chris Robinson
e25ba747e6 Remove unused macros 2017-07-25 17:42:16 -07:00
Chris Robinson
75841642bf Update makehrtf to use a larger FFT by default
Also fixes DC offset removal and increases the max IR size.
2017-07-25 16:17:46 -07:00
Chris Robinson
82a990e08e Downgrade some ERRs to TRACEs
These don't exist outside OSSv4, e.g. with OSS/Free, padsp, or aoss, so no need
to be concerned.
2017-07-23 16:43:39 -07:00
Chris Robinson
5ab4e584ee Make sure OSS device files exist before adding them 2017-07-23 16:38:54 -07:00
Chris Robinson
f91445029d Fix default effect initialization 2017-07-19 18:26:46 -07:00
Chris Robinson
fea74124c8 Add an all-pass filter that replicates the band splitter's phase shift 2017-07-19 02:48:01 -07:00
Chris Robinson
0135ddc2e5 Scale the source volume by +3dB for a full spread
This effectively turns a full spread source into an ambient response,
preventing such sources from being unexpectedly quiet.
2017-07-18 22:15:32 -07:00
Chris Robinson
c484935542 Apply the output buffer offset before writing to it 2017-07-15 23:13:08 -07:00
Chris Robinson
ff696bc1fe Set the float PCM GUID for wave files only when outputting float 2017-07-15 01:45:48 -07:00
Chris Robinson
8fa3f6da64 Add the default auxiliary slot to the active slot array 2017-07-13 23:13:02 -07:00