Commit Graph

1095 Commits

Author SHA1 Message Date
Chris Robinson cbb796bf31 Use ALsizei for sizes and offsets with the mixer
Unsigned 32-bit offsets actually have some potential overhead on 64-bit targets
for pointer/array accesses due to rules on integer wrapping. No idea how much
impact it has in practice, but it's nice to be correct about it.
2017-01-16 08:06:25 -08:00
Chris Robinson 9f23d17333 Use second-order ambisonics for basic HRTF rendering
This should improve positional quality for relatively low cost. Full HRTF
rendering still only uses first-order since the only use of the dry buffer
there is for first-order content (B-Format buffers, effects).
2017-01-15 13:57:22 -08:00
Chris Robinson 080b0cea8b Reorder filter coefficients 2016-12-21 21:35:50 -08:00
Chris Robinson 315bd556ac Convert the SndIO backend to the updated API 2016-12-21 17:28:22 -08:00
Chris Robinson 6886f77cbc Only send source updates for sources that have updated 2016-11-23 01:31:13 -08:00
Chris Robinson 01babb69d2 Clean up finding a source's voice 2016-11-22 02:59:54 -08:00
Chris Robinson e46a92c220 Workaround some systems having an ECHO macro 2016-10-30 08:45:09 -07:00
Chris Robinson 76cd6797b7 Add some more 'restrict' keywords 2016-10-06 01:39:18 -07:00
Chris Robinson 965e91c702 Remove an unused struct 2016-10-05 20:35:14 -07:00
Chris Robinson 9b8f36b758 Pass current and target gains directly for mixing 2016-10-05 20:33:45 -07:00
Chris Robinson 9349ee9002 Make some pointer-to-array parameters const 2016-10-04 16:25:43 -07:00
Chris Robinson 67c74e858b Finalize AL_SOFT_gain_clamp_ex 2016-10-03 12:11:50 -07:00
Chris Robinson f5e4a3ed85 Add a volume-adjust config option to adjust the source output volume
Designed for apps that either don't change the listener's AL_GAIN, or don't
allow the listener's AL_GAIN to go above 1. This allows the volume to still be
increased further than such apps may allow, if users find it too quiet.

Be aware that increasing this can easily cause clipping. The gain limit
reported by AL_GAIN_LIMIT_SOFT is also affected by this.
2016-09-24 18:46:41 -07:00
Chris Robinson 24f9a0f2ae Remove some more unnecessary volatiles 2016-09-24 14:29:27 -07:00
Chris Robinson 53d8a49673 Call ALfilterState_processC directly
It's the only implementation currently, so there's no point to having it stored
as a function pointer in the filter struct. Even if there were SIMD versions,
it'd be a global selection, not per-instance.
2016-09-12 11:48:15 -07:00
Chris Robinson 4fcf9279fe Mark a global variable declaration as extern 2016-09-11 07:20:02 -07:00
Chris Robinson 7973c5abf8 Use unsigned int shifts for device flags 2016-09-07 05:18:42 -07:00
Chris Robinson 1d9d1958db Make the SelectMixer function sharable 2016-09-06 13:21:11 -07:00
Chris Robinson a758cc8243 Remove use of DECL_CONST
No idea if it was really gaining us anything, but removing it fixes a crash I
was getting with libs built with Clang.
2016-09-06 09:09:25 -07:00
Chris Robinson 8a64f07121 Use a predefined identity matrix 2016-09-05 02:02:14 -07:00
Chris Robinson cf0ef500ec Rename MatrixMixerFunc to RowMixerFunc 2016-09-02 00:29:46 -07:00
Chris Robinson 5bf0c64258 Add a query for the maximum source gain limit 2016-08-28 18:21:09 -07:00
Chris Robinson 3d59021702 Clamp the maximum mixing gain boost to 16
The combined source and listener gains now can't exceed a multiplier of 16
(~24dB). This is to avoid mixes getting out of control with large volume
boosts, which reduces the effective precision given by floating-point.
2016-08-27 06:28:04 -07:00
Chris Robinson 4b153dade8 Allow sources to play while alcSuspendContext is in effect
This appears to be how Creative's Windows drivers handle it, and is necessary
for at least the Windows version of UT2k4 (otherwise it tries to play a source
while suspended, checks and sees it's stopped, then kills it before it's given
a chance to start playing).

Consequently, the internal properties it gets mixed with are determined by what
the source properties are at the time of the play call, and the listener
properties at the time of the suspend call.

This does not change alDeferUpdatesSOFT, which will still hold the play state
change until alProcessUpdatesSOFT.
2016-08-26 21:19:38 -07:00
Chris Robinson a16739f765 Properly defer effect slot changes
Note that this now also causes all playing sources to update when an effect
slot is updated. This is a bit wasteful, as it should only need to re-update
sources that are using the effect slot (and only when a relevant property is
changed), but it's good enough. Especially with deferring since all playing
sources are going to get updated on the process call anyway.
2016-08-25 06:17:36 -07:00
Chris Robinson 0fbf34fb45 Add a ref count to ALeffectState
This is mostly just reorganizing the effects to call the Construct method which
initializes the ref count.
2016-08-25 03:49:57 -07:00
Chris Robinson 8bf4a22876 Combine related members into a struct 2016-08-24 00:25:28 -07:00
Chris Robinson c7eb0b7393 Don't pass the context's distance model as the source's 2016-08-23 19:17:17 -07:00
Chris Robinson dc8b7814c7 Avoid resupplying unneeded source updates
The source's voice holds a copy of the last properties it received, so listener
updates can make sources recalculate internal properties from that stored copy.
2016-08-23 18:56:01 -07:00
Chris Robinson 770e2ff7ed Use a more specialized mixer function for B-Format to HRTF 2016-08-12 05:26:36 -07:00
Chris Robinson c6c6e3324d Decode directly from B-Format to HRTF instead of a cube
Last time this attempted to average the HRIRs according to their contribution
to a given B-Format channel as if they were loudspeakers, as well as averaging
the HRIR delays. The latter part resulted in the loss of the ITD (inter-aural
time delay), a key component of HRTF.

This time, the HRIRs are averaged similar to above, except instead of averaging
the delays, they're applied to the resulting coefficients (for example, a delay
of 8 would apply the HRIR starting at the 8th sample of the target HRIR). This
does roughly double the IR length, as the largest delay is about 35 samples
while the filter is normally 32 samples. However, this is still smaller the
original data set IR (which was 256 samples), it also only needs to be applied
to 4 channels for first-order ambisonics, rather than the 8-channel cube. So
it's doing twice as much work per sample, but only working on half the number
of samples.

Additionally, since the resulting HRIRs no longer rely on an extra delay line,
a more efficient HRTF mixing function can be made that doesn't use one. Such a
function can also avoid the per-sample stepping parameters the original uses.
2016-08-11 23:20:35 -07:00
Chris Robinson 2b3c7f211c Add 'restrict' to another parameter 2016-08-03 08:34:25 -07:00
Chris Robinson 0fcd39c4c0 Don't store the looping state in the voice
Certain operations on the buffer queue depend on the loop state to behave
properly, so it should not be deferred until the async voice update occurs.
2016-07-31 23:42:30 -07:00
Chris Robinson bff5268ed4 Remove DevFmtBFormat3D, which is covered by DevFmtAmbi1 2016-07-31 08:13:41 -07:00
Chris Robinson 4bcd2fbb2e Add an option to specify the ambisonic output configuration 2016-07-31 07:46:38 -07:00
Chris Robinson 33a84f17ac Add a stand-alone upsampler for higher-order ambisonic oputput 2016-07-30 09:29:21 -07:00
Chris Robinson b5b3ea95f8 Add a config to output first-, second-, or third-order ambisonics
Currently incomplete, as second- and third-order output will not correctly
handle B-Format input buffers. A standalone up-sampler will be needed, similar
to the high-quality decoder.

Also, output is ACN ordering with SN3D normalization. A config option will
eventually be provided to change this if desired.
2016-07-29 21:55:43 -07:00
Chris Robinson a6f41e4cb0 Remove the last use of ALfilterState_processSingle 2016-07-26 04:09:01 -07:00
Chris Robinson 25d1b7bdba Remove broken autowah effect code
It's been disabled forever, and I have no idea how to make it work properly.
Better to just redo it when making something that works.
2016-07-26 03:45:25 -07:00
Chris Robinson 45514ee32f Add some more restrict keywords 2016-07-26 00:07:39 -07:00
Chris Robinson 11b38e1190 Rename input_gain to b0 2016-07-26 00:03:44 -07:00
Chris Robinson 84ca38ba95 Make a MAX_AMBI2D_COEFFS macro instead of a magic number 2016-07-17 00:46:18 -07:00
Chris Robinson 470f454c53 Modify bs2b_cross_feed to do multiple samples at once 2016-07-13 23:08:11 -07:00
Chris Robinson 5106f035df Move the input channel array out of the DirectParams and SendParams 2016-07-13 01:39:44 -07:00
Chris Robinson 14166264d6 Store the voice output buffers separate from the params 2016-07-11 23:30:32 -07:00
Chris Robinson 0aae992f94 Reorder some source fields 2016-07-07 19:48:21 -07:00
Chris Robinson b495d80f56 Avoid using memcpy to copy a single struct 2016-07-06 13:33:40 -07:00
Chris Robinson d096e183a8 Remove a slightly outdated comment 2016-07-06 09:52:42 -07:00
Chris Robinson d340d50d49 Remove the VirtOut buffer alias 2016-07-05 14:18:17 -07:00
Chris Robinson 697ee19f71 Rename MaxNoOfSources for consistency 2016-06-08 11:19:33 -07:00