Add WASAPI toggle to SAPI5#18352
Conversation
|
@seanbudd @SaschaCowley What's your thought on the name, location, and display text of this new synth setting? (It's added at the end of the synth settings list for now) Should the existing config |
|
@gexgd0419 note I haven't reviewed any code:
|
45b91c3 to
4c8e6a3
Compare
|
|
|
Hmm. I guess we have 3 options:
@seanbudd, @michaelDCurran do you have any thoughts? I am leaning towards just keeping this as a checkbox (1) or not having it as part of the driver settings (3). I don't think (2) is worth the effort at this point. Given the time constraints and the tidiness of the code, I think I would probably go with option 1, but I'd like a second opinion. |
|
I have not reviewed this PR. I wonder: |
|
I think that the magic code that creates gui items based on config spec doesn't yet support feature flags. |
If it is useful enough, this can be implemented, I think. If there are going to be "per-voice driver settings", having this toggle as a driver setting may make it easier to fit in. By the way, when WASAPI for SAPI5 is disabled, "rate boost" will also be disabled. Should anything be done to disable or hide the "rate boost" checkbox in that case, or just leave it there? |
If possible, it would be better to disable (gray out) the rate boot checkbox in this case to denote that it does not apply in this situation. |
"Rate boost" is a driver setting, so the checkbox control is generated by the "magic code" in |
Any guidance on what I should do? @SaschaCowley @seanbudd |
|
We need to keep compatibility with older NVDA. |
|
@gexgd0419 - can you mark PRs ready for review when they are awaiting feedback from us |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new Use modern audio output system (WASAPI) toggle for both SAPI4 and SAPI5 synthesizers, replacing the old advanced-only SAPI4 setting and re-enabling legacy paths when WASAPI is turned off.
- Add new
useWasapisetting viaBooleanDriverSetting, exposed in voice settings for SAPI4/SAPI5 - Implement WASAPI vs. legacy audio initialization and audio ducking logic in both drivers
- Update user guide, GUI dialogs, and remove deprecated
useWASAPIForSAPI4config spec
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| user_docs/en/userGuide.md | Document new WASAPI setting under voice settings and remove old SAPI4 advanced UI |
| source/synthDrivers/sapi5.py | Add SPAudioState enum, audio ducking integration, WASAPI/legacy init and handling |
| source/synthDrivers/sapi4.py | Add UseWasapiSetting, useWasapi property, toggle between WASAPI and MMAudio |
| source/synthDriverHandler.py | Introduce UseWasapiSetting factory for driver settings |
| source/gui/settingsDialogs.py | Include useWasapi in standardSettings and remove old useWASAPIForSAPI4 UI |
| source/config/configSpec.py | Remove deprecated useWASAPIForSAPI4 configuration entry |
Comments suppressed due to low confidence (4)
source/config/configSpec.py:49
- The removal of the legacy 'useWASAPIForSAPI4' config spec will reset existing user preferences. Consider adding migration logic to preserve users’ existing settings.
trimLeadingSilence = boolean(default=true)
source/synthDrivers/sapi4.py:844
- [nitpick] New WASAPI toggle has been introduced; consider adding unit and integration tests to cover enabling/disabling audio paths for the SAPI4 synthesizer.
supportedSettings = [SynthDriver.VoiceSetting(), SynthDriver.UseWasapiSetting()]
source/synthDrivers/sapi5.py:252
- [nitpick] A new setting for WASAPI support has been added; please add tests verifying both paths (WASAPI enabled and disabled) for SAPI5 audio initialization and streaming behavior.
SynthDriver.UseWasapiSetting(),
source/synthDrivers/sapi5.py:39
- IntEnum is not imported in this file, so defining SPAudioState(IntEnum) will raise a NameError. Please add 'from enum import IntEnum' to the imports.
class SPAudioState(IntEnum):
|
I think we should go with (1) on your comment #18352 (comment) In regards to (3) I think we need to keep the old SAPI4 config option and sync with it, or not add this to SAPI4 until 2026.1 |
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
|
So should I keep both toggles for SAPI4, or keep only the old one? |
|
@gexgd0419 please keep only the old toggle for SAPI4 for now |
|
This pull request is updated to contain only changes to SAPI5. Not sure why #18310 isn't unlinked though. Should the "(WASAPI)" part in the description |
|
I can't seem to manually unlink it. Maybe we don't worry about that. I think keeping WASAPI there as is, is fine |
Fixup of #18352. Summary of the issue: When WASAPI is turned off, bookmark events are not handled properly. Description of user facing changes: Users might not notice that, because although the bookmarks are not handled in time, they are still processed at the end of the utterance. Description of developer facing changes: None Description of development approach: Code that handles the bookmark events when WASAPI is off is added.
Link to issue number:
Closes #18309.
Summary of the issue:
Users cannot turn off WASAPI for SAPI5 yet.
Description of user facing changes:
Add a synthesizer setting called
useWasapi, which is displayed as a checkbox labeledUse modern audio output system (WASAPI)in the voice settings when the built-in SAPI5 synthesizer is selected.Description of developer facing changes:
None
Description of development approach:
A new
SynthSettingbased onBooleanDriverSettingcalleduseWasapiis added and defaults toTrue. It is not in the settings ring.Legacy SAPI5 code are re-introduced to be used when WASAPI for SAPI5 is disabled.
Testing strategy:
Tested manually.
Known issues with pull request:
Code Review Checklist:
@coderabbitai summary