Skip to content

Fix SAPI4#18262

Merged
seanbudd merged 3 commits into
nvaccess:masterfrom
gexgd0419:sapi4-fix-com
Jul 10, 2025
Merged

Fix SAPI4#18262
seanbudd merged 3 commits into
nvaccess:masterfrom
gexgd0419:sapi4-fix-com

Conversation

@gexgd0419

@gexgd0419 gexgd0419 commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #18259.

Summary of the issue:

Digalo 2000 voices (SAPI4) do not work and cause memory access violation errors.

Description of user facing changes:

The issue should be fixed.

Description of developer facing changes:

None.

Description of development approach:

For some reason, the IAudio object was destroyed before it was even being used, causing its COM pointers to be reset to zero and access violations afterwards. So code are added to guard the SAPI4 IAudio object from being released prematurely.

Prevent joining the audio thread if the audio object is destroyed before starting.

Testing strategy:

Users reported that this works on their system.

Known issues with pull request:

SynthDriverAudio was released too many times might still be logged when working correctly.

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

@LeonarddeR

Copy link
Copy Markdown
Collaborator

@gexgd0419 Please keep in mind that whatever you fix with those voices can potentially break others. Sapi4 has turned out to be kind of a minefield.

@seanbudd seanbudd added the merge-early Merge Early in a developer cycle label Jun 16, 2025
@seanbudd seanbudd added this to the 2025.3 milestone Jun 16, 2025
@gexgd0419

Copy link
Copy Markdown
Contributor Author

This is yet another issue I could not reproduce (in a Windows 10 virtual machine). But as the user could reproduce with a fresh copy, and 2024.4 did not have this issue, I am trying to gradually revert to the previous implementation to see what went wrong.

@gexgd0419

Copy link
Copy Markdown
Contributor Author

I'm starting to think that maybe it's better to isolate the SAPI4 voices in a separate process where WinMM APIs are hooked, and send the audio data back via IPC channel. Although hooking every WinMM API may not be easy, this can keep the old SAPI4-related code intact and (maybe) reduce compatibility-related problems.

As NVDA will be migrated to 64-bit, an IPC approach will eventually be used. Is there any plan or direction about what kind of IPC approach will be used in 64-bit version of NVDA?

@gexgd0419 gexgd0419 changed the title Attempt to fix SAPI4 Fix SAPI4 Jun 29, 2025
@gexgd0419 gexgd0419 changed the base branch from master to beta June 30, 2025 02:43
@gexgd0419 gexgd0419 marked this pull request as ready for review June 30, 2025 11:55
@gexgd0419 gexgd0419 requested a review from a team as a code owner June 30, 2025 11:55
@gexgd0419 gexgd0419 requested a review from seanbudd June 30, 2025 11:55
@seanbudd

seanbudd commented Jul 1, 2025

Copy link
Copy Markdown
Member

Can you confirm if this affects #17964

@seanbudd seanbudd changed the base branch from beta to master July 10, 2025 05:07
Comment thread source/synthDrivers/sapi4.py Outdated
Comment thread source/synthDrivers/sapi4.py Outdated
@seanbudd seanbudd merged commit 1987a46 into nvaccess:master Jul 10, 2025
3 of 5 checks passed
@LeonarddeR

Copy link
Copy Markdown
Collaborator

Given the potentially positive impact of this change, why was this moved from beta to master again?

@seanbudd

Copy link
Copy Markdown
Member

@LeonarddeR - it is a risky change (see merge early label). We want this thoroughly tested so it doesn't delay the 2025.2 release. The current state of WASAPI 4 is quite stable compared to SAPI 5, with only 2 known synthesizer issues. We don't want to risk breaking other synthesizers this late in a beta cycle.

@gexgd0419 gexgd0419 deleted the sapi4-fix-com branch July 15, 2025 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-early Merge Early in a developer cycle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAPI 4. Digalo 2000 voices don't work with NVDA

3 participants