Skip to content

[Windows] Implement OneCore TTS support using C++/WinRT.#116126

Closed
bruvzg wants to merge 1 commit into
godotengine:masterfrom
bruvzg:onecore
Closed

[Windows] Implement OneCore TTS support using C++/WinRT.#116126
bruvzg wants to merge 1 commit into
godotengine:masterfrom
bruvzg:onecore

Conversation

@bruvzg
Copy link
Copy Markdown
Member

@bruvzg bruvzg commented Feb 10, 2026

Fixes #69788

Tested on Windows 11 (25H2) and Windows 10 (22H2).

Notes:

  • pitch, volume, and rate are supported only on Windows 10 (1709)+
  • boundary callback might be inaccurate on versions before Windows 10 (1703)
  • should fall back to SAPI if no voices are found (e.g, on Wine, but both SAPI and OneCore TTS are non-functional stubs) or no API available (so might still run on Windows 8.1, not tested)

#include "core/variant/array.h"

GODOT_CLANG_WARNING_PUSH
GODOT_CLANG_WARNING_IGNORE("-Wdeprecated-pragma") // Note: remove after switching to C++20.
Copy link
Copy Markdown
Member Author

@bruvzg bruvzg Feb 10, 2026

Choose a reason for hiding this comment

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

Note: Added to suppress ./core/os/spin_lock.h:96:38: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma] warnings, since these files require C++20. Should be removed when the rest of the code is switched to C++20.

https://github.com/godotengine/godot/pull/100749/changes#diff-43749a19ee6902b8939bb8e2cf37d6abeb8e7be9612f39b701b67a8d4146de48

@bruvzg bruvzg force-pushed the onecore branch 2 times, most recently from 3bbe7cd to 4e9b5c6 Compare February 10, 2026 11:17
@akien-mga
Copy link
Copy Markdown
Member

Why do we need to vendor winrt headers? Aren't they part of the Windows SDK?

I'm not fond of adding 120k lines of code to solve this issue. Maybe it can be trimmed down to only the subset of headers we are using, which might be much less files?

@bruvzg
Copy link
Copy Markdown
Member Author

bruvzg commented Feb 10, 2026

Why do we need to vendor winrt headers? Aren't they part of the Windows SDK?

On Windows with MSVC, we do not, but it's not part of MinGW (MSYS has it as a separate package, most MinGW distributions doesn't have them at all, there are some headers of Win32 ABI namespace that supposed to be equivalent, but these are incomplete and/or broken).

For the reference, trimmed down from 1 335 940 lines (1346 files, 84 MB) of full C++/WinRT headers. Probably can be trimmed more by commenting parts of the files, but not sure if I should bother, since it's messy autogenerated headers.

@bruvzg bruvzg force-pushed the onecore branch 2 times, most recently from 1838bf0 to bc3b35e Compare February 11, 2026 08:02
@bruvzg bruvzg marked this pull request as ready for review February 11, 2026 11:23
@bruvzg bruvzg requested review from a team as code owners February 11, 2026 11:23
@bruvzg
Copy link
Copy Markdown
Member Author

bruvzg commented Feb 12, 2026

For the reference, trimmed down from 1 335 940 lines (1346 files, 84 MB) of full C++/WinRT headers. Probably can be trimmed more by commenting parts of the files, but not sure if I should bother, since it's messy autogenerated headers.

Editing the files is possible but won't be maintainable.

Since it's likely we'll need WinRT API for other stuff in the future, it might be reasonable to make a separate repo with full set of pre-build headers. And add winrt build option + dependency install script for MinGW like we do with D3D12 libs/headers.

For the reference, few other uses that can benefit from WinRT API:

Comment thread platform/windows/tts_driver_onecore.h Outdated
Comment thread platform/windows/tts_driver_sapi.h Outdated
@bruvzg
Copy link
Copy Markdown
Member Author

bruvzg commented Feb 16, 2026

Since it's likely we'll need WinRT API for other stuff in the future, it might be reasonable to make a separate repo with full set of pre-build headers. And add winrt build option + dependency install script for MinGW like we do with D3D12 libs/headers.

Made an alternative version of this PR which uses build option and download script for WinRT headers - #116349

@akien-mga
Copy link
Copy Markdown
Member

Superseded by #116349.

@akien-mga akien-mga closed this Mar 27, 2026
@akien-mga akien-mga removed this from the 4.x milestone Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DisplayServer tts_get_voices() does not load all installed voices on Windows

3 participants