-
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use endpoint IDs instead of device friendly names to store user's pre…
…ferred output device (#17547) Closes #17497 Summary of the issue: NVDA currently stores the friendly name of the user's preferred audio output device. Description of user facing changes None. Description of development approach In `nvdaHelper/local/wasapi.cpp`, rewrote `getPreferredDevice` to fetch the preferred device directly via `MMDeviceEnumerator.GetDevice`. Added manual checks that the fetched device is a render device, and that its status is active, since these conditions were guaranteed to be met since the previous code only iterated over devices which met those prerequisites. Renamed `deviceName` to `endpointId`. In `source/mmwave.py`, added a parameter to `_getOutputDevices` to return a value representing the system default output device. Also made the type hints more self-documenting by using a `NamedTuple`. In `source/gui/settingsDialogs.py`, used `nvwave._getOutputDevices` rather than `nvwave.getOutputDeviceNames` to fetch the available output devices. When saving, used the selection index of `AudioSettingsPanel.deviceList` to index into the tuple of IDs to get the value to save to config. In `source/config/configSpec.py`, moved the `outputDevice` key from `speech` to `audio`, and incremented the schema version to 14. Added an associated profile upgrade function in `profileUpgradeSteps.py`, and tests for same in `tests/unit/test_config.py`. Updated all occurrences of this config key that I am aware of to point to the new location. In `source/synthDrivers/sapi5.py`, rewrote the device selection logic again to work with endpoint IDs. Testing strategy: Built from source and ensured that changing output devices works as expected. Ensured that saving the config worked, and that the output device was selected correctly when restarting NVDA. Tested activating SAPI5 with different output devices selected. Known issues with pull request: SAPI4 still doesn't work (#17516 ), this will be fixed in a future PR. Endpoint ID strings are not human-readable.
- Loading branch information
1 parent
a7fa0d6
commit 0f7e961
Showing
13 changed files
with
299 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
0f7e961
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
source/config/configSpec.py
, moved theoutputDevice
key fromspeech
toaudio
, and incremented the schema version to 14.This breaks, at least, Vocalizer Automotive, Vocalizer Expressive, Tiflotecnia Voices, IBMTTS and WhiteNoise.
0f7e961
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
This breaks add-ons initializing wave player with config.conf["speech"]["outputDevice"] passed into the player's constructor (Rui's list of add-ons is just some of the add-ons that will break in 2025.1). One can get around this in a number of ways:
Thanks.