95 Commits

Author SHA1 Message Date
Chris Robinson
ad95cb6312 Clear the whole buffer 2020-05-12 04:46:15 -07:00
Chris Robinson
deac36a1eb Improve the front stablizer
Apply the all-pass+band-split only once, after generating the mid and side
signals separately.
2020-05-05 01:05:38 -07:00
Chris Robinson
fcec76663f Move some sin/cos constants out of a loop 2020-05-04 16:16:55 -07:00
Chris Robinson
be476c7935 Use global placement new for AsyncEvent 2020-04-24 07:04:32 -07:00
Chris Robinson
2deb5e47d1 Avoid an unnecessary out parameter 2020-04-21 23:58:53 -07:00
Chris Robinson
3cb12da765 Move a type to where it's used 2020-04-16 02:05:07 -07:00
Chris Robinson
55539787fb Avoid ALfloat in some places 2020-04-08 06:17:04 -07:00
Chris Robinson
8f47013e43 Some more ALfloat->float cleanup 2020-04-03 08:49:15 -07:00
Chris Robinson
1130597562 Use structs for the mixer and resampler tags 2020-04-03 03:52:23 -07:00
Chris Robinson
8853519d89 Generate the bsinc tables using constexpr methods
All the methods used should be compliant with C++14 constexpr rules. However,
the number of scales and phases cause GenerateBSincCoeffs to reach the allowed
step limit, preventing full compile-time generation. It's not a terribly big
deal, it'll generate them very quickly when loading, but it does prevent using
shared read-only memory pages.
2020-04-02 00:49:19 -07:00
Chris Robinson
cc009b8aa0 Move the FrontStablizer definition to its own header 2020-03-30 01:16:15 -07:00
Chris Robinson
963d9b761b Rename ALvoice and related structs to Voice 2020-03-28 18:15:05 -07:00
Chris Robinson
f1f9a14172 Avoid AL[C]boolean for internal use 2020-03-28 18:15:05 -07:00
Chris Robinson
e8149ec509 Move some setup to a more logical place 2020-03-25 22:24:09 -07:00
Chris Robinson
a27096dd63 Dynamically allocate voice channel data
Rather than allocating for a full 8 channels for each voice, when the vast
majority will only need 1 or 2. The voice channel data is relatively big since
it needs to hold HRTF coefficients and history, and this will allow increasing
the maximum number of buffer channels without an obscene memory increase.
2020-03-25 21:06:24 -07:00
Chris Robinson
be1584ab47 Avoid assigning in a conditional expression 2020-03-22 11:35:08 -07:00
Chris Robinson
f56ef433d8 Move the FPUCtl methods to its own source 2020-03-20 15:01:45 -07:00
Chris Robinson
78251fd7e6 Fix voices being forced to update without valid properties
When starting a voice, the source ID was set before its first update struct was
provided, creating a small window where a listener or effect slot update could
force a voice to update without it having any valid properties to update with.
Supplying the update struct first would create a different race, where the
mixer could see a voice without a source but with an update struct, causing the
update struct to be 'freed' without being applied.

The fix here is to provide the update struct before setting the source ID, and
change the mixer to ignore update structs for voices without a source ID. This
can pseudo-orphan the updates that get set on a voice just as it stops, leaving
the struct unusable until the voice is used again, or the voice gets deleted
which will clear it. But it allows the update struct to stay in place and get
applied once the voice gets a source ID.
2020-03-04 23:18:05 -08:00
Chris Robinson
e7405f7801 Use a new voice state to indicate a pending source offset change 2020-03-04 10:16:59 -08:00
Chris Robinson
3e1a2c0f77 Use an intrusive_ptr for the device's HrtfStore 2020-03-01 17:16:09 -08:00
Chris Robinson
4555b74bd7 Use a VoiceChange object to change the offset of a playing source 2020-02-26 03:52:40 -08:00
Chris Robinson
872096958b Rename the voice's PendingStop to PendingChange 2020-02-26 01:48:59 -08:00
Chris Robinson
90d45984dc Simplify replaying a source 2020-02-23 21:40:54 -08:00
Chris Robinson
4660819f6a Avoid a single function call in a loop 2020-02-21 22:17:29 -08:00
Chris Robinson
a8162a77c2 Use an array of ALvoice pointers for the active voices
This allows growing the array atomically with the mixer since the ALvoice
objects themselves don't move, and a new larger array of them can be swapped in
without blocking the mixer.
2020-02-21 20:14:28 -08:00
Chris Robinson
0694df9014 Handle playing and pausing with VoiceChanges 2020-02-21 04:29:32 -08:00
Chris Robinson
9b43327f56 Asynchronously stop and rewind voices 2020-02-20 23:53:56 -08:00
Chris Robinson
bdb8ef22b0 Asynchronously stop voices if its source is being deleted 2020-02-20 22:50:37 -08:00
Chris Robinson
6ebdf3ab62 Use a triplet struct array instead of separate arrays 2020-02-09 14:25:20 -08:00
Chris Robinson
f2bc24f761 Consistently use distant wavefronts for 0 distance 2020-02-08 22:39:32 -08:00
Chris Robinson
85395b23a4 Clear voice target gains earlier 2020-02-08 18:10:59 -08:00
Chris Robinson
ebb1aaa06d Make sure stereo angles are kept in-range. 2020-01-31 11:11:06 -08:00
Chris Robinson
3904289af7 Only sort active effect slots as needed 2020-01-18 18:53:58 -08:00
Chris Robinson
75a58ae333 Simplify appending delayed samples 2020-01-14 12:13:00 -08:00
Chris Robinson
5324bdb908 Signal the event handler only once per update 2020-01-14 10:39:41 -08:00
Chris Robinson
6608e5dd9f Make sure unassociated voices give back their update structs 2020-01-08 07:31:01 -08:00
Chris Robinson
cdd24c7d01 Combine identical arrays 2020-01-04 00:59:49 -08:00
Chris Robinson
c1cf10f508 Handle downmixing for mono output 2019-12-29 20:35:47 -08:00
Chris Robinson
9ac8f25a05 Ignore direct channels for mono and B-Format buffers 2019-12-29 19:17:29 -08:00
Chris Robinson
701d43b41e Start a new extension for a new direct_channels state
So existing behavior remains consistent for anything that needs it, and new
behavior is opt-in.
2019-12-28 11:33:19 -08:00
Chris Robinson
3b3d3d3a03 Use a span for the band-splitter input 2019-12-25 21:48:58 -08:00
Chris Robinson
28e68d03d3 Fix a shadowed parameter warning 2019-12-23 23:13:45 -08:00
Chris Robinson
bff6696814 Avoid reading a struct field twice 2019-12-23 23:00:59 -08:00
Chris Robinson
2e6a55a87c Handle padding between device sample frames
The padding must be constant and sample type aligned (e.g. some fixed multiple
of two bytes between the start of two consecutive frames for 16-bit output).
The intent is to always have the ability for stereo output with WASAPI even if
the device has some other unsupported configuration, as long as front-left and
front-right exist.
2019-12-21 20:43:46 -08:00
Chris Robinson
54e7f48df9 Use unique setters for biquad filter parameters
One for whether a slope parameter is used, and one for bandwidth.
2019-12-21 02:02:57 -08:00
Chris Robinson
274fd36edd Improve gain/hf/lf packing when processing voice updates 2019-12-21 00:48:58 -08:00
Chris Robinson
4634002104 Remix missing channels with direct channels enabled
Instead of dropping them.
2019-12-19 04:38:34 -08:00
Chris Robinson
6480c2c854 Don't apply direct channels with mono output 2019-12-18 23:29:52 -08:00
Chris Robinson
5e35f73cad Don't process direct channel sources with attenuation 2019-12-17 22:40:49 -08:00
Chris Robinson
a8de1570e9 Update a comment since B-Format input isn't always FuMa 2019-12-17 22:25:00 -08:00