Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NVDA with wasapi does not reload current audio device on enter in audio settings panel #15759

Closed
cyrmax opened this issue Nov 8, 2023 · 2 comments · Fixed by #15781
Closed
Labels
bug/regression component/audio NVDA's audio output (nvWave, issues with usb audio etc). p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@cyrmax
Copy link

cyrmax commented Nov 8, 2023

Steps to reproduce:

  • Switch NVDA to wasapi mode;
  • In audio settings panel select not default audio device;
  • Disconnect this audio device;
  • NVDA should fall back to default device;
  • Reconnect selected audio device again;
  • Open audio settings panel and see that your custom audio output is still selected;
  • Press enter to re-apply settings.

Actual behavior:

NVDA does not switch back to custom audio device when it reconnects and does not try to reapply custom audio device setting when opening audio settings panel and pressing enter.
When not using wasapi, NVDA automaticaly tries to switch back to custom device when it reconnects or at least recovers it when pressing enter in audio panel.

Expected behavior:

Wasapi behavior should be identical to the old audio behavior.

NVDA logs, crash dumps and other attachments:

nvda2023-11-08.log

System configuration

NVDA installed/portable/running from source:

Installed.

NVDA version:

alpha-29899,cb356535 (2024.1.0.29899)

Windows version:

Windows 11 23H2 (AMD64) build 22631.2506

Name and version of other software in use when reproducing the issue:

N/A.

Other information about your system:

N/A.

Other questions

Does the issue still occur after restarting your computer?

Yes.

Have you tried any other versions of NVDA? If so, please report their behaviors.

Any NVDA version with wasapi.

If NVDA add-ons are disabled, is your problem still occurring?

Yes.

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Yes.

@Adriani90
Copy link
Collaborator

cc: @jcsteh

@seanbudd seanbudd added bug/regression p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation. labels Nov 9, 2023
@seanbudd seanbudd added this to the 2024.1 milestone Nov 9, 2023
@seanbudd seanbudd added p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority component/audio NVDA's audio output (nvWave, issues with usb audio etc). and removed p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority labels Nov 9, 2023
@jcsteh
Copy link
Contributor

jcsteh commented Nov 9, 2023

Implementation thoughts:

  1. Change wasPlay_getDevices so that it lists all devices, not just active ones.
  2. This will mean that WasapiPlayer is created with the device id of the preferred device, even if that device is unavailable, allowing us to manage that in the C++ code.
  3. Change WasapiPlayer to detect whether the specified device is unavailable, either by using error codes or by explicitly checking the device state.
  4. If the device is unavailable, fall back to the default device, but keep track of the preferred device id.
  5. In NotificationClient, track device state change notifications in the same way we track default device changes.
  6. In WasapiPlayer::feed, handle device state changes similar to how we handle default device changes.
  7. If a device state change occurs, check if the preferred device is available. If it is, switch back to that.

michaelDCurran pushed a commit that referenced this issue Nov 19, 2023
…15781)

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
1. Pass the device name to the WasapiPlayer C++ code instead of the device id. This means that WasapiPlayer is created with the device name of the preferred device, even if that device is unavailable, allowing us to manage that in the C++ code.
2. Removed wasPlay_getDevices and its Python callers, since they are no longer needed.
3. Changed WasapiPlayer::open to detect whether the specified device is unavailable using an error code. If so, it falls back to the default device. We leave the preferred device name alone so we can use it later.
4. If the device is unavailable, WasapiPlayer::feed still falls back to the default device, but again does not clear the device name.
5. In NotificationClient, we now track device state change notifications in the same way we track default device changes.
6. In WasapiPlayer::feed, we now handle device state changes similar to how we handle default device changes.
7. If a device state change occurs, we scan for the preferred device by name. If it is available, we switch back to that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/regression component/audio NVDA's audio output (nvWave, issues with usb audio etc). p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants