WASAPI: Switch back to the preferred device if it becomes available.#15781
Conversation
|
@jcsteh Very strange bug, when changing audio devices, some of them do not change. That is, despite the selected device, nvda speaks to the default device. When I rename the playback devices through properties, it starts working as expected. But when the devices have there original names, i.e. Virtual Out 1/2; NEOM USB, Virtual Out 3/4; NEOM USB, Virtual Out 5/6; NEOM USB, they don’t work, but if I, for example, replace the capital o in the word Out with a lowercase one, then the device for which I changed the letter starts working. Attaching a log file, here I'm switching between audio devices. The only one nvda Actually switched to is Virtual Out 5/6. |
|
Urgh. My guess is that you have multiple devices with the same names, but some of them are unavailable, possibly from previous installations of the driver or something like that. In order to support switching back to preferred devices, NVDA has to look at unavailable devices as well as available ones because the preferred device might be unavailable when NVDA starts. I'm not really sure how to fix this cleanly. I don't see how we can tell which is the actual preferred device, since we only store the name in the config, but both of them have the same name. Ideally, we'd store the id in the config instead of the name, but that would break existing configurations. I guess we could make the C++ code take names instead of ids and then scan for the name instead of the id. That's rather ugly, but we might have to live with it. |
|
I'm not convinced that the problem mentioned above needs to be solved. It is the user's responsibility to remove old devices from the system. Complicating NVDA code may create problems that will be harder to deal with in the future. I think @seanbudd should also join the discussion. |
|
Wouldn't there be a way to safely upgrade the config? I think we should probably display and store name/id pairs, so we can show all available devices. This makes it clear duplicates need to be cleaned up. |
|
Link to issue number:
Fixes #15759.
Summary of the issue:
If the audio output device is set to something other than the default and that device is (or becomes) unavailable (e.g. it is disconnected), NVDA will switch to the default device. However, when that device becomes available again (e.g. it is reconnected), NVDA continues to use the default device instead of switching back to the configured device. Worse, this can't be fixed by opening the audio preferences and pressing OK, since the Settings dialog only looks at the configuration and doesn't realise that the WASAPI code has fallen back to the default device.
Description of user facing changes
If the audio output device is set to something other than the default and that device becomes available again after being unavailable, NVDA will now switch back to the configured device instead of continuing to use the default device. (#15759)
Description of development approach
Testing strategy:
Known issues with pull request:
None.
Code Review Checklist: