Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep a bit array of sources that should be playing.
This is way faster than iterating every possible source, which thrashes the CPU cache and looks at tons of sources that might not even be generated, let alone playing. alSourcePlay[v] will atomically set the appropriate bitfield to signal to the mixer thread that a new source should be added to the official playlist, and the mixer will atomically grab these bits, replace them with zero, and OR them into the official list, which only it manipulates...with this method, there's no risk of bits getting lost: of having a source in the AL_PLAYING state that isn't in the playlist. In the worst case, the mixer thread gets a stopped/paused/deleted source in the playlist, which is simply removes and won't bother with again on the next iteration.
- Loading branch information
Showing
1 changed file
with
101 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters