393 Commits

Author SHA1 Message Date
Chris Robinson
f1f9a14172 Avoid AL[C]boolean for internal use 2020-03-28 18:15:05 -07:00
Chris Robinson
504745abec Use a standard bool instead of ALboolean 2020-03-28 18:15:05 -07:00
Chris Robinson
e78cb9b77f Avoid using more unnecessary type aliases 2020-03-28 18:15:04 -07:00
Chris Robinson
8731accd3f Make sure prebuf is filled when starting pulseaudio playback 2020-03-27 01:03:01 -07:00
Chris Robinson
e73c0979a1 Use "zero-copy" writes with pulseaudio playback 2020-03-26 22:50:54 -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
cc27bbb680 Clear the WASAPI device list when enumerating 2020-03-24 11:48:25 -07:00
Chris Robinson
62f17d8763 Don't send close messages for unopened WASAPI devices 2020-03-24 11:40:34 -07:00
Chris Robinson
41b4c06697 Simplify clamping the voice mix size 2020-03-23 11:35:08 -07:00
Chris Robinson
dc8ccc06ce More cleanup for the pitch shifter 2020-03-22 20:48:02 -07:00
Chris Robinson
813d4ed566 Use make_unique instead of new'ing into a unique_ptr 2020-03-22 18:48:33 -07:00
Chris Robinson
be1584ab47 Avoid assigning in a conditional expression 2020-03-22 11:35:08 -07:00
Chris Robinson
ef663f13c0 Properly allocate voices 2020-03-22 11:34:37 -07:00
Chris Robinson
3d09898d40 Use the correct include for al::fstream 2020-03-22 11:09:19 -07:00
Chris Robinson
2acdcba8d1 Silence a potential type truncation warning 2020-03-22 10:41:23 -07:00
Chris Robinson
f3ff28fb2a Some type cleanup 2020-03-22 10:41:02 -07:00
Chris Robinson
d30d9a2c9f Clean up the pitch and frequency shifter some 2020-03-22 10:06:23 -07:00
Chris Robinson
002d0eb6a0 Fix the frequency shifter channel panning 2020-03-22 08:51:59 -07:00
Chris Robinson
9ce182228d Avoid some pre-C++14 workarounds 2020-03-22 08:51:06 -07:00
Chris Robinson
040309b9f4 Add missing semicolon 2020-03-22 08:22:25 -07:00
Chris Robinson
adf28d87aa Remove the check for stat()
It's POSIX-2001 standard
2020-03-21 08:39:45 -07:00
Chris Robinson
12775513ae Cleanup some helper code 2020-03-20 15:48:27 -07:00
Chris Robinson
0d11de3e8d Move CPUCapFlags and FillCPUCaps to their own source 2020-03-20 15:30:41 -07:00
Chris Robinson
f56ef433d8 Move the FPUCtl methods to its own source 2020-03-20 15:01:45 -07:00
Chris Robinson
ad98895876 Avoid a function call to get the channel count 2020-03-18 04:08:26 -07:00
Chris Robinson
7805179313 Rename a method to be clearer 2020-03-18 03:17:14 -07:00
Chris Robinson
54e2eafcc9 Make the pulseaudio enumeration functions class methods 2020-03-18 03:07:54 -07:00
Chris Robinson
9f077d5f41 Remove a couple unused methods 2020-03-18 02:35:31 -07:00
Chris Robinson
bf50f227b9 Use a busy-wait when synchronizing against the mixer
The mixer should have higher priority than any thread that can make AL calls,
so even on single-core systems, it shouldn't stall the mix. It will, however,
return back to the caller as soon as it can, while yielding will give up the
timeslice if there's any other thread waiting to process even if the mix is
almost done.
2020-03-16 01:05:14 -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
accc1ec1c8 Add a helper to wait for the device mix 2020-03-03 20:32:44 -08:00
Chris Robinson
3e1a2c0f77 Use an intrusive_ptr for the device's HrtfStore 2020-03-01 17:16:09 -08:00
Chris Robinson
b42d241da5 Use real-time priority by default 2020-02-26 09:53:06 -08:00
Chris Robinson
eb49290dab Remove unnecessary locks now that the mixer doesn't require one 2020-02-26 04:58:02 -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
795c4fcecc Make the source's send array static instead of dynamic 2020-02-25 06:39:03 -08:00
Chris Robinson
af6584b8fc Reduce the maximum number of source sends to 6 2020-02-25 04:52:39 -08:00
Chris Robinson
52d86ad51f Ignore VoiceChange objects while disconnected
And try to improve ALvoice/VoiceChange handling when attempting to recover a
lost device.
2020-02-24 11:01:45 -08:00
Chris Robinson
90d45984dc Simplify replaying a source 2020-02-23 21:40:54 -08:00
Chris Robinson
6044e0d7ca Remove a couple unnecessary type aliases 2020-02-22 00:08:55 -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
acf7f6f74e Add a voice flag to indicate a voice has a pending stop
Pending/asynchronous stops to be implemented soon.
2020-02-20 19:18:07 -08:00
Chris Robinson
3aad01d3ba Add AL_SOFTX_callback_buffer to the extension list 2020-02-19 17:32:32 -08:00