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

Remove winsound.PlaySound from NVDA #17543

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

SaschaCowley
Copy link
Member

Link to issue number:

None

Summary of the issue:

NVDA currently uses winsound.PlaySound in a few places, which is part of the winmm API.

Description of user facing changes

None.

Description of development approach

Replaced these calls with calls to winsound.MessageBeep, as they are all calls to play system sounds.

Testing strategy:

Tested:

  • Pressing an unbound key in browse mode
  • Logging a message at level critical

I was unable to test typing into a protected cell, as my version of Excel brings up a dialog if you attempt to type into or edit a protected cell.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@SaschaCowley SaschaCowley requested a review from a team as a code owner December 17, 2024 05:51
Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add a lint rule banning it: https://docs.astral.sh/ruff/rules/banned-api/

@CyrilleB79
Copy link
Collaborator

I guess that it means that add-ons should not use it either?

This should be documented in the changes for developers. And if possible, also explain why; even if NVDA does not use winmm at all anymore, it's not clear to me why it should not be used at all (e.g. installer logo removed).

In th

@cary-rowen
Copy link
Contributor

There also appears to be a large number of speech synthesizer add-ons that rely on this API, meaning these synthesizers will be broken. If possible, could there be a more friendly documentation for add-on developers to explain or guide them on how to migrate to the new API?

@seanbudd
Copy link
Member

@CyrilleB79 - supportive of your suggestions here, we just can't publish details of the security issue yet

@SaschaCowley
Copy link
Member Author

@CyrilleB79, @seanbudd I don't think that this change needs to be documented in our changes for developers. We are just removing our own use of a function that has long been deprecated.

@cary-rowen I am a little confused. Do you want us to provide documentation on the Windows Core Audio APIs?

@cary-rowen
Copy link
Contributor

I'm not sure, but I think we should reduce maintenance costs for add-on developers as much as possible. If it's me and my add-on isn't working, I know NV Access made API breaking changes, but I'd like to know what's recommended next? What should I do?

@SaschaCowley
Copy link
Member Author

@cary-rowen we have made API breaking changes, but none of them stop add-on authors from using winmm. Add-on authors can still use whatever audio APIs they want to, we are just switching to Windows' core audio APIs internally. There is plenty of documentation on migrating from winmm to Windows core audio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants