Commit Graph

6900 Commits

Author SHA1 Message Date
Chris Robinson 41b4c06697 Simplify clamping the voice mix size 2020-03-23 11:35:08 -07:00
Chris Robinson 132a69c03d Use more appropriate types for bitfields 2020-03-22 21:34:50 -07:00
Chris Robinson 46234171d1 Clean up some C++11-isms 2020-03-22 21:15:12 -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 49b2d703e7 Properly define the new[] and delete[] operators 2020-03-22 13:28:45 -07:00
Chris Robinson 3c631149e3 Update AppVeyor to VS 2017 for 32-bit 2020-03-22 11:41:57 -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 f6a0b004e0 Update to C++14 2020-03-22 08:05:22 -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 48b9b541ec Avoid redundantly setting voice members 2020-03-04 13:40:21 -08:00
Chris Robinson 971862a80c Don't change flags after InitVoice 2020-03-04 11:01:35 -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 08dc831e0e Avoid unnecessarily reclearing some variables 2020-03-03 20:44:19 -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 a01617904c Simplify getting a voice for a new source offset 2020-02-28 20:07:43 -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 814f80ec59 Move voice initialization to a separate function 2020-02-26 01:39:30 -08:00
Chris Robinson 8618571866 Avoid storing the source offset when it's just read and reset 2020-02-26 01:03:23 -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 9ddfcd6a1b Update an comment about the default HRTF filters 2020-02-25 05:00:26 -08:00
Chris Robinson af6584b8fc Reduce the maximum number of source sends to 6 2020-02-25 04:52:39 -08:00
Chris Robinson 7144cf405a Handle playing voices after disconnection 2020-02-24 22:21:44 -08:00
Chris Robinson fd0ed9f33f Improve searching for the next voice when playing multiple sources
Instead of searching from the beginning of the voice list for each source, just
continue searching from the last source's voice.
2020-02-24 21:40:54 -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 8554e6cde2 Remove AL_SOFT_map_buffer from alffplay and add AL_SOFT_callback_buffer
The former doesn't really help too much since buffers still need to be
(re)filled and (de)queued individually. A callback buffer, on the other hand,
allows for greater efficiency since it just needs to write into a ring buffer
that the mixer will directly read from.
2020-02-23 06:28:39 -08:00
Chris Robinson a37932a0d0 Fix voice allocation increase amount 2020-02-22 18:01:34 -08:00
Chris Robinson 6044e0d7ca Remove a couple unnecessary type aliases 2020-02-22 00:08:55 -08:00