Sound split (#16071)
Fixes #12985
Summary of the issue:
Feature request: sound split. Splits system sound into two channels: NVDA speaks in one channel (e.g. left), while all other applications play their sound in the other channel (e.g. right).
Description of user facing changes
Added global command NVDA+alt+s that toggles sound split between off, NVDA on the left and NVDA on the right (default behavior).
Added combo box on Audio panel in NVDA settings that also allows to switch between Sound split modes.
Added list of checkboxes in Audio panel, that allows to change behavior of NVDA+alt+s command: it allows to select all modes that the global command will cycle through.
Description of development approach
Added pycaw library as a dependency.
Created file source\audio\soundSplit.py where I implemented all logic.
Contrary to what I said before, I managed to implement sound split without creating an extra monitor thread. It works like this:
When sound split is toggled, it uses IAudioSessionEnumerator to set volume in all currently active audio sessions.
Then it does sessionManager.RegisterSessionNotification() to create a callback that listens for any new audio sessions being created, an it executes the the same volume updating function upon creation.
On the next call or on shutdown we unregister the previous notification callback.