Skip to content

Bring back the older WinMM-based SAPI4 implementation#17801

Merged
SaschaCowley merged 9 commits into
nvaccess:masterfrom
gexgd0419:sapi4-winmm
Mar 19, 2025
Merged

Bring back the older WinMM-based SAPI4 implementation#17801
SaschaCowley merged 9 commits into
nvaccess:masterfrom
gexgd0419:sapi4-winmm

Conversation

@gexgd0419

@gexgd0419 gexgd0419 commented Mar 8, 2025

Copy link
Copy Markdown
Contributor

Link to issue number:

Based on discussion #17792.

Summary of the issue:

My current WASAPI implementation for SAPI4 does not work with every existing SAPI4 voices yet.

Most SAPI4 voices rely on the SAPI4's built-in WinMM implementation. The current WASAPI implementation behaves differently compared to the built-in implementation, which breaks some SAPI4 voices. Studying and replicating the behavior of the built-in implementation is also not easy, as this implementation is not open-sourced.

Description of user facing changes

A setting item, "Use WASAPI for SAPI 4 audio output", is added in the Advanced settings page.

It is enabled by default, which makes SAPI4 voices use my WASAPI implementation.

When disabled, SAPI4 voices will use the old built-in WinMM implementation to output audio.

No matter enabled or disabled, verbose debug logs for SAPI4 will be generated when the debug logging category "synthDrivers" is enabled in the Advanced settings. Users are encouraged to try both implementations with verbose debug log enabled when filing related bug reports, so that we can compare the difference in behavior between the two implementations more easily.

Description of development approach

WinMM related code, introduced in #17599, is brought back.

A feature flag, useWASAPIForSAPI4, is added in speech section.

Class SynthDriverMMAudio is added in sapi4 module. It's a wrapper for the built-in MMAudioDest, which can log the interactions with the TTS engine, with the decorator _logTrace.

Testing strategy:

Tested manually.

Known issues with pull request:

None yet

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

Copy link
Copy Markdown
Member

@gexgd0419 is this ready for review?

@gexgd0419 gexgd0419 marked this pull request as ready for review March 11, 2025 03:36
@gexgd0419 gexgd0419 requested review from a team as code owners March 11, 2025 03:36
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/userGuide.md Outdated

@Qchristensen Qchristensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reads well, good work.

@SaschaCowley SaschaCowley merged commit 2aa04f9 into nvaccess:master Mar 19, 2025
@github-actions github-actions Bot added this to the 2025.1 milestone Mar 19, 2025
@gexgd0419 gexgd0419 deleted the sapi4-winmm branch March 19, 2025 02:16
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.

3 participants