nvda
86f79e6b - When setting the volume, don't raise an exception if the audio device doesn't support 2 channels. (#16771)

Commit
1 year ago
When setting the volume, don't raise an exception if the audio device doesn't support 2 channels. (#16771) Fixes #16770. Summary of the issue: WasapiWavePlayer.setVolume assumes that the audio device supports 2 channels. Some devices do not. This causes an exception when trying to set the second channel. Description of user facing changes Playing NVDA sounds no longer fails on a mono audio device. Description of development approach Catch E_INVALIDARG which is the documented error code for this situation. Alternatively, we could check the number of channels before trying to set, but I don't think there's any benefit to that approach and that would require more C++ code. I also removed _wasPlay_errcheck. That was never actually called and was unnecessary because raising an exception for a failure is already handled by setting .restype to HRESULT. Furthermore, _wasPlay_errcheck was raising WindowsError with the wrong parameters, so it wouldn't have been what we wanted even if it had worked.
Author
Parents
Loading