nvda
b0228fe9 - Temporarily suspend audio ducking when a 32 bit synthDriver is in use (#19665)

Commit
205 days ago
Temporarily suspend audio ducking when a 32 bit synthDriver is in use (#19665) Partial fix for #19618 ### Summary of the issue: As 32 bit sapi synthDrivers introduced in pr #19432 produce audio directly in their own process, NVDA currently cannot correctly duck audio when they are in use. Specifically, if NVDA is set to always duck, the audio from these synths is ducked along with other external audio. And if set to duck for speech and sounds, their audio does not cause ducking, and any NvDA sound that does, ducks their audio. The correct approach to fix this for the long-term is to broker all 32 bit audio through NVDA, rather than it being played directly by the external process. See pr #19577. But until then, we should at least consider tempoarily disabling audio ducking while one of these synthDrivers is in use, so that its audio is not inappropriately ducked. ### Description of development approach: * Added a new private `_AudioDuckingSuspender` class to `audioDucking` which when at least one instance exists, temporarily suspends audio ducking, and disallows changing the current audio ducking setting via the gesture or GUI setting. When all instances are deleted, then audio ducking is restored back to the state it was before one or more instances were created. * `_bridge`'s `SynthDriverProxy` class when instantiated now creates an instance of `_AudioDuckingsuspender` and holds it on the SynthDriverProxy instance, thus causing audio ducking to be temporarily disabled while this synthDriver is in use. ### Testing strategy: With a copy of NVDA that supports audio ducking: * Using eSpeak, set audio ducking via the gesture to always duck. Confirm that audio stays ducked. * Choose the sapi 32 bit synth from the Select Synthesizer dialog. Confirm that audio is no longer ducked. * Try to cycle through audio ducking modes with `NVDA+shift+d`. Confirm that NvDA reports that audio ducking is not supported. * Go to the audio pannel in the NvDA settings dialog. Confirm that the Audio ducking mode control is disabled. * Choose eSpeak from the Selected synthesizer dialog. Confirm that audio is again ducked. * Try to cycle through the audio ducking modes with the gesture. Confirm that this works. * Confirm that the audio ducking mode in the Audio panel of the NvDA settings dialog is no longer disabled. ### Known issues with pull request: * This is a temporary partial fix that just ensures that audio ducking is correctly disabled. The full fix is to broker audio and again fully support audio ducking. PR #19432. * An alternative would be to grant the 32 bit synthDriver runtime process UIAccess and build audio ducking directly into it. However, adding a second process with UIAccess would greatly increase our possible attack surface, and is not moving in the direction of a secure add-on runtime.
Parents
Loading