-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Use endpoint IDs instead of device friendly names to store user's preferred output device #17547
base: master
Are you sure you want to change the base?
Conversation
…f["audio"]["outputDevice"]
See test results for failed build of commit 6c9a566a08 |
# Conflicts: # user_docs/en/changes.md
What will be the recommended way to get the WinMM device index of the preferred output device, if a third-party synthesizer plugin cannot be migrated to WASAPI? |
See this Microsoft code sample on how to get the waveform ID from an Endpoint ID string. |
There are still some plugins which use Will there be a new helper function to convert endpoint IDs to WinMM device indexes? Or will they be encouraged to do conversion themselves instead of relying on helper functions in nvwave? Seems that in NVDA, the SAPI4-related code is the only place where |
@gexgd0419 the plan is to remove |
Link to issue number:
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
, rewrotegetPreferredDevice
to fetch the preferred device directly viaMMDeviceEnumerator.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
toendpointId
.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
, usednvwave._getOutputDevices
rather thannvwave.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 theoutputDevice
key fromspeech
toaudio
, and incremented the schema version to 14. Added an associated profile upgrade function inprofileUpgradeSteps.py
, and tests for same intests/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.
Code Review Checklist:
@coderabbitai summary